Aeonflux's Guide to DVD ripping under FreeBSD

This guide is obsolete! For a more up-to-date DVD ripping guide, please see Linux/*nix Video -> H.264 with Mencoder HOWTO which is also applicable to FreeBSD.

Ripping DVD's under FreeBSD is actually quite easy. You can make top quality divx rips from DVD's in a few hours with the following ports. First you need to install sysutils/vobcopy, you can install it using

	portinstall sysutils/vobcopy

or by installing the package

	pkg_add -r vobcopy

or by changing into the directory and installing it from the port.

	cd /usr/ports/sysutils/vobcopy && make && make install

Now that you have the vob ripper installed, you need to give a user permission to access the dvd rom device itself. Unless you want to run vobcopy as root, you'll need to chmod the correct device. To find the correct device issue the following command.

	dmesg | grep -i dvd

Hopefully you'll see your dvd device. If not you may want to check your hardware installation. Next give everyone permission to the device. Since this a read only media, you really don't have to worry about possible security problems.

	chmod 666 /dev/acd0*

In my case, since my dvd device is acd0. Now that you've done that, login as a non privileged user and issue the following command.


You'll have to wait a while, as it pulls the vob files off the dvd and decrypts them. Next you'll have a large collection of .vob files in your home directory. Congrats, you can now put away the dvd, (return it to blockbuster) cause you wont be needing it for the rest of the exercise.

Now comes the fun part, encoding the raw vob files into something a little more compressed. Now if you were merely making a dvd copy, you could burn the existing vob files onto a dvd-r of your own. Since most people don't have a dvd burner yet, we'll assume you want to encode them into DiVX.

The tool I use to do this is called mplayer, and it's available from graphics/mplayer, as before you can install the package using

	pkg_add -r mplayer

However, it is to your advantage to compile it from source, using either portinstall, or by changing into the directory and issuing make install. Since you obviously have a DVD player, you'll want to compile mplayer with dvd support. I always add the following lines to my /etc/make.conf


Once you have mplayer installed, you can begin to compress the raw .vob files into divx's. The command you need to issue to mencoder is rather complex, but here is what I use.

	cat *.vob | mencoder -o mymovie.avi \ 
	-oac mp3lame -lameopts br=192:vbr=2 \
	-ovc lavc -lavcopts vcodec=mpeg4:vhq:keyint=250 -vop pp lb -

If you want to learn more about the specific mencoder flags, you should consult the mencoder man file. For example, if you want to encode in divx 3 instead, you can use vcodec=msmpeg4. Use this if you want to be able to play the video back on older players. Finally try playing back the movie using mplayer, after it's done encoding. You may also, want to try using other video players, such as xine. In order, to test whether or not playback works properly in other players.

What if "I dont have 5.0 gigs of free harddrive space!" you ask. Dont worry all is not lost, you can completely forget about vobcopy and use mplayer to rip and encode directly from the dvd. To do this though, you need to make sure mplayer is compiled with "WITH_DVD=YES", otherwise mplayer wont know how to talk to the dvd player. This farther knocks down the time it takes to rip and encode since no temporary files are created on the harddrive. The only down side of this is you are still limited by the speed of your dvd drive, and you wont have the original mpeg2 files laying around for high quality playback. However, for most people with limited drive space keeping the original mpeg2 files around is impractical anyways.

	mencoder -dvd 1 -oac mp3lame -lameopts br=192:vbr=2 \
        -ovc lavc -lavcopts vcodec=msmpeg4:vhq:keyint=250 \
        -o output.avi -vop pp lb

Will rip whatever is in track 1 and encode it as a divx 3 file. Using this you can rip a 2 hour long movie in about an hour and 10 minutes without using any temporary space and end up with a high quality divx 3 file. You may want to play back the dvd using mplayer -dvd [1-12], to ensure you are getting the correct tracks, before doing any actual ripping.

Questions? Write me at