Using Handbrake and Mplayer to transcode DVDs

Here are some notes with tips on extracting video files from DVDs on Linux. This information is for a system running Fedora 18. It will likely apply to other Fedora releases as well as other Linux distributions. The notes will assume that you have handbrake and mplayer already loaded on your system along with support programs and libraries such as libdvdcss. I will create some documentation on how I installed that software before too long and link to that.

I find that handbrake is the easiest way to extract a video from a DVD and that it works about 90% of the time. When handbrake fails I fall back to using mplayer to extract the file and then use handbrake to transcode the file extracted with mplayer. In these notes I give the information on what works most of the time and then follow up with some tips to solve the situations when things don't work.


I find that some DVD readers work better than others. I also find that computer drives are much less forgiving about DVD defects than are DVD players. If you have a DVD that is slightly warped our out of balance a computer drive may encounter problems. I believe that one reason for this is that a computer drive is spinning much faster than a standard DVD player because it is trying to read data much faster than would be done for normal playback due to trying to transcode faster than real time.

The best DVD reader I have found (in an admittedly small sample size) is an LG Slim Portable DVD Writer Model AP70NS50. This is a USB external drive and was about $60 when I purchased it from Best Buy. You must have a dual layer DVD reader. I find that this LG reader is somewhat better than the drive that was built into my laptop. It may be that it is more forgiving of errors in a DVD, I do not know the reason. I tried a very inexpensive LG USB drive and had very poor results. If you run into problems with some disks check the surface for defects. I have found a few disks in which surface defects made transcoding impossible.

Using Handbrake

I use the Plex Media Server to play videos. I use the file naming convention recommended by the Plex software. This format has a directory with a movie name followed by the release date in parenthesis and then in that directory a file with the movie name followed by the release year in parenthesis. For example:

/movies/The Game (1997)/The Game (1997).m4v

In that example I am using an "m4v" container for the video. The file extension could have also been ".mpg". The Plex software site has a lot of good information devoted to file naming. If you plan to use Plex for video playback it is very important to get the naming correct so that Plex can index all your videos.

Launch handbrake and place your DVD in the drive. Tell handbrake about your source DVD drive. My internal drive is /dev/sr0 and my external USB drive is /dev/sr1. Click on the "Source" icon in the header:


This will bring up a standard file explorer window and you should be able to see your file system and devices. Choose the appropriate DVD device.

When the DVD has been selected and you click "OK" handbrake will scan the DVD looking for the longest title. This is typically the video you want. The scan will take a minute or so. If it progresses fairly quickly the transcoding will most likely work well. If the scan requires 5 minutes then the transcoding is likely to fail.

The screen should now have some information such as this:


The title drop down will have selected the longest title on the disk. This is probably what you want but in some cases you may have to change this. You should use a source such as to look up the DVD information and determine the "official" title, release date, and running time. Verify that the running time is really close to what handbrake shows.

The "File:" and "Title:" fields will be filled in with information from the DVD. You will want to edit those to match the correct movie title. Note that the "File:" box will define the file name used. The "Title:" and "Release Date:" boxes will place information in tag fields of the video. This can be useful when the Plex software is indexing movies and I recommend setting this. Note that I am using the ".m4v" format. This defines a "container" used to hold media.

Now select the "Audio" tab and choose the desired audio format.


For most modern movies I find that "AC3 Passthru" is a good choice. This seems to work well to preserve the surround sound and plays back well through my 5.1 amplifier. After selecting this you can create a "preset" for this audio format and make it easy to select this in the future. To do this click on the small "file cabinet" with the green down arrow:


That will bring up a window in which you can name a preset. I have used "AC3 Passthrough" like so:


When handbrake starts you can just click this preset and the audio format will be set. This avoids having to make the setting for every video that is transcoded.

If this is a foreign movie in which English is not the default language you can use the "Audio" tab to select the English language if needed. You can also set subtitles if needed.

Now click "Start" on the header and the video should be created. You can track progress on the status line that will appear on the bottom of the window. For details on the process you can click "Activity" and view transcoding details in a new window. This method works for about 90% of the DVDs that I wish to transcode. When Handbrake does not work I find that mplayer will typically extract the video file.

Checking Results

Handbrake is successful about 90% of the time. After transcoding a DVD I examine the output file with "ls -lh". I expect to see a file of 800 megabytes up to a 1 or 1.5 gigabytes. A small file of 50 megabytes means the transcode process failed.

After checking the file size I then open the file with vlc and to make sure the video is complete and the language is correct. I watch the opening title sequence, check a few places through the movie, and make sure that the closing credits are present. I also look at the movie length reported by vlc. I find that this verification step after transcoding is very important as not all videos will be correct.

Using Mplayer

When Handbrake has a problem you can use the mplayer software to extract a title and then use handbrake to transcode that title. The basic command is simple. For example to transcode title 1 you would use:
mplayer  -dumpstream  dvd://1  -dvd-device  /dev/sr1 -dumpfile  title1.mpg

That command will read title 1 (dvd://1) from the "sr1" device, and place the output of title 1 in a file named "title1.mpg". The file will be placed in the directory from which the command is run. You could specify a full output path for the file if desired. Note that the output file will be large. It could be 5 gigabytes or more in size so be sure there is sufficient file space for the resulting file.

While mplayer is running it will be displaying output showing how many bytes are written. Note that when it completes it will print a message saying that core has been dumped. This is a very poor "program finished" message. I do not know why the message appears but it is always output when mplayer finishes and does not seem to actually indicate a problem so don't be alarmed by this.

As the next step run Handbrake as described above and give it the .mpg file created with mplayer as the input file. It should transcode this file just as it would when reading from a DVD. Check the result and then delete the .mpg file.

This use of mplayer almost always works. I did find a case in which it failed to extract the full movie, repeatedly terminating before reaching the end. I found that I could get the full movie by changing the output to a .vob format. I do not know why, but this worked:

mplayer  -dumpstream  dvd://1  -dvd-device  /dev/sr1 -dumpfile  title1.vob

One of the tricks with this is figuring out what title you need to transcode. The first thing I try is to open the DVD with "movie player" the default application under Fedora. This will bring up the DVD menu. Select "play" and let the actual movie begin to play. The movie player software will display the title playing.

In some cases the default movie player application will report that the media format is incorrect. In this case try using vlc to play the DVD. As far as I know it will not show you which title is playing but it will show you the titles and video time by selecting "Playback -> Title".