User Tools

Site Tools


setup mplayer on debian the right way for encoding

  • first: apt-get install gcc make libxv-dev libsdl1.2-dev vorbis-tools mkvtoolnix
  • you have to download and compile at least (see mplayer-docs for where to get the software)
    • the x264 codec
    • lame (if you want mp3 sound encoding)
    • vorbis-tools (contains 'oggenc' for encoding sound to ogg vorbis)
    • mplayer itself
  • procedure to find out what dev-files are needed:
    • get mplayer-sources, run ./configure
    • less configure.log, look for i.e. “Xv” which you need enabled, see what files are needed.
    • then use or the application apt-file to find out what package contains the file

reading dvd-tracks out

  • mplayer dvd://1 -dvd-device /path/with/vobfiles # play from directory
# find out what tracks you want to encode
for i in 1 2 3 4 5 6 7 8; do
     mplayer dvd://$i

for i in 3 4 5 6; do
   mplayer dvd://$i -dumpstream -dumpfile ${media}_t${i}.vob       # dump track in a file


  • Started cropping black stripes off bevore encoding. 'mplayer disc1_t3.vob -vf cropdetect' gives hints, 'mplayer disc1_t3.vob -vf crop=688:560:18:8' actually crops, 'mplayer disc1_t3.vob -vf rectangle=688:560:18:8' shows what will be cropped off. The resulting pixelranges should be dividable by 16 for efficient encoding later.
  • Noticed when fast moves in the video happen that video is interlaced. 'mplayer -pphelp' shows some possible options, 'man mencoder' also leads to option filmdlint and others. Just '-vf pp=li' does the job for me. Can be checked with 'mplayer disc1_t1.vob -vf crop=688:560:18:8,pp=li'.

encoding files with multiple audio-streams

mplayer strean.m2t -v # find out numbers of audio-streams. for example 512 and 513.
mplayer stream.m2d -aid 512 # verify first audio-stream

The command for 2pass-encoding all files ending in .ts is:

for i in file*.ts ; do
#VFOPTS='-vf crop=704:560:0:8,softskip,harddup'
VFOPTS='-vf pp=lb,softskip,harddup'
TITLE='my title'

OPTSHIGH="$OPTSHIGH:psnr:ssim:log=2"            # output-options
OPTSHIGH="$OPTSHIGH:nointerlaced:nofast_pskip:nodct_decimate" # no longer in mappage=no longer used?

# get audiostreams out
mplayer $i -ao pcm:fast:waveheader:file=${i}_ger.wav -vc null -vo null
#mplayer $i -ao pcm:fast:waveheader:file=${i}_eng.wav -vc null -aid 193 -vo null

mencoder $i -o /dev/null -nosound $VFOPTS -ovc x264 -x264encopts \
        $BITRATE:pass=1:$OPTSLOW:turbo=2 || exit 1
mencoder $i -o $i.2pass_x264.avi -nosound $VFOPTS -ovc x264 -x264encopts \
        $BITRATE:pass=2:$OPTSHIGH || exit 1

oggenc -q5 ${i}_ger.wav
#oggenc -q5 ${i}_eng.wav

mkvmerge -o $i.mkv --title "$TITLE" --language 2:ger \
        $i.2pass_x264.avi ${i}_ger.ogg

#  mkvmerge -o $i.2.mkv --title 'ggf' --language 2:ger --language 3:eng \
mkvmerge -o $i.2.mkv --title "$TITLE" --language 2:ger $i.mkv


demultiplexing sound

For example to get mp3-file out of .flv files, ignoring the video-part.

# first try dumping the audio-stream, all two commands below try to do this:
mplayer infile.flv -ao pcm:fast:waveheader:file=outfile.wav -vc null -vo null
mencoder -ovc frameno -oac pcm infile.flv -o outfile.wav -of rawaudio

# if you get a useful outfile.wav just encode it to ogg or mp3:
lame outfile.wav

# this encodes directly just the audio. br=128 is the mp3-average bitrate. You could just 
# use the bitrate from the inputfile. The audio gets reencoded thou, so quality gets worse anyway.
mencoder -ovc frameno -oac mp3lame -lameopts abr:br=128 -of rawaudio inputfile.flv -o outputfile.mp3
software/mencoder.txt · Last modified: 2022/08/03 13:16 by