Here's the script, as I said super simple, and pretty fast. There is a little set up, but that is spelled out below.
#!/bin/bash
# usage: ripdvd "name of movie"
# eg: ripdvd "Tucker and Dale vs Evil"
#
# requires lsdvd, mplayer, and ffmpeg
# output directory must already exist
VIDEOS=~/videos
cd $VIDEOS
# title to use for movie from command line
TITLE=$1
FILENAME="$TITLE.mpg"
# lsdvd lists video tracks and the longest track is listed last
LSDVD_OUTPUT="$(lsdvd)"
TRACK=`expr "$LSDVD_OUTPUT" : '.*\(..\)'`
#echo $LSDVD_OUTPUT
# print out some stuff
echo "**************************************************************"
echo "**************************************************************"
echo "Creating movie " $TITLE " from track " $TRACK
echo "Output to " "$VIDEOS/$TITLE.mkv"
echo "**************************************************************"
echo "**************************************************************"
echo "Ripping..."
echo "**************************************************************"
echo "**************************************************************"
# mplayer dumpstream outputs the given video track with all audio
# and subtitle channels
mplayer -dumpstream dvd://$TRACK -nocache -noidx -dumpfile "$FILENAME"
echo
echo "**************************************************************"
echo "**************************************************************"
echo "Transcoding..."
echo "**************************************************************"
echo "**************************************************************"
# read $TITLE.mpg, transcode all audio to vorbis, don't copy subtitle streams,
# transcode the video to H264, output to matroska container
# ultrafast takes 15-45 minutes depending on movie length.
# Output file will be about 1.5 GB.
# -sn prevents subtitle copying, which ffmpeg can't handle directly from the mpg
ffmpeg -i "$TITLE.mpg" -sn -map 0 -preset ultrafast "$TITLE.mkv"
# clean up, just delete the mpg file since it's no longer needed and can be
# quite large
rm "$TITLE.mpg"
echo "Done!"
exit
No comments:
Post a Comment