Simple, high-quality DVD ripping on Linux (Ubuntu 9.10)
Workflow: Rip DVD to HDD using libdvdcss2 & vobcopy, encode rip to compressed video file using handbrake and x264.
Handbrake can rip DVDs by itself, but only by reading from the DVD drive directly, which has several disadvantages (slower, cannot enqueue more encodes than dvd drives, dvd drive is in use for entire rip & encode).
I am assuming that you want the original AC3 audio. See the handbrake guide for other options.
DVD ripping on linux is now very simple all you need for high-quality rips are four tools:
- libdvdcss2 – library to decrypt commercial dvds.
- vobcopy – decrypt (using libdvdcss2) and dump the dvd to disc.
- handbrake – control all aspects of encoding.
- x264 – video encoder.
Part 0: Get the tools
Use the most recent version of x264 you can for best results, since improvements are regularly being made. I used rvm’s Personal PPA repository (author of the excellent SMplayer), at the time of writing since the ubuntu repositories had a very old version of x264. If you can find a more recent version in a trustworthy PPA or don’t mind compiling x264, use that.
Install libdvdcss2 if you haven’t already. Install handbrake from the handbrake PPA. vobcopy is in the ubuntu universe repository.
Part 1: Rip
#go to directory you are storing DVD rips cd ~/Videos # copy DVD to HDD (make sure DVD is mounted or vobcopy won't find it) vobcopy -m
Part 1 can be done multiple times to rip multiple DVDs to your HDD if you want to set up several to encode overnight or something.
Part 2: Encode
Open your rip in handbrake (enable ‘Open VIDEO_TS folder’ option in the ‘Open’ dialog).
Select encoding options. I usually load the ‘High Profile’ preset, then check the tabs:
Video
- Set the quality you want, I use the default 61%. 60-70% is generally “transparent” for most people with a DVD source video (source), but do some tests to see what you like!
Audio
- Remove all audio tracks but the AC3 (pass-thru) track.
Subtitles
- Add if you want.
H.264
- Leave settings alone; these have been set by the ‘High Profile’ preset to the ‘best’ defaults. You can select other Presets to see the different settings in this tab, but this also resets the options in the other tabs to default – you have to go back and change them again.
Chapters
- Default is to have chapters, deselect if you don’t want.
Add to queue if you want to set up another encode, or just ‘Start encoding’. handbrake (ghb) is multithreaded and should max out all cores when encoding.
edited 15/3: use vobcopy instead of dvdbackup & dvdauthor. Also use constant quality over fixed size.
Lectopia rtsp stream capture II
A new semester, and some more hacking on the ‘dumpstream’ script. Now it is a little smarter because it can read the playlist file given by lectopia, and extract the rtsp stream URL from it:
#!/usr/bin/env bash
# Snip the URL from the playlist file
URL=`wget -q -O - $1 | grep rtsp | sed 's/.*src="\(.*\)".*/\1/'`
# Store the DATE from the file
DATE=`echo $URL | sed 's/.*iLectures.\{10\}\(.\{10\}\).*/\1/'`
# re-encode the file data, using the DATE as the name
`mencoder $URL -oac mp3lame -lameopts cbr:br=56 -ovc x264 -x264encopts bitrate=100 -rtsp-stream-over-tcp -o $DATE.avi`