[MPlayer-users] Encoding multiple audio streams into one file

Moritz Bunkus moritz at bunkus.org
Thu Oct 24 21:40:02 CEST 2002


Hi.

I always encode the audio prior to making any calculations. oggenc's
quality mode (e.g. 'oggenc -q3 -obla.ogg blubb.wav') is much better
than its 'managed bitrate mode' in which you could specify an average
bitrate.

So after encoding all my audio tracks (basically doing 'mplayer -ao pcm
-alang en -dvd 1 -aofile audio-en.wav...', 'normalize audio-en.wav' and
'oggenc -q3 -oaudio-en.ogg audio-en.wav', same for the other languages)
I use the following formula to calculate the video bitrate:

video_size = (target_size - audio_size) / 1.0115
video_bitrate = video_size / length / 1024 * 8

Where target_size and audio_size are in bytes (e.g. 700 * 1024 * 1024 -
sizeof(all ogg files)). The 1.0115 results from the overhead of putting
streams into an OGG file. length is the movie length in seconds. And
finally you end up with video_bitrate in kbit/s, ready to be used in
'-lavcopts vbitrate=video_bitrate'.

If you chose your frame size (cropping & scaling) wisely you'll always
end up with a OGG/OGM file that's +/- 1MB off of your intended target
size.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)




More information about the MPlayer-users mailing list