I wanted to rip DVDs on my
DebianGnuLinux? workstation and it was enough of a hassle that I thought I'd document it for posterity.
A quick note
My goal is to make backup copies of my kids' DVDs. We've gone through several copies of some of them because little hands aren't very good at handling easily-scratchable surfaces. If you like a movie, buy it - don't just copy it from a rental DVD.
Installing the DVD ROM
I bought a cheap DVD ROM from a local office supply store solely for this project. Physical installation was a snap, but it was an IDE device, and as with IDE CD-Rs, the powers that be suggest that you configure it in software as an
IdeScsi? device.
IdeScsi? setup
Question: What's the syntax for multiple
IdeScsi? devices on one system?
Answer: You make a file in /etc/modutils like this:
$ cat /etc/modutils/idescsi
# First, get the ide-cd drive to not latch onto /dev/hdd
options ide-cd ignore='hde hdf'
#
#
# Set up an alias for /dev/scd0 to load sr_mod
alias scd1 sr_mod
alias scd2 sr_mod
#
#
# Now get ide-cd followed by ide-scsi loaded before the SCSI drivers
pre-install sg modprobe ide-scsi
pre-install sr_mod modprobe ide-scsi
pre-install ide-scsi modprobe ide-cd
Pretty easy, eh? The main deviation from a normal
IdeScsi? entry is that the
ignore option is quoted and the values are space-separated, and there are two
alias entries.
DevFs? setup
I use
DevFs? on my setup. If you do, then create a file like this:
$ cat /etc/devfs/conf.d/opticaldrives
REGISTER ^sr0 CFUNCTION GLOBAL symlink $devname cdrom
UNREGISTER ^sr0 CFUNCTION GLOBAL unlink cdrom
REGISTER ^sr1 CFUNCTION GLOBAL symlink $devname dvd
UNREGISTER ^sr1 CFUNCTION GLOBAL unlink dvd
Now, my
/dev/cdrom and
/dev/dvd symlinks are created at boot (or when I restart devfsd by typing
/etc/init.d/devfsd restart).
Ripping the DVD
Use
mencoder from the Mplayer system.
Making a high-quality copy
I use this command line (adjusted appropriately):
mencoder dvd://1 -ofps 23.97 -o /var/tmp/rippedmovie.avi -ovc lavc
-lavcopts vcodec=mpeg4:vhq:vbitrate=1800:aspect=1.78 -oac copy
The
-ofps 23.97 option sets the output framerate; mencoder skips a lot of frames if this value is wrong. Another likely value is
-ofps 29.97.
My movie had a wide aspect ratio, hence the
aspect option.
Making a VCD
This is a hassle. There are a set of constraints that don't have obvious workarounds:
- All vcd mastering tools that I know of only accept MPEG files as input.
- mencoder currently can't make MPEG files correctly.
- ffmpeg makes MPEG files correctly but can't rip CSS-encrypted DVDs.
- ffmpeg can't decode the AC3 audio streams found on many DVDs.
- mencoder can copy a DVD's video stream while encoding the audio as an ffmpeg-friendly MP3, but can't maintain audio/video sync while doing it.
The solution:
- Use mencoder to rip the DVD and transcode it to mpeg4 video and mp3 audio.
- Use ffmpeg to convert the resulting AVI into an MPEG file.
This is Not Good because:
- It takes a lot longer than a single-pass conversion.
- Every time you change formats, you lose information. The resulting MPEG isn't as good as a single-pass conversion.
Still, I don't have any better ideas, so here's how you do it.
First, transcode the DVD. The command is almost identical to the high-quality command above, except that we're using
mp3lame instead of
copy for the output audio codec.
mencoder dvd://1 -ofps 23.97 -o /var/tmp/rippedmovie.avi -ovc lavc
-lavcopts vcodec=mpeg4:vhq:vbitrate=1800:aspect=1.78 -oac mp3lame
Next, transcode the resulting AVI:
ffmpeg -i rippedmovie.avi -aspect 1.78 -f mpeg rippedmovie.mpeg
Finally, feed the MPEG file into a suitable VCD authoring tool; I'm currently experimenting with k3b.
If anyone knows of an easier way to do this,
please let me know.
--
KirkStrauser - 14 Oct 2003