Log in

View Full Version : Encode with the same settings of another encode? Or how to append h264 streams


Sakura-chan
18th March 2013, 07:25
Well, I couldn't think of a shittier title.

My situation is like this. I have a nice encode of something, let's say mkv A, that has the last 5 minutes corrupted. Then I have a more crappy encode of the same content intact, let's say mkv B.

The idea is to cut the last 5 minutes of both mkvs and append the last little part of B to the larger chunk that is A. That way I can keep the better encode and replace the last bad 5 mins. To do this I'll have to re-encode B to match the video in A.

Now, both are h264 streams that don't match in anything, nor resolution nor framerate. That way is impossible to append in mkvmerge.

So I grab MeGUI (the only thing I know how to use), resize, change the framerate and encode (I know file A was encoded with CRF 18, so I use that). Then I try to remux appending my new encode of file B to A, and mkvmerge says:

Warning: The track number 0 from the file 'C:\New Encode.mkv' can probably not be appended correctly to the track number 0 from the file 'C:\File A.mkv': The codec's private data does not match (lengths: 44 and 41). Please make sure that the resulting file plays correctly the whole time. The author of this program will probably not give support for playback issues with the resulting file.

The file plays but the last five minutes are all a grey screen. No video, only sound. I guess that to append two h264 streams and be compatible with each other they have to be encoded with the exact same settings.

The properties of file A show this:

Writing library : x264 core 65 r999 cc51047

Encoding settings : cabac=1 / ref=16 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=umh / subme=6 / psy_rd=1.0:0.0 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-4 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=8 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=1 / wpredb=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=crf / crf=18.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00 / zones=202334,207820,q=70

I tried copying that into the "custom command line" in the x264 config of MeGUI, but it throws an error when encoding. Any ideas? Do h264 streams really have to be exact, all the way down to the tiniest of the settings, to be appended and play correctly? Can you use those settings to produce an encode that is the same to a previous one? Do I even need to hunt down the exact same version of x264?

Thanks for any suggestion :3

Kurtnoise
18th March 2013, 08:50
Use raw AVC output instead of mkv...that should work.

Sakura-chan
19th March 2013, 02:57
Use raw AVC output instead of mkv...that should work.
:goodpost:

Using raw AVC at first didn't work, when appending mmg complained that the formats didn't match. But when remuxing the .264 file by itself in mmg and then append using the resulting MKV, it all went fine and the final MKV plays perfectly.

The MKVs output by MeGUI are done with Haali Muxer. Why it results in a bad mux (the grey screen) when appending to another MKV in mmg, no idea.

But finally it all works and that's what matters. Thanks for the hint! :o

Kurtnoise
19th March 2013, 08:52
The MKVs output by MeGUI are done with Haali Muxer.
Huh ??? No, it uses mkvtoolnix package...The mkv output in the x264 compressor has been made by Haali though.