DVD ripping

This is the script I use to rip DVDs to mpeg4 with aac audio for playback on my PS3 and Neuros Link.

#!/bin/sh

echo input the DVD title :

read TITLE

echo input the track number :

read TRACK

# 128 is the standard english audio, may want to check this

AID="-aid 128"

# make a file name without spaces

#FILE=`echo $TITLE | tr '[[:blank:][:punct:]]' '_'`

FILE=`echo $TITLE | tr -d '[:punct:]' | tr '[:blank:]' '_'

# probably needs some error checking here

echo rip info : $TRACK $AID

echo encode info : $TITLE $FILE

#--- get the raw data from the DVD

time mencoder dvd://$TRACK -oac copy -ovc copy $AID -o no_idx.avi

#--- fix any index problems

time mencoder -forceidx no_idx.avi -oac copy -ovc copy -o input.avi

#---- make the mpeg4 with aac, just fix the title and filename

time ffmpeg -y -i input.avi -target ntsc-dvd \

-acodec aac -vcodec mpeg4 -f mp4 -title "$TITLE" $FILE.mp4

corrupt bytes and cropping

If you get video corruption at the beginning of a DVD rip use "-bs 4" this tells it to skip 4 bytes.

mencoder dvd://1 -oac copy -ovc copy -o input.avi -bs 4

If you want to crop the video ( some stuff has letterbox style black bars that can be removed ). Cropping can screw up the aspect ratio for playback on some players ( the PS3 has problems with most standard movie croppings ).

mplayer dvd://1 -vf cropdetect -ss 50

This will output the -vf command to do the cropping for you, just add it to the mencoder command when you rip, or mplayer when you play. When using mencoder with "-oac copy" the cropping will not work, since it is a direct copy of the video stream.