How to Build Mplayer to Play DVD's - using "libdvdcss"

[Most recent]  Got a new box, installed Linux CentOS 6.6 and some experimental video stuff - video feed capture card, high-res ATI card with nice DVI interface to video display.   Put Xerion, TSM and the APL's on this thing (the Windows stuff running on "Wine" emulator).  So far, so good.  Compiled & rebuilt MPlayer, Mencode, ffmeg, etc, and running some tests.  Getting video and audio encode together was a bit tricky.  Note the size of the link-edit step, in screen at right..  (More details later..)

[Earlier: ] I have an older Linux box that runs a 32-bit Linux which reports it's kernel via "uname -a" as 2.6.27.25-78.2.56 and I am continously impressed by how good this stuff is. The box is a Pentium 4, with 1.2 gig memory, and it runs at 2.40 ghz.  It's not a fire-breather by modern standards.

I use it for video and image related analysis and AI software (the Xerion product that was doing the Financial Neural-Net forecaster).

I wanted to watch a DVD, but MPlayer would not play the DVD, and I determined that MPlayer needed to be built with the libdvdcss, libdvdread, and libdvdnav libs.  

So, I downloaded and built the libraries, re-compiled MPlayer, and confirmed it would then play a DVD.  Perfectly.  No delay and in full-screen, hi-res.  I didn't expect it to work well, but it worked flawlessly - absolutely perfectly, better than my DVD player, actually.  I am running MPlayer 1.2.1, and here is what I had to do..  I spent hours finding all the stuff via google-sniffing, and pulling it together so it worked.  What I did was the following:

   1) Get the libdvdcss thing from Videolan folks. Read the details, as the libdvdcs is what is used to decrypt the encrypted DVD's.  The entire DMCA stuff, with its viciously offensive "region coding" is just plain wrong. Here is the link to the Videolan site where libdvdcss is explained:  http://www.videolan.org/developers/libdvdcss.html

  2) create a directory somewhere, become root, and "git clone" the current libdvdcss source tree into your build directory.  Then, do these four steps (there is no "./configure" file, you have to use "autoconf i" to create it as a first step):

         autoconf i

         ./configure

         make

         make install

 3) Then, if you are using MPlayer, you need to get "libdvdread" and "libdvdnav".  Create a directory for each, and get the *.tar.bz2 file group for each of these (at least that is what I did), then if you are running an old 32-bit box, with no -j option on your "tar" utility, find a more modern box, or get the "bzip2" thing, so you can run "bzip2 -d <the_tar_bz2_file_name>" and have just a plain, uncompressed tar file.  If your tar utility is new, you can just "tar -xjvf <filename>" to create the source/build directory.   Create a directory for each libdvdread and libdvdnav, and then do the:

        ./configure

         make

         make install

steps to build from the source, and put the dynamic lib into /usr/local/lib.  You will also need to (for each of these), if you are on a Redhat/Fedora system and have not used "yum" or "rpm" to load stuff, tell pkgconfig that this lib is installed.

