CSUF LogoCSUF Site Navigation
optics.csufresno.edu

FC5 Multimedia-Based Applications & Setup Mplayer, etc.

Department of Electrical and Computer Engineering
Assistant Professor Gregory R. Kriehn
Forums
Wiki
FC5 Mplayer, Mplayerplug-in, & .xpi
mplayer is *the* movie player for Linux. It is the holy grail of multimedia applications, as it can be used for DVDs, Quicktime movies, Windows Media Files, MPEG files, etc., etc., etc. It simply works, and it is the only application that you really need to watch and encode streaming media. mplayer is available in several repositories, but I am going to step through the manual installation, as outlined very nicely by Mauriat Miranda, because it works much more smoothly when configured for your particular hardware. Mauriat's notes are much more complete than those presented here, so if you have a problem, I suggest surfing over to his website.

1.  Install Proper Codecs
The first step toward installing mplayer is to first install some additional codecs.

DivX
mplayer used to require the installation of DivX, which is the MPEG-4 codec provided by DivXNetworks, Inc., but mplayer can now properly decode and encode DivX files automatically. Hence, it is no longer necessary to install the codecs manually.

Lame
Lame is an open source MP3 encoder, which can be used to compress audio into MP3 audio when encoding files from MPEG or other sources. Lame is not required to decode MP3 audio, but it is nice to install it nonetheless.  Go to:

http://lame.sourceforge.net/download.php

and click on the can be downloaded from SourceForge link. Click on the latest version of Lame, which at the time of this writing, is Version 3.97. Next, create an appropriate directory to install Lame under /usr/local/src:

~> sudo mkdir -p /usr/local/src/mplayer/lame
Move the source tarball to the directory:
~> sudo mv ~/Desktop/lame-3.971.tar.gz /usr/local/src/mplayer/lame/.
Change into the lame directory:
~> cd /usr/local/src/mplayer/lame
and decompress the source:
~> sudo tar vfzx lame-3.97.tar.gz
Once the package has been decompressed, delete the source file and change into the lame-3.97 directory:
~> sudo rm lame-3.97.tar.gz
~> cd lame-3.97
Next, configure Lame:
~> sudo ./configure --prefix=/usr
Note:  If you install Lame without --prefix=/usr, mplayer may not properly link to the Lame libraries.

After Lame is configured, compile it:

~> sudo make
The process will take a couple of minutes. When it is done compiling, install it:
~> sudo make install
The Lame libraries are now installed on your system.

XviD
XviD is an ISO MPEG-4 compliant video codec. Using it, mplayer can encode movie file formats into the XviD format. Go to:

http://www.xvid.org/downloads.html

and click on the Xvid 1.1.2 final source code link, which is the latest version of XviD (at the time of this writing). Next, create an appropriate directory to install XviD under /usr/local/src:

~> sudo mkdir -p /usr/local/src/mplayer/xvid
Move the source tarball to the directory:
~> sudo mv ~/Desktop/xvidcore-1.1.2.tar.gz /usr/local/src/mplayer/xvid/.
Change into the xvid directory:
~> cd /usr/local/src/mplayer/xvid
and decompress the source:
~> sudo tar vfzx xvidcore-1.1.2.tar.gz
Once the package has been decompressed, delete the source file and change into the appropriate xvidcore-1.1.2 directory:
~> sudo rm xvidcore-1.1.2.tar.gz
~> cd xvidcore-1.1.2/build/generic
Next, configure XviD:
~> sudo ./configure
After XviD is configured, compile it:
~> sudo make
The process will take a couple of minutes. When it is done compiling, install it:
~> sudo make install
The XviD libraries are now installed on your system.

RealPlayer
RealPlayer is a streaming audio/video/flash/pix/text player with protocols to watch/listen to content on the internet. It is provided by RealNetworks, Inc. You do not need RealPlayer installed to use mplayer to watch RealMedia in mplayer. mplayer will play older and new Real formats and media if you have the codecs properly setup. However, RealPlayer10 will play all newer Real media including 10.0 formats perfectly. If you wish to install RealPlayer, see my RealPlayer page.

