[MEncoder-users] number of yuv4mpeg frames does not match audio length.

R.L. Horn lists at eastcheap.org
Wed May 21 21:22:15 CEST 2008


On Wed, 21 May 2008, Maarten de Boer wrote:

> I am trying to convert a VOB file to h264+aac in an mp4 container (using
> x264, faac and MP4Box). I don't get the mp4 to be A/V sync (the
> material has some very obvious points). Investigating this problem, I
> found that the yuv4mpeg stream that I am using as input for x264 does
> not have the expected number of frames. As a reference, I look at the
> duration of the extracted audio:
>
> mplayer -vo null -ao pcm test.vob
>
> Duration    : 00:00:11.168
>
> At my framerate of 29.97, this corresponds with 334.7 frames (not sure
> whether to round this up or truncate it)

Lossy encoders, by their nature, tend to pad at the end and, besides, the 
audio isn't always (in fact, is rarely) exactly the same duration as the 
video.

Lots of video suffers from sync problems, either because of how it's 
encoded, or sloppy edits, or mixed hard/soft telecine, etc., etc., etc. 
To get a usuable video stream, it's often necessary to examine the A/V 
sync which, unfortunately, means muxing in audio.  Try encoding with 
-oac copy and see if you get dropped or duplicated frames.

> mplayer -harddup -noframedrop -vo yuv4mpeg -ao null test.vob
>
>  333 frames
>
> mencoder test.vob -vf-add harddup -vf-add =i420 -ovc raw -of rawvideo 
> -nosound -o mencoder.420
>
>  333 frames

I've noticed that mencoder sometimes loses the last frame with some 
coders, but raw output has been pretty reliable for me.  A dropped last 
frame wouldn't affect A/V sync at any rate.



More information about the MEncoder-users mailing list