Viewing DVDs on Linux

20th November 2002

A Bit About DVDs

As you may or may not know, when the manufacturers of the newest audio-visual medium, videos on DVD disks, decided to build their players, they got together with the movie moguls and talked some talk. They remembered what had happened to the late lamented Video Disks when they came out (you remember those things, about the size of a Long Play record? Well you might not remember LPs either, depending on how old you are...) The problem with Video Disks was that nobody bought players, because there was very little to play on them, and there was very little to play on them because nobody bought players.

So, this time around, the player manufacturers made a deal with the movie companies. "You release all your movies ASAP," they said, "and we'll put in a device which jiggers the players so that not everybody can play them, so you get to stagger the release of the DVDs so that they don't get released in a country until after they've seen the movie in the theatres." This, my friends, is region-coding. There are six regions. USA is #1 (of course, wouldn't do for it not to be, they'd be terribly upset), the UK and Europe is #2, and for some completely unfathomable reason, Australia is lumped together with South America in Region 4. The idea is that the player is coded for a particular region, and the disk is coded for a particular region, and if they don't match, then the disk won't play. Well, strictly speaking, what happens is that the video data on the disk won't get decrypted, and thus the movie won't play.

Don't believe their lies when they say that region-coding is enshrined in copyright law -- it is nothing of the sort. It is a collusion between companies in order to exert control that is not rightfully theirs. Indeed, there is some consideration as to whether, for example, in Australia, region coding is illegal because it violates the Australian Trade Practices Act. (That hasn't been decided yet, though.) (Region coding is particularly unfair for Australians because, though we are part of the English-speaking world, the only places where all the English-speaking DVDs are released to are the USA and/or the UK.) Unfortunately, because encryption is involved, and there is an evil, unconstitutional law at present in the USA (the Digital Millennium Copyright Act, which makes it illegal to make (software) tools for breaking encryption or even to discuss how encryption may be broken -- so much for the land of the free!) then there is a problem with DVD software.

Now, there is no problem for DVD software on M$ Windows, because all the companies who wrote commercial DVD software signed agreements etc and got given the decryption keys to use in their software. Unfortunately for Linux users, the moguls were never going to give such keys to the open source community, because they would no longer be secret. Which, for a Linux user who wanted to play DVDs, was about as helpful as candy for a diabetic.

Fortunately, some intrepid people did manage to write software for Linux, which is not only able to play encrypted DVDs, but able to play encrypted DVDs from any region. (Aside: There are some DVDs out there which are neither region coded nor encrypted -- some companies do not feel the need to stomp on their customers.) Most of the programs use the same or a similar library, "libdvdcss" to decrypt the DVDs in order to play them. I personally recommend vlc (VideoLan Client) and ogle . There is also OMS (which I was never able to get to work) and Xine (which I have only recently discovered).