LIVE555 Streaming Support
LIVE555 provides additional support for RTP/RTCP/RTSP/SIP multimedia streaming in mplayer. This is useful if you plan to use the mplayerplug-in for Mozilla/Firefox (which we are going to do). Prior to November 2005, LIVE555 was known as LIVE.COM. 
Go to:

http://www.live555.com/liveMedia/public/

and click on the live555-latest.tar.gz link, which is the latest version of LIVE555 (at the time of this writing). Next, create an appropriate directory to install LIVE555 under /usr/local/src:

~> sudo mkdir -p /usr/local/src/mplayer/live555
Move the source tarball to the directory:
~> sudo mv ~/Desktop/live555-latest.tar.gz /usr/local/src/mplayer/live555/.
Change into the live555 directory:
~> cd /usr/local/src/mplayer/live555
and decompress the source:
~> sudo tar vfzx live555-latest.tar.gz
Once the package has been decompressed, delete the source file and change into the live directory:
~> sudo rm live555-latest.tar.gz
~> cd live
Next, generate the appropriate Linux Makefiles, as the software distribution does NOT use the normal Unix "configure" mechanism for generating a Makefile:
~> sudo ./genMakefiles linux
After LIVE555 is configured, compile it:
~> sudo make
The process will take a couple of minutes. When it is done compiling, copy the entire directory structure over to /usr/local/lib/live:
~> cd ..
~> sudo cp -a live /usr/local/lib/live
The LIVE555 libraries are now installed on your system.

2.  Install mplayer

Win32 Codecs
There are some additional codecs available on mplayer's website that are used to read formats that do not have an open source decoder. These include Win32 codecs for Windows Media, Quicktime, Real, etc.  Go to:

http://www1.mplayerhq.hu/MPlayer/releases/codecs/

