Log in

View Full Version : Splicing x264 encoded parts together?


asarian
15th October 2010, 00:22
Let's say I have an encoded movie (with x264), with some artifacts in a frame in the first 5 minutes.

If I re-encoded the first 5 minutes (same settings and all), could I splice the two parts together somehow? (without having to re-encode both). I mean, it's all a stream being encoded in a run-length sorta way, but does it ever stop and start from scratch? Like with the start of a new frame, or end of a GOP or something? If so, I might be able to splice pieces together.

Thanks.

Blue_MiSfit
15th October 2010, 02:27
It's definitely possible, though it should happen on GOP boundaries - probably only on true "IDR" I frames.

I don't know of a tool that does this off the top of my head.

You're probably best off just re-encoding the whole thing :P

Derek

asarian
15th October 2010, 02:43
It's definitely possible, though it should happen on GOP boundaries - probably only on true "IDR" I frames.

I don't know of a tool that does this off the top of my head.

You're probably best off just re-encoding the whole thing :P

Derek

Thanks for the reply.

Yeah, I would normally just re-encode; but in this particular case, I'm having a movie ("Stargate") which keeps crashing the MCTemporalDenoise process a lot (tried all different sorts of thread numbers). Anyway, as it finally encoded properly, there appeared exactly 1 frame in it that has artifacts. So, I was hoping of maybe just having to redo the first few minutes.

roozhou
15th October 2010, 02:45
This is called segment re-encoding. Professional encoders like CineVision can do this. If you are using x264, mkvmerge can help you split and join encoded videos.

asarian
15th October 2010, 03:35
This is called segment re-encoding. Professional encoders like CineVision can do this. If you are using x264, mkvmerge can help you split and join encoded videos.

Thanks. I'll look into mkverge again (last time I did, a year ago or so, I didn't get the impression it was at all capable of such fine-grained splicing; but I like to be surprised).

Blue_MiSfit
15th October 2010, 07:15
I think x264 would be more than capable of doing this - it's just not really the encoder's job. It's more the job of the calling application / muxer in my opinion.

A gui built around libx264 could do it, I'd imagine :)

asarian
16th October 2010, 11:27
Operation succeeded with mkvmerge! :) Had a bit of trouble remuxing afterwards, as tsMuxeR doesn't seem to recognize the mkv generated by mkvmerge (?); but eac3to came to the rescue (remuxing to another mkv). I guess it's that header compression thingy or some such.

To avoid the least possible delays, finally I just split the files in half, and spliced the latter half of the old movie to the former half of the new encode (without the frame with artifacts).

The result? Flawless, and seamless new movie; and not any delay that I can witness (I can usually spot anything thing from a 50-100ms sync-error).