(or use "ndf" FFS... will this fiddling ever stop?   Sometimes, I fear we are collapsing into a pointless re-invention of things.. Nothing really new is being made, just endless revisions of stuff that already works... The Romans did this, at the end.  Innovation ended, and as the world fell apart, they fell back on ritual and foolish superstition.  Persians riding horses which had saddles that had *stirrups* were able to ride, control their horses, and shoot arrows at the same time.  They ran circles around the previously undefeatable Roman armies.  With 8-bit processors, we could fly spacecraft to other planets.  Now, we have superfast, low-cost 64-bit processors, and we can't get more than 200 miles up.).

Ahem... I digress.  Yes, you have to tell pkgconfig that this lib is installed. In each of the libdvdread and libdvdnav source dirs, there is a "misc" subdir with a .pc file in it.  Copy that .pc file into the /usr/lib/pkgconfig directory, so the build process for MPlayer knows that the libdvdread and libdvdnav stuff is installed, since the install puts the .so libs into /usr/local/lib.  

You probably need to run "ldconfig" (as root, from cmd shell) also, after the install step.

 4) Then, go to the directory where you built MPlayer (or go get Mplayer-1.2.1 as a tar.gz or tar.xz or tar.<whatever-new-compression-method-is-now-fashionable> and untar the thing to create a source hive for MPlayer.  (if you get a .xz file, you might have to install unxz and/or xz to decompress the ...tar.xz file.)  MPlayer-1.3.1 is out, but I already had MPlayer-1.2.1, and I just used that.   After you get the source directory built, cd to it and just run the same build:

        ./configure

        make

        make install

procedure for MPlayer, and make sure everything compiled and installed ok.  After the ./configure, check that you do *not* have "DVD" in the "list of input methods that are not supported", as reported by the ./configure process.

You play a DVD from MPlayer using term shell (command line) and just enter:

        MPlayer dvd://1 -fs 

At least, this is what worked for me.  You can compile MPlayer with "gui" support, and get GMplayer.  RTFM.  On some DVD's you might have to enter a different number, or put the filename.  You might need to use:

        MPlayer dvd://1 -fs /dev/dvd       (or maybe)    MPlayer DVD://1 -fs /dev/sr0

Read about MPlayer.  Try VLC, if that works better.  To drill a bit deeper, and get the latest version, check this "Linux from scatch" site that I found.  Building from source is best, because you are learn more, and are then able to do more.  I found this stuff helpful: http://www.linuxfromscratch.org/blfs/view/8.0/multimedia/mplayer.html

The DVD format is a common standard now.  It cannot and must not be locked down by bad people enforcing monopoly-enabling laws to make criminal preditors like Harvey Weinstein any more wealthy than they already are.   And since you probably bought and paid for the DVD, you should certainly be able to read and play the disk that contains the content you already purchased.  Hope it works for you.  Also, you may want to use the DVD format to create and distribute your own content, so this software is essential.

Update: GnuTLS, Nettle, Hogweed and GMP - stuff I had to get to make MPlayer compile and link on a really old Pentium III laptop (which can now run DVD's quite well, once everything is built and installed.) 

I put Linux and Python/IPython Tck/Tk/Scikit-Image/Pillow (for graphics), and Jupyter (with it's webserver running locally under Linux), plus all the libdvdcss+libdvdread/libdvdnav libs with MPlayer 1.2.1 on a Toshiba 4340 laptop I had that was gathering dust.  The machine is a rugged laptop built on a vintage Pentium III processor, so I did not expect it to run everything - but it does.  It will even play DVD's, (once the proper code in libdvdcss library is installed.).  MPlayer is a nice collection of code, and as it is built on ffmpeg, which has access to all the codecs, it can render many different formats.

Getting MPlayer to build here was a project.  I needed to install "gnutls" - the "tls" stands for "Transport Layer Security", and gnutls required "nettle" (which builds "hogweed" library) and also the GMP routines that provide multi-precision math calculations.  Nettle offers the new security/encryption routines.  [Update: I used Nettle 2.7.1 as the current version would just not link at all.  The Nettle 2.7.1 seems to be fairly generic.  See this note on "Linux from Scratch"...  http://www.linuxfromscratch.org/blfs/view/7.5/postlfs/nettle.html

GMP is for enhanced math calculations.  I am guessing the idea is to allow explicitily-defined precision calculations to be done.  So, before I could get MPlayer to compile on the old Toshiba, I had to download and build: gnutls, nettle, (which builds the "hogweed" library), and gmp.  And of course, that involved installing: autoconf, automake and libtools, as well as cmake.  And to get the scikit-image stuff to work, I needed to pip install numpy, scipy and matplot lib.  And to get them to work, I had to build "libzmq".  But once I got "libzmq"  built, I could just "pip install pyzmq", did not have to build pyzmq from c++ source.  (Note: used the gcc 4.3 compiler, on a 2.6.27.25 Linux kernel).  Got it all working, and the little Pentium III in the old Toshiba runs ok - not fast, but it *will* play DVD's without enforcing the "region-code" nonsense. Having Linux as our operating system lets us use computers as computers again.  I also had to build and install Python 2.7.14 from source, and get pip, using the "get-pip.py" program.  Surprised it all worked.

Note: These links are for Ubuntu, and I built for a Fedora version, but it was helpful reading this stuff, to gain insight...

https://ubuntuforums.org/showthread.php?t=2326315&page=2

https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs

Source for GnuTLS...

https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/

https://www.gnutls.org/download.html

I think I used the GnuTLS version 3.3, the Nettle 2.7.1 and some version of GMP that I don't have in front of me at the moment.  Getting DVD's to play well on a Pentium III Toshiba 4340 was a surprise.  I had trouble with one modern (large) DVD, and I think it is because the Toshiba only has 256 mb memory, which is pretty lean to play a DVD, given the cache that is probably maintained to let it play smoothly.

Again, hope this is useful info for someone.