DVD ripping application

Mark mhullrich at gmail.com
Fri Nov 26 07:31:38 UTC 2010


On Thu, Nov 25, 2010 at 10:28 PM, Mark Widdicombe
<mwiddicombe at shoprite.co.za> wrote:
> Good day all,
>
> I am having a frustrating time trying to back up my DVD collection.  Some of my DVDs
> are not in pristine condition having been left out of their covers, chewed by the dog and so
> on.  They still play, but I can't find ripping software of sufficient robustness to rip them.  I've
> tried Acidrip which is easy to use but does the dying swan at the slightest scratch on
> the DVD; DVD::RIP which is more robust, but for some reason the sound is not in synch
> on the ripped AVI; and K3B which seems to do nothing at all when the 'Rip Video DVD' menu
> item is selected.
>
> I would be happy to hear any of your suggestions.
>
I haven't tested this on ubuntu yet, but it was working fine under
CentOS and doesn't care what the OS is as long as you have mplayer and
mencoder installed.  This should work - tweak to suit your
sensibilities.  It will play the video once to detect the actual frame
size, allow you to change it and then plays it again for your approval
(you don't have to watch the whole thing for this).  My only annoyance
is that it takes a long time to perform, but the results are usually
pretty good, better than I got with DVD::rip.

(Note: if any of the lines below wraps, just sew them back together in
your editor - it's not too hard to tell if this happens.)

#!/bin/bash

# Written by Mark Richter.  Use and distribution is authorized under the GPL
# provided that this attribution is left intact and at the head of the script.
# This script is provided with no warranties whatsoever, including the
# Magnuson-Moss imlied warranties of merchantability and/or fitness.
# Your mileage may vary.

# designed to rip a dvd or dvd-fileset and turn it into a
# reasonably small avi
# most of the settings below are presets, but the crop must
# be detected, if any, and the bitrate may be specified as
# other than 1600kbps (the default).

usage()
{
	echo "Usage: $me [-s <srcdev>] [-b <bitrate>] [-a <audio-codec>]
<title#> <destfile>"
	exit 0
}

me=`basename $0`
t0="`date`"

bps=1600
crop=""
src=/dev/hda
oac=copy
MPLAYER=/usr/bin/mplayer
MENCODER=/usr/bin/mencoder

if [[ ! -x $MPLAYER || ! -x $MENCODER ]]; then
	echo "You do not appear to have both mplayer and mencoder installed."
	exit 1
fi

while true; do
	case $1 in
		-s)	src=$2; shift; shift;;
		-b) bps=$2; shift; shift;;
		-a) oac=$2; shift; shift;;
		-*) usage;;
		*)  break;;
	esac
done

ttl=$1
dst=$2

if [[ -z "$dst" ]]; then
	usage
fi

echo "Running mplayer for crop detection - stop play when ready to continue."
echo "mplayer dvd://$ttl -dvd-device $src -alang en -vf cropdetect"
$MPLAYER dvd://$ttl -dvd-device $src -alang en -vf cropdetect

echo -n "Enter the entire pattern from 'crop=xxx:yyy:xo:yo': "
read crop

if [[ -n "$crop" ]]; then
	echo "Running mplayer with the crop as specified."
	echo "mplayer dvd://$ttl -dvd-device $src -alang en -vf $crop"
	$MPLAYER dvd://$ttl -dvd-device $src -alang en -vf $crop

	echo "If this is good, type <enter> to continue, or ^C to stop."
	read cr
	crop="$crop,"
else
	echo "No cropping will be done."
fi

echo "Encoding title $ttl from $src to $dst using $bps bps and cropping $crop."
$MENCODER dvd://$ttl -dvd-device $src -alang en -ofps 24000/1001 -oac
$oac -o /dev/null -ovc lavc \
    -lavcopts vcodec=mpeg4:vbitrate=$bps:v4mv:mbd=2:trell:cmp=3:subcmp=3:autoaspect:vpass=1
\
	    -vf pullup,softskip,${crop}hqdn3d=2:1:2 && \
$MENCODER dvd://$ttl -dvd-device $src -alang en -ofps 24000/1001 -oac
$oac -o $dst -ovc lavc \
    -lavcopts vcodec=mpeg4:vbitrate=$bps:v4mv:mbd=2:trell:cmp=3:subcmp=3:autoaspect:vpass=2
\
	    -vf pullup,softskip,${crop}hqdn3d=2:1:2

echo "Start: $t0"
echo "Done : `date`"




More information about the ubuntu-users mailing list