BSD DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


FreeBSD Basics DVD Playback on FreeBSD

by Dru Lavigne
10/03/2002

Today's article is on DVD playback, and I'll be demonstrating four applications from the ports collection which can be used for this purpose. Since I'll be elaborating on information found in the handbook, you'll want to read through that section as well.

There are two terms you should be aware of as they deal with DVD playback on a computer. The first is region codes. Nearly every DVD you purchase has a burnt-in region code indicating the distribution area for that DVD release. You'll find the DVD's region code on the rear jacket; it is usually towards the bottom next to the other symbols for Dolby Digital, the name of the studio, and the movie rating. Since movies are released at different times in different areas of the world, region codes are used to discourage the sale of DVDs before a region's official release date. Typically this isn't an issue unless, for example, you purchase a DVD while abroad only to discover you can't play it when you return home.

I'll list the region codes here since some of the DVD ports default to region code 1, meaning you may need to reconfigure the DVD application with the region code for your geographic area.

Region Code Geographic Area
1 Canada, US, US territories
2 Japan, Europe, South Africa, Middle East, Egypt
3 Southeast Asia, East Asia
4 Australia, New Zealand, Pacific Islands, Central America, Mexico, South America, Carribean
5 Russia, Indai, Pakistan, Africa (except Egypt), North Korea, Mongolia
6 China
7 Reserved
8 Airplanes, cruise ships

The other term is CSS, or the Content Scrambling System. Almost all DVDs (usually the ones with region codes) are encrypted to prevent users from creating illegal copies, meaning that in order to actually view the DVD, the hardware DVD player needs the necessary software to unscramble the DVD. This is where things get murky and downright ugly. Since this issue is still before the courts and I'm not a lawyer, I'll leave it to you to do your own research on the subject and decide whether or not you want to play encrypted DVDs on your computer. A Google search of "dvd css" will definitely give lots of food for thought. Again, not all DVDs are encrypted. When I went through my DVD collection, I discovered that about 75 percent of them were.

DVD playback on a computer is still an emerging science, meaning that your mileage will definitely vary depending upon your CPU, video card, and resolution settings. It is quite possible that your results will be very different than mine, so read the article with a grain of salt and leave yourself some time for experimentation. I would strongly suggest that both your version of FreeBSD and your ports collection be cvsupped to the latest sources and that you are using the latest version of XFree86. Also, ensure your system is optimized for DVD playback:

  • kernel reconfigured with CPU_ENABLE_SSE
  • dma enabled in /boot/loader.conf
  • /etc/sysctl.conf has been tweaked
  • /dev/acd0c has 666 permissions

Step by step instructions for the above optimizations were given in the previous article.

Also, if you plan on tweaking any of the default settings that come with the DVD players, the following links are a great introduction to DVD terminology and how to navigate through the alphabet soup of input and output devices:

  • Xine HOWTO
  • MPlayer - The Movie Player for LINUX
  • The MPlayer site is highly recommended reading and is well worth devoting an evening to.

    Finally, become the superuser and create the following links:

    ln -s /dev/acd0c /dev/dvd
    ln -s /dev/racd0c /dev/rdvd

    One of the first things I discovered when I started playing DVDs on my computer is that most of my DVDs are scrambled by CSS, but a few aren't. As chance would have it, the very first DVD I tried playing just happened to not be scrambled. The second DVD I tried to play was encrypted, which left me wondering why something that had seemed so easy had suddenly become so difficult. As I demonstrate each port, I'll show the differences between playing an unencrypted and an encrypted DVD.

    There are four ports that deal with DVD playback: vlc, xine, mplayer, and ogle. My criteria for evaluating each port was, in order of importance:

    1. No choppiness in audio or video
    2. Works "out-of-the-box" without having to read tons of documentation
    3. Skinnable, nice-looking interface

    vlc

    Okay, enough prep. Let's start with the "vlc" port:

    cd /usr/ports/graphics/vlc 
    make install clean

    The executable will be installed to /usr/local/bin/vlc. While "vlc" isn't skinnable, it does have a decent enough looking interface which is very intuitive to use. Simply insert a DVD into your DVD drive, click on the Disc option in "vlc" and choose the Chapter you would like to start at.

    If you find when you play a DVD that you're only seeing the top two-thirds of the movie, your resolution is set too high. Press "ctrl alt -" (use the - on the Num Lock portion of the keyboard on the far right). This will allow you to scroll through your resolutions until you find the best one for playing DVDs.

    I found that the "out-of-the-box" vlc was choppy in the audio, and the audio lagged a second or two behind the video. Encrypted DVDs were worse and far too choppy to be listenable. There were tons of options in Settings -> Preferences that I could select. However, whenever I hovered over any of the select buttons, I received a message stating that the "default behaviour is to automatically select the best module available." So I didn't bother to change any of the defaults. And, according to the vlc FAQ, choppy audio is a known problem which is being investigated. For myself, I've placed vlc on the backburner, and I'll take another look at it in a few months time to see how things improve.

    Pages: 1, 2

    Next Pagearrow





    Sponsored by: