sodnpoo.com

mencoder strict dvd mpeg script

This small script should convert any thing mplayer/mencoder can decode in to a strict dvd mpeg2 file, with ac3 audio and two pass encoding. Suitable for playback on pretty much anything that'll read a dvd.

The flags were pulled from here .

#!/bin/bash

flags="-oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf 
-vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -ofps 25 
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=1800:"
flags="${flags}keyint=15:vstrict=0:acodec=ac3:abitrate=192:aspect=16/9:"

#uncomment for super-high-quality
#flags="${flags}trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:"
#flags="${flags}vqmin=1:lmin=1:dc=10:vbitrate=5000:"

echo flags:
echo $flags
echo

for input in "$@"
do
  echo "input file  : $input"
  output="${input%.*}.mpeg"
  output="./${output##*/}"
  echo "output file : $output"
  echo

#  nice mencoder "$input" -o "$output" ${flags}
  nice mencoder "$input" -o "$output" ${flags}vpass=1
  nice mencoder "$input" -o "$output" ${flags}vpass=2
  echo
done