[MPlayer-users] [newbie] GUIDE to mencoder (1 or 2 CD)

Martin Collins martin at mkcollins.org
Fri Jun 11 11:17:26 CEST 2004


On Fri, 11 Jun 2004 12:33:40 +0400
Philippe Monroux <ph.monroux-DEL-SPAM at wanadoo.fr> wrote:

> Ok. But I don't know how to determine the final sound size for
> example ogg-vorbis

You encode the audio first then measure its size. Subtract that from
your target size to get the size for your video.

> Sure. I prefer ogg but I don't know the way.

You need ogmtools from http://www.bunkus.org/videotools/ogmtools/
 
> I've searched but I have not found one for fixed size (1 or 2 CD)
> that is :
> 
>    - how to  re-encode the sound and  determine the final  size of
>    the sound 
>    - how   to  to   precisely   determine  the   bitrate  with  
>    sound consideration

There is encoding-tips.txt in the mplayer docs. Here's some shell script
for encoding AC3 from a vob file to ogg vorbis and calculating the video
bitrate:

# split out the audio and encode it to vorbis
if [ ! -e $NAME.ogg ] ; then
    tcextract -a $AUDIO_TRACK -i $NAME.vob -x a52 -d 0 |\
    tcdecode -x a52 -d 0 |\
    oggenc -r -B 16 -C 2 -R 48000 --resample 44100 -q 0 -o $NAME.ogg -
    # see http://www.replaygain.org/ for an explanation of this
    vorbisgain $NAME.ogg
fi

if [ "$TARGET_SIZE" = 0 ] ; then
    # Size is not important so set an arbitrary bitrate
    BITRATE=2800
else
    # figure out what bitrate we need to get our target size
    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`
fi
echo $BITRATE

Then you do a 2 pass mencode, followed by ogmmerge.
You will need transcode, vorbis-tools and optionally vorbisgain. Also note
that for tcextract the audio track numbers start at 0 but for mencoder
they start at 128.

>    - how to optimise quality

I'll let someone else fill you in on this :-)

Martin




More information about the MPlayer-users mailing list