UPDATE – unless you want to understand how this works, then you should check out k9copy instead.

UPDATE – Now works on Gutsy

I wrote a bash script to help you duplicate your DVDs. This may be illegal depending on where you live, but if you use your DVDs regularly you should have backups, to protect your investment. This script will backup the DVD to your hard disk, decrypt it, and create a directory structure that you can burn back to DVD-R. The following assumes that you are using Ubuntu, but I’ve run the script on both Libranet and Mandrake with only minor modifications (see comments within the script for hints.)

  • Add universe and multiverse repositories to /etc/apt/sources.list (if you need help doing that, drop me a line via the comments below).
  • Paste this in a terminal to install the script’s dependencies (various media processing libraries) and to download the script itself:

    sudo su -c 'echo deb http://packages.medibuntu.org/ gutsy free non-free >> /etc/apt/sources.list'
    sudo su -c 'echo deb deb-src http://packages.medibuntu.org/ gutsy free non-free >> /etc/apt/sources.list'
    sudo apt-get update
    sudo apt-get install libdvdcss2 libdvdread3-dev mkisofs dvdbackup dvdauthor transcode lsdvd
    wget http://www.flavor8.com/dvd/streamanalyze_0.4-9_i386.deb
    wget http://www.flavor8.com/dvd/streamdvd_0.4-9_i386.deb
    sudo dpkg -i streamdvd_0.4-9_i386.deb
    sudo dpkg -i streamanalyze_0.4-9_i386.deb
    wget http://www.flavor8.com/dvd/DVD-Duplicator.gz
    gunzip DVD-Duplicator.gz
    chmod +x DVD-Duplicator
    echo "Installation done"
    echo
  • Now, some final configuration is needed; first, you need to work out the file system and mount points of your dvd drive, if you don’t know them already.
    • To do this, type: cat /etc/fstab; you should see a table which includes something like the following:

      /dev/hda        /media/cdrom0   ...
      /dev/hdb        /media/cdrom1   ...
      /dev/hdc        /media/cdrom2   ...
    • Put a DVD into the dvd drive that you want the script to use
    • It should automount; in gnome or kde you’ll see a prompt asking you what you want to do. Hit cancel, or ignore.
    • To work out which is the drive in question, I did the following:
      > ls /media/cdrom0
      > ls /media/cdrom1
      > ls /media/cdrom2
      AUDIO_TS  JACKET_P  VIDEO_TS

      So, in my case, /media/cdrom2 is the drive, and (from the drive table that I got above) I can see that this refers to /dev/hdc filesystem.

  • Use your favorite text editor (vi, gedit, kate, whatever) and edit DVD-Duplicator; you’ll need to change DVDDEV and DVDDRIVE to whatever values you just discovered are appropriate for your system. Save.
  • Now you’re ready to make some backups!

To use it, on the command line, type: ./DVD-Duplicator folder-name, where folder-name is the name of the directory that you want the dvd to be backed up to. The directory will be created if it doesn’t exist already. Example, you might type ./DVD-Duplicator thematrix. Once the script finishes, you can now use k3b (or your favorite dvd/cd burning program) to burn the dvd from the AUDIO_TS and VIDEO_TS directories that were created under the directory you specified. (Hint: the script can also generate an iso file for you to burn, if you have the hard disk space to spare; that way, you don’t have to worry about copying the files from AUDIO_TS and VIDEO_TS. To use the script in this way, you might type: ./DVD-Duplicator thematrix thematrix-iso.)

If you have questions on getting it working, suggestions for improvement, etc, please post a comment here.



Related Comments (59)