Scripting

Backup Copy Protected Dvds

How to rip your DVDs? for backups

Now I have a little one, I have lots of DVDs? that I would like to backup so that I can play them directly from the myth box without having to swap them out of the player. This not only saves clambering over the mountain of kids toys surrounding the TV stand but also means the originals are not destroyed by little hands.

(I find it ironic that the disks that are most likely to suffer irrepairable damage and hence benefit from backups taken are those that are hardest to copy.. Disney!)

Most of the info was from this page: http://www.cmdln.org/2010/01/22/backing-up-disney-dvds/ . However his steps are in order to get a full copy onto another DVD which I'm less bothered about. Most of the time I just need the main title.

Ripping entire DVD, removing copy protection and encryption

$  ddres­cue –n –b 2048 /dev/dvd output.iso
$  dvd­backup –M –i output.iso –o dvd_structure
$  mkisofs –dvd-video –o clean_dvd.iso dvd_structure/<title>

NOTE: this does also not reduce the size of the output file so could be quite big.

Ripping single title and transcoding

if no copy protection present

The easy way is to copy the code below to a script file, make it executable (chmod +x) then run it:

#!/bin/bash

mount /dev/sr0

TITLE=`lsdvd -x /dev/sr0 |grep "Disc Title" |awk '{print $3}'`
echo "ripping dvd with title $TITLE"
echo 
HandBrakeCLI --preset=Normal --main-feature -i /media/cdrom/VIDEO_TS -o "$TITLE.mp4"

You may need to tweak the path to the dvd/cd

This will often appear to work, but you will in fact end up with a shortened movie if copy protection was used. You can tell this most easily in a media player by looking at track info or by pausing it and seeing how long it is. If that is the case, use the next method.

if copy protection IS present

$ ddres­cue –n –b 2048 /dev/dvd output.iso
$ HandBrakeCLI --preset=Normal --main-feature -i output.iso -o "title.mp4"

if handbrake segfaults when trying to detect the main title

$ ddres­cue –n –b 2048 /dev/dvd output.iso
$ vlc output.iso

or

$ vlc dvd://

Then play the main movie and pause it. Navigate to 'Playback > Title' and you will see a tick next to the title that is playing.

then:

HandBrakeCLI --preset=Normal --title=<INSERT TITLE HERE> -i output.iso -o "title.mp4"