The Videolan folks wrote libdvdcss (and since they are a bunch of students in Paris, they aren't likely to be arrested by USian police, well, not unless they visit the USA, like Dimitry Sklyarov did...). The Ogle folks have a patched version of the same library, which was altered to enhance its performance with Ogle. The Xine player does not play encrypted DVDs, but there are plugins for Xine which do. One of them is dvdnav which uses the Ogle library.

Since I have only used RedHat and Debian distributions of Linux since I had a DVD drive on my computer, I can only talk of my experiences with them.

DVDs on RedHat

With RedHat 7.x the software in question does not come with the distribution. You have to download and install it yourself. Fortunately both Ogle and the VideoLan folks do produce binary RPM files which you can download and install.

Sometimes I have found that the binary files don't work on my system, because they were compiled expecting different libraries or defaults. When that happens, I've found that the best thing to do is

  • download and install the binary RPM of the library
  • download the source RPM of the program, and run

rpm --rebuild packagename

  • then install the binary RPM file which results.

I didn't know about Xine when I used RedHat, so I don't know what problems there may or may not be with that.

DVDs on Debian

The good news and bad news with DVD software on Debian is that since Debian has almost every package under the sun, there actually are official Debian packages for vlc, ogle and xine. Unfortunately, because of the uncertain legal status of libdvdcss, all these packages were compiled without that library present.

No matter, I thought, I'll just download the library, and since it's a shared library, things will just fit in. Unfortunately, not. Both vlc and ogle crashed repeatedly when I used them. Fortunately, vlc actually has binary .deb packages on its site, which of course had been compiled with the library and thus worked fine. Unfortunately, the package version numbers of these packages were all dash-1, but the current versions of the everything-but-libdvdcss-packages for vlc on the current (woody) Debian distribution were up to dash-8 -- which meant that every time I ran apt-get, the lovely helpful software wanted to overwrite my vlc packages. Now, yes, using something like aptitude, one can put packages on hold, but apt-get didn't know about that, and I wanted to be able to use both apt-get and aptitude for doing updates.

So I decided that I would do it properly. Download the libdvdcss libraries and install them, and download the source packages and compile them. That way, the programs would be compiled with the library present, and hopefully work.

And it did.

Here's the steps I took:

  1. Install the latest versions of libdvdcss from the ogle page and the videolan page. Fortunately (at this point) they don't conflict with each other because they have different version numbers in the shared library filename -- which is one reason why you need both versions if you want both programs, because each one is looking for a particular version. Also, it is a good idea to get the ogle version of the library for ogle, because otherwise you may sit around far too long waiting for ogle to decode the video files on the DVD.
  1. Change directories to a suitable source directory (that is, a directory where you don't mind source directories being created). This is because "apt-get source" copies the source files to the current directory and unpacks them there.
  1. For the following packages, run
    apt-get --compile source packagename
    in the current directory. You will probably find that you have to do it a couple of times, if you don't happen to have all the dependencies, such as the development versions of the libraries which the programs use. That's okay, just apt-get the things which are missing, and run the command again. It's clever enough not to download the files twice. The result of the compile will be binary .deb packages which you can install. You need to do this in order, since later packages depend on earlier ones.

For ogle and xine:

  • libdvdread2

For ogle:

  • ogle (if your computer is a recent i86 computer, install the resultant ogle-mmx package rather than the ogle package, for it will run faster).
  • ogle-gui

For vlc:

  • vlc (this generates many .deb packages, and you won't need to install them all; vlc is the core package, and the others are plugins and different versions of the gui.)

For xine:

  • libxine0
  • xine-dvdnav
  • xine-ui

A Comparison of vlc, ogle and xine

This is just a quick overview. I have managed to play both region 4 and region 2 DVDs with all three programs. And all three have crashed on me from time to time, if I've tried to do something a bit more complicated than usual. All three have the usual play, stop, pause, fast-motion and slow-motion buttons, and are able to go into full-screen mode. If you are going to be playing in full-screen mode, remember to turn off your screen-saver first, or you will miss bits of the movie (and possibly have problems trying to rewind to the bit you missed). They also expect the DVD player to be at /dev/dvd, so it's a good idea to make that a soft link to the real device.

I am just comparing these at their ability to play DVD videos, so while some are able to play other formats as well, I won't be commenting on that.

vlc 0.2.92

I have a fondness for this program, because it's worked for me when others haven't. It also has some different features. This does not use the DVD's own title menu, but has its own, the "View" menu, where you can go to any title, and the chapters within that title, or use the "Prev" and "Next" buttons to skip through. This can sometimes make playing a DVD rather adventurous, since you don't know which "title" (they are only numbered) is which; sometimes the "special features" of the DVD come before the main feature. You can select languages and subtitles with another menu. My favourite feature, however, is the slidebar which enables one to skip to any particular spot in the current title.

Unfortunately it is still buggy, and tends to freeze or crash when you do things like pause it too long. It also has a tendency not to exit cleanly, having to be killed with the "kill" command when things go wrong. Another peculiarity is that if the DVD is paused for too long, then when it's un-paused, it is jerky, and the sound is speeded up (due to the fact that the disk has spun down and has to be spun up again.) Actually, that's improved, it used to go ga-ga when it was paused.

ogle 0.8.2

The ogle player had a breakthrough in that it was able to use the DVD video's own menu -- though some may consider that a disadvantage, as one always has to sit through the copyright notice and the "station identification" bit before one can actually play the DVD. Still, it means you get to see things the way they were designed to be seen, including some of the extra fun animation bits... This has skip to various selection menus (including angle-select, though I don't think I've owned a DVD where they had more than one angle anyway).

Since ogle depends on the library written by the videolan folks it may lag behind a bit, and there have been DVDs which I could play with vlc which I could not play with ogle (for example, Pride and Prejudice, just now!). This program also does not have the slider which enables one to skip to particular point, though it does have a "fast-forward" button.

xine 0.9.8 with dvdnav 0.9.8.beta

This has the coolest user interface of the three, resembling an actual video player, rather than the usual rectangular grid of buttons, though they are rather small, some buttons are quite tiny. But they do have tooltips on them, so that helps. Since this uses the same dvd-reading libraries as ogle, it also has the DVD video's own menu system. Strangely enough, though, I was able to play Pride and Prejudice with it, even though ogle got stuck on the menu screen.

While this does have a sort of slider indicating the current position, one cannot use it to go to a particular spot in the movie, alas. One nice feature is a volume control! It also has a mute button. And an eject button, though it didn't work for me. Another interesting feature is that one can hide or show the control panel -- even when in full-screen mode. For the other two, being in full-screen mode means you lose access to the control panel. I guess this is an example of standing on the shoulders of giants, or maybe the example of why things with separate plug-ins are good; the user-interface people concentrate on the UI, and the plugin people concentrate on the plugin.