[MPlayer-users] Mencoder audio pass messes up video pass

D Richard Felker III dalias at aerifal.cx
Sat Jul 5 16:12:53 CEST 2003


On Sat, Jul 05, 2003 at 01:14:42PM +0200, Sumant S.R. Oemrawsingh wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> On Fri, Jul 04, 2003 at 10:49:23PM -0400, D Richard Felker III wrote:
> > > However, when I completely skip the first (audio) pass and directly encode
> > > the video first (with oac copy), the dvd is nicely encoded. But then I have
> > > a52 (AC3) audio, which takes a bit too much space, which I'd rather spend on
> > > audio.[4,5]
> > 
> > If you skip the audio pass at the beginning (and I would definitely
> > recommend skipping it), then don't use -oac copy for the video passes.
> > Actually, you can perhaps use it for the first video pass for speed,
> > since you'll be throwing away the output of that one anyway, but for
> > the final pass, use -oac mp3lame with your desired -lameopts.
> 
> Hi,
> 
> Thank you very much for your help. Do you recommend to always skip the
> audio pass, or do you only recommend it to avoid this problem? If you
> recommend to always skip the audio pass, why?

Because it's buggy and unpredictable like you just described, and not
at all useful.

> This, indeed, works on this particular DVD I have here. But three-pass
> encoding works well for other DVD's. It gives me the advantage of not having
> to use a constant audio bitrate and use the video bitrate that mencoder

There's no reason you have to use CBR; in fact, it will always be
lower quality than ABR or VBR at the same average.

> suggests. Usually when I use abr with a bitrate of, say, 128, it averages
> out at around 118 or even lower. I have even fooled around with vbr and
> quality (on DVD's where I found sound to be more important than video).  So
> if I calculate the videobitrate in advance, mencoder always suggests a
> higher bitrate to fill the CD. And very often, I've noticed that this makes
> some difference. That's why I find the first (audio) pass useful.

With something as long as a movie, the average bitrates used by
different VBR quality settings should be mostly independent of the
movie. At the very least, bitrate average should differ by at most 10
kbit/sec or so. So, once you learn what the audio bitrate comes out to
be with the quality settings you like, just do your own calculations
to decide on a video bitrate.

If you *really* want to optimize for bitrate, you can do the
following: during (video) pass 1, encode audio to mp3 and save the
output file. Then, write down the resulting audio bitrate/size and
compute the exact video bitrate. Now dump the audio from the first
pass with mplayer -dumpaudio and in (video) pass 2, use -audiofile and
-oac copy to mux the audio you encoded during pass 1 into the new
video you're encoding in pass 2.

If you don't want to go to all that trouble and your CPU is plenty
fast, you might just prefer to repeat encoding the audio in pass 2.
Then it's very simple.

> Anyway, I can circumvent the problem for this particular DVD with your
> solution. But I'd still like to know: is this a `feature' in mencoder, the
> decoding libraries or the DVD?

While preencoding the audio is an ok idea, the whole "frameno" design
in mencoder is fundamentally flawed and *cannot* work correctly in
certain cases. This is because with certain files/codecs/filters, you
don't have enough information to decide which frames to drop/duplicate
without actually decoding the video.

IMO the 3-pass/frameno system should be ditched, and replaced with an
automated version of what I described above...

Rich



More information about the MPlayer-users mailing list