Friday, September 17, 2010

Ripping DVDs and Ubuntu

I've been mucking around now for a while trying to work out the best way to rip and encode DVDs.

I tried using Handbrake for a while to rip and encode, but what I really want is something that just does it in the background. On the mac, RipIt is a great tool for ripping the DVD to the HDD allowing you to go back at your leisure and encode it.

What i really want is a solution that will autorip on DVD tray-close (like RipIt on the mac) and then a cron that will encode. This is a post about how I get on.

First, we'll need to add restricted formats:
  • sudo apt-get install libdvdread4
  • sudo /usr/share/doc/libdvdread4/install-css.sh
Now, install dvdbackup
  • sudo apt-get install dvdbackup
Create a directory to put the ripped DVDs into and enter it and execute the command to rip the DVD:
  • mkdir Ripped
  • cd Ripped
  • dvdbackup -M
You can also use the -F option rather than -M to just get the main feature, but I had bother with using handbrakeCLI to encode after doing that. Also use the -v flag to give a bit more output.

And, to eject, just use the command
  • eject
So, now we need to work out how to do that automatically when a DVD is inserted into the machine. In the perfect world, we'd do that using the terminal only so that it could run flawlessly on a headless server.

Handbrake

We need to install handbrake from a PPA.
  • sudo add-apt-repository ppa:handbrake-ubuntu/ppa
  • sudo apt-get update && sudo apt-get install handbrake-cli
Then, it's a simple hop skip and a jump to a simple CLI command to encode the ripped disc using a preset for "Film"
  • HandBrakeCLI -i 21/ --main-feature -o 21.mp4 --preset="Film"
Amazingly, this encoded the film at, on average, 280fps (granted, I'm running a quad core AMD monster), but still! I'd tried this on the Mac, using the GUI version and was getting an encode with an average fps of about 9!

3 comments:

michael said...

the "Film" preset has been removed from the current (0.9.4) version, you get a default encoding, which, admittedly goes really fast, but looks mediocre.

Jeremy said...

Useful to know, thanks. Any better encoding options now that that preset is gone?

michael said...

Normal and "High Profile" are about the only generic settings now, there's an explanation of why they changed it on the handbrake.fr main page.