[MEncoder-users] x264 questions

Loren Merritt lorenm at u.washington.edu
Mon Nov 26 13:19:20 CET 2007


On Sat, 24 Nov 2007, Peter Cordes wrote:

> Output of second (and later) passes play with the frames in the wrong
> order, so everything jitters back and forth.  This is like what you get with
> raw .264 output played back by mplayer.  The first pass plays smoothly, but
> later passes play out of order.

Huh? Raw .264 files play perfectly in mplayer. And ratecontrol (2pass or 
otherwise) can't possibly affect timestamps or frame order.

> I've never been happy with A/V sync from encoding separately, because 
> with x264 bframes=16:b_pyramid the decoding delay is 2 frames.  Writing 
> to a raw .264 file, mencoder seems to think it has to drop or add 2 
> framesat the beginning (don't remember which) because it doesn't have 
> anywhere to pass on the 2 frame time offset information.  If you iterate 
> an encode, it gets more and more out of sync, and loses a couple frames 
> each time.

If the *input* to mencoder has B-frames, then it will add dummy frames at 
the beginning and drop frames at the end. This isn't specific to h264, 
other than that B-pyramid has a delay of 2 while conventional B-frames 
have a delay of 1.
It doesn't matter what container the input is, nor does it matter what 
container or codec you output to.
And you really shouldn't iterate the encode: this problem occurs only with 
B-frames, and B-frames exist only in lossy codecs, and iterated lossy 
compression is bad.

--Loren Merritt



More information about the MEncoder-users mailing list