[MPlayer-users] A/V sync with two-stage encoding
D Richard Felker III
dalias at aerifal.cx
Wed Apr 28 21:38:03 CEST 2004
On Wed, Apr 28, 2004 at 08:26:19PM +0100, Ian Smith wrote:
> 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
> problems).
>
> 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
> /dev/null
>
> /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.
This is probably the broblem. Even if it deoesn't cause a/v desync,
changing audio params between the passes will mess up the 2pass
process and reduce quality. This is because mencoder's (bad) a/v sync
system depends on the behavior of the audio encoder...
Rich
More information about the MPlayer-users
mailing list