Back Forum Reply New

x264 codecprivate

I've been trying to re-encode portions of a dvd that didn't come out so hot, and to do it I'm trying to merge my original encode with the new (both via mp4box and mmg). Problem is, each time the codecprivates differ, so mp4box places it in another track and mmg's output (when overridden to allow them to merge) just crashes. The funny part is, they have the exact same options, with the exception that the primary encode was a 2pass (first pass was crf) and the secondary encodes were crf. I also tried making normal 2passes for them, those also crash. Everything used a custom matrix.

I'm wondering what causes the codecprivates to change? Is it possible to be compatible between changes? Do they differ only where necessary for playback? Is it possible to directly recode segments to use different private info?

I've attached the options and codecprivates of two of these encodes, in case anyone wants to look at what I did wrong. I guess I'll have to redo this encode with zones, but it would be nice to know for next time, since splicing is so much faster than full compression.

x264 writes your encoding options in a comment. mkvmerge doesn't distinguish between comments and real differences.
The quick fix is to hexedit the comments to be identical. The good fix is to modify mkvmerge.
edit: oops, wrong.

This isn't the comment, though I did include them in the zip in case there's something obvious that would cause differences. (The comments are 484 and 527 bytes, the codecprivatefields given by mkvinfo are binary data of only 132 and 131 bytes.)

Since the attachment still isn't approved I uploaded it, if you care to see what mkvmerge considers codecprivate:
random/intropriv.zip

could you post the beginnings (~700 bytes) of the files generated by mkvextract?

random/raws.zip
It has the results with and without the --raw switch, though they only seem to differ after the comment block anyway.

Edit:
In fact, here's the intro and the first gop of the main movie.
r...rokenmovie.zip

OK, they differ in quot;initial QPquot;. In cqp and crf modes, x264 sets this to the nominal qp to avoid having to fully specify the qp each frame (saves a few bits). In bitrate modes, we don't know the average qp in advance, so it's left at some constant value.
So your two clips are in fact incompatible (would need rewriting some of the frame headers).
quick fix: generate the intro with 2pass, or mess with encoder/set.c

Thanks! I'll have to remember to 2pass any patches then (I figured out that my initial 2pass attempt had an incompatible option, oops. It worked when I fixed that).

thats good to know!

aku, would it be possible to introduce an option ala quot;--initial-qpquot; letting the user specify this easily?
¥
Back Forum Reply New