Playing DVDs on Linux/PPC

Last updated Wed Feb 21 16:42:45 EST 2001
Brighten Godfrey <godfreyb@bigw.org>

Introduction

After some effort, I have gotten DVD playback working on my Linux/PPC system. (As I write this, I'm watching Sneakers). I have a Power Mac G4 (AGP, 350 MHz) running LinuxPPC, but I expect it will work on any DVD-equipped Power Mac (or at least any DVD-equipped G4) with any PPC Linux distribution. Below is the procedure I followed. I've tried to describe it in enough detail, since I know that I really appreciate having a detailed list of steps to follow when I don't know how to do something on Unix.

Overall I'm happy that I got it to work at all. In practice, the playback quality is not good enough to save me from booting into Mac OS to play a DVD in most cases. However, there is definite hope that the quality will improve.

I'd also like to thank Guillarume Laures for his very helpful description of how he got DVDs working on his LinuxPPC box. Much of the material in this page duplicates his procedure, but I also include instructions to decode encrypted DVDs.

I hope this procedure is useful to you, but of course there is no guarantee that it will work for you, and I probably won't have time to help you debug your setup. For that, send a message to one of the mailing lists or newsgroups. However, I do of course welcome comments and suggestions!

Problems

Before you start, you may want to know the shortcomings of this setup. If you get anything working better than I did, please let me know how!

System requirements

Procedure

  1. Get a kernel with DVD support. To see if your kernel supports DVD drives, run this in a shell:
    dmesg | grep DVD
    If the output looks something like this, then your kernel supports DVDs:
    hdc: HITACHI DVD-ROM GD-3000, ATAPI CD/DVD-ROM drive
    hdc: ATAPI 32X DVD-ROM drive, 512kB Cache, DMA
    If the output looks something like this, then your kernel does not support DVDs:
    hdc: HITACHI DVD-ROM GD-3000, ATAPI CD-ROM drive
    The 2.4.x kernels should all recognize your DVD drive. I think that some of the older kernels, maybe 2.2.17 and above, have DVD support as well. I personally was running 2.2.15pre19 which doesn't have DVD support, and upgraded to 2.4.2pre3 which does have DVD support. I followed this entire procedure using a 2.4.2pre3 kernel.

    Here's how to recompile your kernel.

  2. Install libcss.
    1. Download from LiViD's web site: libcss-0.1.0.tar.gz (143 KB)
    2. Unpack the archive:
      gunzip libcss-0.1.0.tar.gz
      tar -xf libcss-0.1.0.tar
      cd libcss-0.1.0
    3. When I first compiled it, libcss didn't work for me (specifically, the program tstdvd didn't work). I had to make the following change: in the file src/tstdvd.c, line 57 is:
      #define FIBMAP 1
      replace this with:
      #define FIBMAP ((1 << 29) + 1)
    4. Configure libcss:
      ./configure
      Note: If you get compile errors, your kernel includes might not be in the right place. When I upgraded my kernel, I didn't install the new kernel headers (silly me). If you didn't do that either, or if your kernel headers are anywhere other than /usr/include/linux/, you will have to do this:
      ./configure --with-kernel-includes=PATH_TO_KERNEL_INCLUDES
      If you built your kernel in KERNEL_BUILD_DIR, then your PATH_TO_KERNEL_INCLUDES probably is KERNEL_BUILD_DIR/include.
    5. Build and install libcss:
      make
      su -c "make install"
      
  3. Install ac3dec, the audio decoder. I used binaries from Guillarume Laures. Note that although that file ends in .tgz, it's actually a tar archive:
    tar -xf linuxppc_dvd_bin-20-08-00.tgz
    cd linuxppc_dvd_bin-20-08-00
    su -c "cp ac3dec /usr/local/bin"
    
    You could also download the source and build your own ac3dec, but I believe the binary above is the latest version.
  4. Install DVDView. A dvdview binary is also included in the tar archive you downloaded to get the binary of ac3dec. All you need to do is install it:
    su -c "cp dvdview /usr/local/bin"
    
    However, that is not the latest version of DVDview. Instead of using the binary, I downloaded the source (dvdview1.1.0.tar.gz, 242 K) and installed it:
    gunzip dvdview1.1.0.tar.gz
    tar -xf dvdview1.1.0.tar
    cd ulib
    ./configure
    make
    cd ../dvdview
    ./configure
    cd src
    make
    su -c "cp dvdview /usr/local/bin"
    
  5. Play some DVDs! You now have all the necessary pieces installed to decode encrypted DVDs and play them with both video and audio. I wrote a little Perl script to execute all the necessary commands and play the DVD.
    1. Download it
    2. un-tarball it: gunzip dvdplay.tar.gz; tar -xf dvdplay.tar
    3. Make it executable: chmod +x dvdplay.pl
    4. Check over the parameters at the top of the script. Change anything that needs to be changed. In particular:
      • $CSS_CAT needs to be the path to css_cat, which is in the src directory in the directory where you compiled libcss.
      • $TMP_DIR has to be a directory with lots of free space -- probably about 1-2 GB. It needs to be able to store the largest DVD clip that you will play. (Each movie is split up into several clips.) The reason is the following: unfortunately, DVDView does not accept input from stdin, so this leaves us in a very suboptimal situation: we have to unencrypt the data and write it to disk with css_cat, at the same time that we are reading it and playing it with dvdview. The result is a big performance hit and the requirement for lots of free disk space.
    5. Put a DVD in your drive (don't mount it!)
    6. Run the script as root:
      su
      ./dvdplay.pl
      
      To skip to the next clip, press control-C. To kill the whole thing, press control-C twice.

Alternative software

There are many other DVD/mpeg players out there.