[MPlayer-users] Request: some info about AVI and OGM file formats

Martin Collins martin at mkcollins.org
Sat Mar 22 22:11:48 CET 2003

On Sat, 22 Mar 2003 16:04:43 +0100
yardbird <frbiscani at libero.it> wrote:

> - If I have a video stream encoded (with lavcodec (mpeg4)and
> mencoder) at $VBRATE kbps/sec, at $FPS frames/second, an audio
> stream at $ABRATE kbps/s (MP3), and it is $TIME seconds long, what
> is the size of the AVI file created from these two streams?
> - Same question as above but for an OGM stream an vorbis audio
> instead of MP3.

According to this page:
the overhead for AVI is 0.93%-1.93% and for ogg (OGM) 1.11%
The manpage for ogmmerge says the ogm overhead is 1.1%-1.2% depending on
the number and type of streams used.

This this the part of my encoding script that does what you want:

OGG_SIZE=`ogginfo $NAME.ogg | grep data | cut -d' ' -f4`
OVERHEAD=`echo "$TARGET_SIZE / 100 * 1024 * 1024 * 1.5" | bc`
VIDEO_SIZE=`echo "$TARGET_SIZE * 1024 * 1024 - $OGG_SIZE - $OVERHEAD" | bc`
MINS=`ogginfo $NAME.ogg | grep Playback | cut -d' ' -f3 | cut -dm -f1`
SECS=`ogginfo $NAME.ogg | grep Playback | cut -d' ' -f3 | cut -d: -f2 | cut -ds -f1`
DURATION=`echo "$MINS * 60 + $SECS" | bc`
BITRATE=`echo "$VIDEO_SIZE * 8 / $DURATION / 1000" | bc`

This should be run after you have created your .ogg sound file and
before you start encoding your video.
TARGET_SIZE is the parameter you pass in to say how big you want your
final video and should be in MB.
Notice I am using 1.5% as my overhead figure. This means my completed
files always come in a little undersize.


More information about the MPlayer-users mailing list