Site Tools


software:mencoder

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
software:mencoder [2022/01/13 11:34] – [links] chrissoftware:mencoder [2022/11/13 12:06] – external edit 127.0.0.1
Line 1: Line 1:
 +==== 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 https://packages.debian.org or the application apt-file to find out what package contains the file
 +
 +  * for cutting videos i like ProjectX: https://avidemux.org/admWiki/index.php?title=Project_X
 +
 +==== reading dvd-tracks out ====
 +  * %%mplayer dvd://1 -dvd-device /path/with/vobfiles    # play from directory%%
 +<code>
 +# find out what tracks you want to encode
 +for i in 1 2 3 4 5 6 7 8; do
 +     mplayer dvd://$i
 +done
 +
 +media=disc3
 +for i in 3 4 5 6; do
 +   mplayer dvd://$i -dumpstream -dumpfile ${media}_t${i}.vob       # dump track in a file
 +done
 +</code>
 +
 +
 +
 +==== preprocessing ====
 +  * 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 ====
 +<code>
 +preparations:
 +mplayer strean.m2t -v # find out numbers of audio-streams. for example 512 and 513.
 +mplayer stream.m2d -aid 512 # verify first audio-stream
 +
 +</code>
 +
 +The command for 2pass-encoding all files ending in .ts is:
 +<code>
 +for i in file*.ts ; do
 +#VFOPTS='-vf crop=704:560:0:8,softskip,harddup'
 +VFOPTS='-vf pp=lb,softskip,harddup'
 +TITLE='my title'
 +BITRATE='bitrate=900'
 +
 +OPTSLOW="subq=3:8x8dct:bframes=9:frameref=2:weight_b:keyint=300:threads=auto"
 +OPTSHIGH="subq=5:8x8dct:bframes=9:frameref=4:weight_b:keyint=300:mixed_refs:b_adapt"
 +OPTSHIGH="$OPTSHIGH:direct_pred=auto:partitions=all:trellis=1:me=umh:me_range=16"
 +OPTSHIGH="$OPTSHIGH:psy-rd=0.5,0.3:qcomp=0.7:nr=300:threads=auto"
 +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
 +
 +done
 +</code>
 +
 +==== demultiplexing sound ====
 +For example to get mp3-file out of .flv files, ignoring the video-part.
 +<code>
 +# 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
 +</code>
 +
  
software/mencoder.txt · Last modified: 2024/06/11 04:31 by chris