[MPlayer-users] A/V sync with two-stage encoding

Ian Smith the.pond at dsl.pipex.com
Wed Apr 28 21:26:19 CEST 2004

For a while now I have been trying to perfect a two-stage process 
whereby I record a "master" high-quality copy from my TV card, then 
"mix-down" to a 1Mb/s AVI file.

This way I can do a two-pass on the second stage to make best use of the 
lower bitrate, and I can also set my cropping rectangle exactly where I 
want it.

I have tried using high-rate mjpeg/mpeg4 encodings to achieve the master 
quality I need, but when I re-encode to the lower rates I always get A/V 
sync drift.

If the scenario above doesn't make any sense, picture the master as a 
freshly-ripped VOB file, (which incidentally works fine with no sync 

On seeing the lossless ffv1 encoder for the first time, I just had to 
try it!  So I made a master recording using the command line:

/usr/bin/mencoder -tv driver=v4l:width=768:height=576:input=0 tv:// -ovc 
lavc -lavcopts vcodec=ffv1:vstrict=-1 -oac copy -vop scale=384:288,pp=lb 
-endpos 00:05:00 -o grabbed.avi

Lovely!  Now I do a two-pass:

/usr/bin/mencoder grabbed.avi -ovc lavc -lavcopts 
vcodec=mpeg4:v4mv:trell:cbp:mbd=2:vbitrate=917504:vpass=1 -oac copy -o 

/usr/bin/mencoder grabbed.avi -ovc lavc -lavcopts 
vcodec=mpeg4:v4mv:trell:cbp:mbd=2:vbitrate=917504:vpass=2 -oac mp3lame 
-lameopts cbr:br=128 -o compressed.avi

and the dreaded A/V sync lag is back!  Any suggestions, or am I just 
doing something wrong?  I don't think I am, because there is no sync 
problem if I use an MPEG2 master source.

Note that I only encode the audio during the second pass.

Ian Smith
Worst . . . signature . . . ever !

More information about the MPlayer-users mailing list