[MPlayer-users] vbitrate without frameno.avi

D Richard Felker III dalias at aerifal.cx
Wed Feb 18 23:36:13 CET 2004


On Wed, Feb 18, 2004 at 08:17:18PM +0100, Matthias Czapla wrote:
> On Wed, Feb 18, 2004 at 01:28:44PM -0500, D Richard Felker III wrote:
> > On Wed, Feb 18, 2004 at 05:10:10PM +0100, Matthias Czapla wrote:
> > > So its now dprecated to use frameno.avi. Ok, but how is one supposed to know
> > > the needed vbitrate to get a file with a specific size? Luckily I dont need
> > > VBR MP3 so I thought I can just do
> > 
> > Even with VBR mp3 you can do this. The bitrate is very predictable
> > over the length of a whole movie, and you can measure it during
> > vpass=1 and then adjust the vbitrate slightly during vpass=2 if you
> > need to...
> 
> Really? I thought the two passes _must_ be run with exactly the same
> options?

Except bitrate. In principle, even changing this too much between
passes _could_ lower quality, but you'd have to make a huge change for
it to be even 0.01 psnr (negligable still). So it's perfectly safe to
adjust bitrate by 2-5% between passes, or whatever you need to do to
make it fit.

> And although I dont need VBR, how do you predict the bitrate for
> MP3?

For a given q=N value, just see what birate you get encoding the first
movie you encode. Other movies should be within a few percent of the
same rate. This doesn't _have_ to be true, but in practice it usually
is -- close enough that it'll work. And if not, adjust vbitrate
slightly for the second pass.

> > > 700 * 1024 * 1024 * 8 / movie_length_in_seconds
> > > to get the overall bitrate available and subtract the MP3 bitrate from the
> > > result to obtain the vbitrate for -lavcopts. But this does not work - the
> > > resulting file 745 Mill. Bytes instead of the desired 733.
> > 
> > AVI files have a good bit of overhead, at least 32 bytes per frame...
> > This is likely a large part of the problem.
> 
> I already thought about this too and was hoping to get some definite
> numbers. The bitrates the frameno run displays at the end are always correct
> so there has to be a formula to calculate them since mencoder obviously uses
> it :)

It doesn't use a formula. It measures the size of frameno.avi and
subtracts this as the overhead. :)

> BTW, this bitrate printed by mencoder at the end of a frameno run is always
> exactly the same I get when calculating
> (wanted_avi_size - size_of_frameno.avi) / length_in_seconds
> where the sizes are in Bits. This indicates that the complete overhead is
> already contained in frameno.avi in addition to the MP3 data.

Yes.

> Maybe I can calculate the AVI overhead per second by taking the file size of
> a frameno.avi in Bits divided by the length in seconds and subtracting the
> specified bitrate for MP3. I will check that. Thanks so far Rich!

Yes, that's a good approach that should be mostly correct. Overhead
should always be the same percentage, unless you change the framerate
or audio samplerate.

Rich




More information about the MPlayer-users mailing list