How to play any DVD on Ubuntu

I recently found myself in a situation where I couldn’t read a DVD I’d just bought in the USA because of the protections and region-lock on the disc. This got me pretty upset since every device on the chain and every piece of software involved were legal (my machine is a factory Sony Vaio Z running Ubuntu 11.04). So here is the summary of the additional software (legal as well) I had to install to get things working.

Installing

First, we need to install libdvdcss2:

$ sudo apt-get install libdvdread4
$ sudo /usr/share/doc/libdvdread4/install-css.sh

My DVD player was set on the wrong region so I had to use regionset too:

$ sudo apt-get install regionset
$ sudo regionset

Beware to answer every question manually: the default behavior if you just press return is to exit without making any change. In my case, I set the region code to 1 (US). The next step is Medibuntu:

$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
$ sudo apt-get --yes install app-install-data-medibuntu apport-hooks-medibuntu

Now you should reboot your machine (you may get yet-another strange decoding error otherwise).

Playing

Here is an excerpt from the README of libdvdcss2:

The behaviour of the library can be affected by changing two environment variables: DVDCSS_METHOD={title|disc|key}: method for key decryption

title: decrypted title key is guessed from the encrypted sectors of the stream. Thus it should work with a file as well as the DVD device. But it sometimes takes much time to decrypt a title key and may even fail. With this method, the key is only checked at the beginning of each title, so it won’t work if the key changes in the middle of a title.

disc: the disc key is first cracked ; then all title keys can be decrypted instantly, which allows us to check them often,

key: the same as “disc” if you don’t have a file with player keys at compilation time. If you do, the decryption of the disc key will be faster with this method. It is the one that was used by libcss. This is the default method.

So the default method is key, but on a sample of 3-4 DVDs it worked only once for me. I had better results using the title method:

$ export DVDCSS_METHOD=title

Last advice: sometimes decoding may not work if you go through the main menu, but you can skip this step with VLC and go directly to chapter 1 of your movie, e.g.

$ vlc dvd://@1

Conclusion

My bet is that the people who developed the “protection” software of DVDs spent time so that we could in turn lose time making things work… Many thanks to the hierarchy of human workers and “deciders” which made all of this possible.

Most of the help I found online came from two articles in the Ubuntu Documentation: Restricted Formats / Playing DVDs and Medibuntu. Maybe some of the instructions I provide here are redundant or unnecessary: this is exactly what I’ve done on my system to get things working, I just hope it may help others after me.

Discussion

Feel free to post a comment by e-mail using the form below. Your e-mail address will not be disclosed.

📝 You can use Markdown with $\LaTeX$ formulas in your comment.

By clicking the button below, you agree to the publication of your comment on this page.

Opens your e-mail client.