Installing MPlayer

2083

Author: John Knight

MPlayer has set itself apart as a versatile movie player under Linux and other platforms. Whether you love or hate it, once you try it, you’ll have to agree that it is very different, with its versatile keyboard control and alternative methods for handling video playback.

MPlayer grabs external formats and hacks into them to make them playable under other operating systems than they were designed for. It plays back encrypted DVDs and broken media files, and can encode media files.

The best way to install MPlayer is by compiling it from source code. Though pre-compiled binary packages (.deb and .rpm) are available, a source-based installation gives you a fully customised player, optimised for maximum performance in terms
of your system’s processor type, video drivers, and other features.

To install MPlayer from source code, download the code tarball. Extract the files into a temporary directory. Change to the directory into which you downloaded the files and enter the following commands:

./configure --enable-gui
make
su (if you're not already root)
make install

Without the --enable-gui switch, you’ll get a command-line-based player. Even with it, at this point, you have only has command-line capabilities, as there are no skins for MPlayer to use. Visit the MPlayer download page, grab a skins, extract it, and copy it into the directory /usr/local/share/mplayer/Skin. Make sure you copy the whole directory though, not just the files within.

You should now have a 90% functioning player which can play video files with no worries, but still lacks subtitles for DVD playback. Grab a subtitle pack from the download page and extract it. You’ll find that there are a few choices for subtitle size. For most people, I recommend font size 14. Copy the directory containing your choice of font size to /usr/local/share/mplayer/font and you should be good to go.

Unfortunately, MPlayer lacks DVD menus, meaning that you have to manually choose title numbers, chapters, and audio streams.
Those who are put off by an application with no menus can try out the xine multimedia player. It has full surround sound options, options to change video filters, audio streams, subtitles, and more, all on the fly, with a fairly mature code base.

For those of you chasing a more lightweight player, designed for just DVDs, I recommend Ogle, which is rapidly gaining popularity.

Troubleshooting

Chances are, not everything went according to plan, and you may have to take a few extra steps to get MPlayer fully installed. Here are some troubleshooting tips.

Click to enlarge

I have gcc 2.96. I’m getting errors saying that I should use another version of gcc. What should I do?

If you’re not too worried about player stability, at the ./configure stage, add the switch --disable-gcc-checking. However, the MPlayer developers recommend that you don’t use gcc 2.96, as it lacks stability (see the MPlayer documentation for more info on this). If you do compile MPlayer with it, don’t report bugs to the MPlayer team. Personally, I found most things ran okay with 2.96, but files encoded with mencoder play back strangely on other machines.

When I enable the GUI at ./configure, I get an error saying that GTK isn’t installed, but I’m sure it is.

You also need the development packages for GTK. Grab these too and it should work. If you’re unlucky like I was, the development package won’t be available for your version (mine was 1.2.10-14 on Libranet 2.8.1), I had to upgrade GTK and libglib too, to 1.2.10-16 and 1.2.10-9 respectively. I’d recommend using apt-get if you’re using a Debian-based system, using the package names libgtk1.2 and libglib1.2. For RPM users, browse the freshrpms.net Web site and grab the latest packages for your distribution. For those wanting to compile it form source, get the 1.2 release from http://gtk.org/download/.

When I go to play DVDs, it says it can’t read the DVD. Why not?

Most DVDs are encrypted nowadays, meaning you need something to break the encryption. Try grabbing the latest version of libdvdcss and libdvdread.
Installation methods are discussed in each program’s documentation.

I get an error during the ./configure stage saying that I don’t have X11 installed. Of course I have X11 installed!

You need the development headers package for X11 installed too. They should be available on your distribution’s CDs or DVD, with a package containing “xlibs-dev” in the filename. Try ./configure again after you get these. For Libranet 2.7 users, you may have a lot of trouble getting this package without changing a lot of X-related packages. The Libranet specific package is available at libranetlinux.com/download/xlibs-dev_4.2.0-0pre1v3_i386.deb.

I’m having trouble playing back certain files despite grabbing all the codec packages.

Make sure you have the line /usr/local/lib in your /etc/ld.so.conf file. I had only /usr/X11R6/lib in mine. While you’re there, I’d recommend also adding the following lines, for use by other programs that search for libraries in other specific directories:

/lib
/usr/lib
/usr/lib/win32

When I playback DVDs and some video files, the audio is out of sync with the video. How to I adjust it?

Try using the + and – keys on the keypad. On older versions of MPlayer, you might find that DVDs like -200ms. I recommend having the on-screen display enabled when you do this though, as you can make note what audio delay you have for next time. Use the “o” key to enable/disable it.

Some of my keys don’t work when I’m playing a file.

Go to the directory into which you extracted MPlayer’s source. Go into the /etc subdirectory. Copy all of the files into your ~/.mplayer directory, which is where MPlayer looks for configuration files. Once they’re there, MPlayer will be fully informed as to what your key settings are and where certain codec files (required for playing back certain video formats) are available.