Mencoder

From Indie IT Wiki

Mencoder is part of the Mplayer package, and I have to say that I am impressed with it. It is used to create most of the 'files' found on the web and does a very job where ffmpeg fails... especially with recordings made by MythTV which appear to have missing frames, loads of unwanted streams which ffprobe reports as dodgy.

2 Pass Transcode Of AVI From MythTV Recording

mencoder $INFILE -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:pass=1 -nosound -o /dev/null &>/dev/null && 
mencoder $INFILE -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=1152:pass=2 -oac mp3lame -lameopts br=96:cbr:vol=1 -info name="$TITLE" -info subject="$SUBTITLE" -o /var/lib/mythtv/exports/$FILENAME &>/dev/null

2 Pass Transcode Of DVD To xVid AVI With Cropping

Detect where to crop...

mplayer dvd://1 -chapter 3-3 -vf cropdetect

1st pass to work out video motion...

mencoder dvd://1 -vf crop=<values-from-above>,scale=-1:-1 -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:pass=1 -nosound -o /dev/null

2nd pass to do sound, video and output actual finished file...

mencoder dvd://1 -vf crop=<values-from-above>,scale=-1:-1 -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=1152:pass=2 -alang en -oac mp3lame -lameopts br=96:cbr:vol=2 -o output_file.avi

mythtvto.sh Script

#	Transcode a MythTV recording into an xvid .avi with the title and subtitle as filename.

# paully@mythbuntu-server2:~/Bin$ nuvinfo /var/lib/mythtv/recordings/10211_20101023210000.mpg |grep -w 'title:' |sed 's/.*title\:  //'
# |tr [:blank:] _

# In MythTV the variable %FILE%for user jobs does not contain the path

INFILE="/var/lib/mythtv/recordings/$1"

TITLE=$( nuvinfo $INFILE |grep -w 'title:' |sed 's/.*title\:  //' )
SUBTITLE=$( nuvinfo $INFILE |grep -w 'subtitle:' |sed 's/.*subtitle\:  //' )

#echo "TITLE=$TITLE"
#echo "SUBTITLE=$SUBTITLE"

NEWTITLE=$( echo "$TITLE" |tr [:blank:] _ |tr --delete "'" )
NEWSUBTITLE=$( echo "$SUBTITLE" |tr [:blank:] _ |tr --delete "'" )

#echo "NEWTITLE=$NEWTITLE"
#echo "NEWSUBTITLE=$NEWSUBTITLE"

FILENAME="$NEWTITLE-$NEWSUBTITLE.avi"

#echo "FILENAME=$FILENAME"

#echo "mencoder $INFILE -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:pass=1 -nosound -o /dev/null && "
#echo "mencoder $INFILE -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=1152:pass=2 -oac mp3lame -lameopts br=96:cbr:vol=1 -o /var/lib/mythtv/exports/$FILENAME"

mencoder $INFILE -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:pass=1 -nosound -o /dev/null &>/dev/null && 
mencoder $INFILE -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=1152:pass=2 -oac mp3lame -lameopts br=96:cbr:vol=1 -info name="$TITLE" -info subject="$SUBTITLE" -o /var/lib/mythtv/exports/$FILENAME &>/dev/null