Click on the all-20061022.tar.bz2 link, which is the latest version of the codecs (at the time of this writing).
Next, create a directory to install the Win32 codecs under /usr/local/src:
~> sudo mkdir -p /usr/local/src/mplayer/codecs
Move the source tarball to the directory:
~> sudo mv ~/Desktop/all-20061022.tar.bz2 /usr/local/src/mplayer/codecs/.
Change into the codecs directory:
~> cd /usr/local/src/mplayer/codecs
and decompress the source:
~> sudo tar vfjx all-20061022.tar.bz2
Please note the use of the 'j' option instead of the 'z' option since we have to use bunzip2 opposed to gunzip to decompress the tarball. Once the package has been decompressed, delete the source file.
~> sudo rm all-20061022.tar.bz2
The codecs need to be installed into the /usr/local/lib/codecs directory, so let's create it:
~> sudo mkdir /usr/local/lib/codecs
Then copy the decompressed codecs over to the appropriate directory:
~> sudo cp -a all-20061022/* /usr/local/lib/codecs/.
NOTE: Previously, Win32 codecs were placed in /usr/lib/win32. Applications like Xine use the win32 directory for the same purpose. Therefore, we need to create an appropriate symlink:
~> sudo ln -s /usr/local/lib/codecs/ /usr/lib/win32
The Win32 codecs are now installed on your system.

MPlayer Files
Obtain the following files for installation:

    1.  mplayer Source Code
    2.  mplayer Skins

Go to:

http://www.mplayerhq.hu/design7/dload.html

Click on the US link under HTTP for Mplayer v1.0rc1 source,
which is the latest version of mplayer (at the time of this writing).

Scroll down further, and you will come to the mplayer skin section. The skins are required if you want to have a GUI for mplayer. You will need at least one skin. I typically download the Blue, BlueHeart,
proton, and PowerPlayer skins, with the PowerPlayer being my preferred choice. At the time of this writing, the latest versions are Blue-1.6.tar.bz2, BlueHeart-1.5.tar.bz2, proton-1.2.tar.bz2, and PowerPlayer-1.1.tar.bz2.

Next, create an appropriate directory to install mplayer under /usr/local/src:
~> sudo mkdir -p /usr/local/src/mplayer/mplayer
Move the source tarball to the directory:
~> sudo mv ~/Desktop/MPlayer-1.0rc1.tar.bz2 /usr/local/src/mplayer/mplayer/.
Change into the mplayer directory:
~> cd /usr/local/src/mplayer/mplayer
and decompress the source (again using the 'j' option):
~> sudo tar vfjx MPlayer-1.0rc1.tar.bz2
Once the package has been decompressed, delete the source file and change into the MPlayer-1.0rc1 directory:
~> sudo rm MPlayer-1.0rc1.tar.bz2
~> cd MPlayer-1.0rc1.tar.bz2
Configuring mplayer requires a bit more thought than just using the ./configure script. To see all of mplayer's configuration options, run:
~> ./configure --help
I strongly suggest including the GUI, to allow access to large files over 2 GB, which is useful to rip DVD's or record Digital Video (without pirating, of course), and to allow for menus in the On Screen Display (OSD). With this in mind, in addition to the location of X11R7, and the default install directory,
~> sudo ./configure --enable-gui --enable-largefiles --enable-menu --prefix=/usr --confdir=/etc/mplayer
Older versions of the mplayer GUI used GTK 1.2. With version 1.0pre8 and newer, the preferred GUI uses GTK 2. The GUI requires both gtk2 and glib2 to be installed, as well as their devel libraries. Make sure that you have the following RPMS (or newer): gtk2-2.8, gtk2-devel-2.8, glib2-2.10, glib2-devel-02.10. You can download these, if necessary, using yum (use "rpm -q gtk2 gtk2-devel glib2 glib2-devel" to check if they are installed on your system).

Once the configure script has been run, check to make sure that it has successfully configured. If you scroll up a bit, you should see something similar to the following:

Config files successfully generated by ./configure !

  Install prefix: /usr
  Data directory: /usr/share/mplayer
  Config direct.: /etc/mplayer

  Byte order: little-endian
  Optimizing for: prescott mmx mmxext sse sse2 mtrr

  Languages:
    Messages/GUI: en
    Manual pages:  en

  Enabled optional drivers:
    Input: ftp network tv-v4l2 tv-v4l tv live555 mpdvdkit2 vcd dvb smb
    Codecs: qtx xvid libavcodec real xanim win32 faad2 libmpeg2 liba52 mp3lib tr emor(internal)
    Audio output: alsa esd arts oss sdl mpegpes(dvb)
    Video output: xvidix cvidix md5sum sdl pnm jpeg png mpegpes(dvb) opengl dga xv x11 xover tga
    Audio filters:
  Disabled optional drivers:
    Input: vstream pvr radio cdda dvdread dvdnav
    Codecs: x264 libdv amr_wb amr_nb faac musepack libdts libtheora speex twolam e toolame libmad liblzo gif
    Audio output: sun openal jack polyp ivtv dxr2 nas
    Video output: winvidix bl zr zr2 ivtv dxr3 dxr2 vesa gif89a fbdev svga caca aa ggi xmga mga xvmc dfbmga directfb tdfx_vid s3fb tdfxfb 3dfx
    Audio filters: ladspa
Notice the inclusion of live555, win32, etc. If you wish to verify that the libraries and codecs were properly detected, scroll up further, and look for the appropriate lines. For example, if the Lame libraries were detected, you should see:
Checking for libmp3lame (for mencoder) ... yes
If you need to add additional codecs, or modify the configuration settings, you must re-run the configure script.

At this point, Mauriat Miranda makes some good points about the configure output, so I would like to quote him here:



The following explains some of the configure output.



After you have carefully configured mplayer, compile it:

~> sudo make
Depending on your processor speed, this process may take quite some time. When it is done compiling, install it:
~> sudo make install
MPlayer OSD/Fonts & Skins
After mplayer is finished installing the appropriate files, the last few lines of the output will indicate where we should install the fonts and skins:

*** Download font at http://www.mplayerhq.hu/dload.html
*** for OSD/Subtitles support and extract to /usr/share/mplayer/font/
*** Download skin(s) at http://www.mplayerhq.hu/dload.html
*** for GUI, and extract to /usr/share/mplayer/skins/
The On Screen Display (OSD) and Subtitles need to have fonts properly installed. To do this, setup a symlink from one of your msttcorefonts fonts, assuming you have installed them (if not, see the MSFonts page):
~> sudo ln -s /usr/share/fonts/msttcorefonts/arial.ttf ~/.mplayer/subfont.tff
To install the skins, create an appropriate directory under /usr/local/src:
~> sudo mkdir -p /usr/local/src/mplayer/skins
Move the source tarballs that you downloaded earlier into the directory:
~> sudo mv ~/Desktop/Blue-1.6.tar.bz2 /usr/local/src/mplayer/skins/.
~> sudo mv ~/Desktop/BlueHeart-1.5.tar.bz2 /usr/local/src/mplayer/skins/.
~> sudo mv ~/Desktop/PowerPlayer-1.1.tar.bz2 /usr/local/src/mplayer/skins/.
~> sudo mv ~/Desktop/proton-1.2.tar.bz2 /usr/local/src/mplayer/skins/.
Change into the skins directory:
~> cd /usr/local/src/mplayer/skins
and decompress the source files (again using the 'j' option):
~> sudo tar vfjx Blue-1.6.tar.bz2
~> sudo tar vfjx BlueHeart01.5.tar.bz2
~> sudo tar vfjx PowerPlayer-1.1.tar.bz2
~> sudo tar vfjx proton-1.2.tar.bz2
Once the package has been decompressed, delete the source files:
~> sudo rm *.bz2
Next, copy the directories over to /usr/share/mplayer/skins:
~> sudo cp -a Blue /usr/share/mplayer/skins/.
~> sudo cp -a BlueHeart /usr/share/mplayer/skins/.
~> sudo cp -a PowerPlayer /usr/share/mplayer/skins/.
~> sudo cp -a proton /usr/share/mplayer/skins/.
Change your directory over to /usr/share/mplayer/skins:
~> cd /usr/share/mplayer/skins
And finally, choose one of the skins to be your default. This can be done by creating a softlink from the directories to "default":
~> sudo ln -s PowerPlayer default
With that, mplayer is finally ready for use. To launch the graphical version, type the following in a terminal window:
~> gmplayer
3.  Install mplayerplug-in
mplayerplug-in is a wonderful little plugin that allows mplayer to play your digital media directly from websites on your web browser without reading the source html by getting the url directly. Media is played embedded within the webpage, or in a separate window, depending on how the author of the page intended for the media to be seen. To use it, go to the appropriate sourceforge page:

http://mplayerplug-in.sourceforge.net/

Click on Download, and choose the source code (at the time of this writing, the version number is mplayerplug-in-3.31.tar.gz.) The source code should be chosen over the rpm file since yum will recognize the plugin and will try to download mplayer from the repositories. 
Next, create an appropriate directory to install mplayerplug-in under /usr/local/src:
~> sudo mkdir -p /usr/local/src/mplayer/mplayerplug-in
Move the source tarball to the directory:
~> sudo mv ~/Desktop/mplayerplug-in-3.31.tar.gz /usr/local/src/mplayer/mplayerplug-in-3.31.tar.gz/.
Change into the mplayerplug-in directory:
~> cd /usr/local/src/mplayer/mplayerplug-in
and decompress the source:
~> sudo tar vfzx mplayerplug-in
Once the package has been decompressed, delete the source file, rename the directory, and change into the appropriate mplayerplug-in-3.31 directory:
~> sudo rm mplayerplug-in-3.31.tar.gz
~> sudo mv mplayerplug-in mplayerplug-in-3.31
~> cd mplayerplug-in-3.31
Next, configure mplayerplug-in:
~> sudo ./configure
After mplayerplug-in is configured, compile it:
~> sudo make
The process will take a couple of minutes. When it is done compiling, install it:
~> sudo make install
mplayerplug-in is now installed on your system.

4.  Install mplayerplug-in.xpi
As a final step, go back to the sourceforge page for mplayer:

http://mplayerplug-in.sourceforge.net/

Now click on the link for the .xpi file (mplayerplug-in-0.3.xpi), which is an extension for Firefox that converts OBJECT tags to EMBED tags for sites that only support Internet Explorer. Once downloaded, open a new tab in Firefox, and open the mplayerplug-in-0.3.xpi file. Install it, and restart Firefox.

That's it. If you want to try it out, surf over to Apple's site, and take a look at their movie trailers (http://www.apple.com/trailers/). Click on a trailer, and you should be able to watch it embedded directly within the web page! The more you use it, the more you will realize just how powerful mplayer really is.