1. Andrew's Corner »
  2. Linux Explorations... :

Build the svn MPlayer under the latest Ubuntu release

This guide details how to install the development version of MPlayer on the latest release version of Ubuntu Linux. It will work for Ubuntu 16.04 Xenial Xerus LTS, perhaps with some variation for other versions of Ubuntu as well, and hopefully in building the bleeding edge version of MPlayer we will all have great fun! This guide is best run through from beginning to end but for those who wish to dabble below is a table of contents:

  1. Some Preparation A little preparatory work is required before building MPlayer.
    1. Installing codecs Installing windows codecs which in particular the 32bit Mplayer will use.
    2. Compiling x264 Compiling x264 for MEncoder to use.
  2. Optional extras A few extra libraries for the curious to experiment with!
    1. iLBC Compiling in support for this open source royalty-free narrowband speech codec developed by Google.
  3. Download, Compile and Install MPlayer Download the MPlayer source and compile it.
    1. Updating MPlayer Updating the MPlayer source and installing the newer version.
    2. Latest compile A record of the most recent successful compile on my system.
  4. Using a better gui Some instructions for installing the gui SMPlayer.

I hope this guide proves useful to you, feel free to use the email link at the base of this page to pass on any thoughts on this work or any suggestions you have to improve this work. I can provide some troubleshooting and I suspect the mailing list mplayer-users can offer even more. And remember the most important thing: "Have Fun!!!".

Preparation: Xenial Xerus 16.04 LTS...

This guide aims to demonstrate how to build the development version of MPlayer under the latest release version of Ubuntu, currently this guide is aimed at Xenial Xerus 16.04 LTS. To start with some basic tools are required, and we will also setup our build directory:

sudo apt-get -y install build-essential subversion checkinstall git yasm \
git docbook-xml docbook-xsl xsltproc libxml2-utils && \
mkdir -pv $HOME/mplayer_build

Next a considerable volume of interlinked development files are required, the following is a single command:

sudo apt-get -y install libaa1-dev libasound2-dev libcaca-dev libcdio-cdda-dev libdca-dev \
libdirectfb-dev libenca-dev libesd0-dev libfontconfig1-dev libfreetype6-dev libcdio-dev \
libfribidi-dev libgif-dev libgl1-mesa-dev libjack-jackd2-dev libopenal-dev libpulse-dev \
libsdl1.2-dev libvdpau-dev libxinerama-dev libxv-dev libxvmc-dev libxxf86dga-dev \
libxxf86vm-dev librtmp-dev libsctp-dev libass-dev libfaac-dev libsmbclient-dev libtheora-dev \
libogg-dev libxvidcore-dev libspeex-dev libvpx-dev libschroedinger-dev libdv4-dev \
libopencore-amrnb-dev libopencore-amrwb-dev libmp3lame-dev libtwolame-dev libcdio-paranoia-dev \
libmad0-dev libgsm1-dev libbs2b-dev liblzo2-dev ladspa-sdk libopenjpeg-dev libfaad-dev \
libmpg123-dev libopus-dev libbluray-dev libaacs-dev libgtk2.0-dev libdvdnav-dev libdvdnav4 \
libdvdread-dev libdvdread4

And then to setup the installation of libdvdcss to enable playback of encrypted DVDs. The following downloads, compiles and installs libdvdcss2 and libdvdcss2-dev:

sudo apt-get install libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg

Be a little wary of omitting any of these files as often a single file given here pulls in several more that are essential to a good MPlayer installation but feel free to add a few if required. With the basics done now we download some files external to the Ubuntu repositories:

Codecs...

MPlayer benefits from the use of some external codecs and these can be downloaded directly from the MPlayer website. The following is a single command:

cd $HOME/mplayer_build && \
sudo mkdir -pv /usr/local/lib/codecs && \
if [ "$(uname -m)" = "x86_64" ]; then
 wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2
 tar xjvf essential-amd64-20071007.tar.bz2
 sudo cp -v essential-amd64-20071007/* /usr/local/lib/codecs
else
 wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2
 tar xjvf all-20110131.tar.bz2
 sudo cp -v all-20110131/* /usr/local/lib/codecs
fi

Bear in mind that codecs for 64 bit users are pretty minimal, the real benefits here are for the 32 bit users. There is a continuing drive to bring access to these file formats under the libavcodec umbrella so hopefully one day these codecs will no longer be necessary.

x264...

The best encoder for h.264 video is x264, probably better used directly from the x264 commandline or even indirectly through FFmpeg. Nevertheless many people are still keen on MEncoder (several scripts and applications still use it, an example being h264enc) so the following single command installs a local copy of this great encoder's libraries for MEncoder to use.

if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--enable-pic"
 else
  ARCHOPTS=""
fi && \
cd $HOME/mplayer_build && \
git clone git://git.videolan.org/x264.git --depth 1 && \
cd x264 && \
./configure --prefix=$HOME/mplayer_build/mplayer_deps/usr \
            --enable-static --disable-cli $ARCHOPTS && \
make && make install

You could return to this section from time to time to update x264 by running git pull and then recompiling, and I would still recommend some experimentation with either FFmpeg or x264 for easier encoding.

Optional Extras...

This section of the guide will have a few extra libraries at the moment simply a set of instructions for compiling the libraries for the Internet Low Bitrate Codec (iLBC).

iLBC...

MPlayer supports iLBC which is an open source royalty-free narrowband speech codec now developed by Google. The following single command downloads, compiles and installs the iLBC libraries:

cd $HOME/mplayer_build && \
wget https://github.com/TimothyGu/libilbc/releases/download/v2.0.2/libilbc-2.0.2.tar.gz && \
tar xvf libilbc-2.0.2.tar.gz && cd libilbc-2.0.2 && \
./configure && make && \
mkdir -vp doc-pak && cp -v COPYING INSTALL doc-pak && \
sudo checkinstall --pakdir "$HOME/mplayer_build" --backup=no --deldoc=yes \
                  --pkgname libilbc --pkgversion "2.0.2" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
sudo ldconfig

There are not so many iLBC samples around so I have created on and placed this sample here. And now to finally lay hands on the MPlayer source code:

Compiling MPlayer...

Now to finally download and compile the svn MPlayer, bear in mind that you will be asked to also download the FFmpeg git source during this process which you should allow by pressing 'enter' when directed. The following is a single command:

cd $HOME/mplayer_build && \
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer && \
cd mplayer && \
PKG_CONFIG_PATH="$HOME/mplayer_build/mplayer_deps/usr/lib/pkgconfig" \
./configure \
           --extra-cflags="-I$HOME/mplayer_build/mplayer_deps/usr/include" \
           --extra-ldflags="-L$HOME/mplayer_build/mplayer_deps/usr/lib" \
           --codecsdir=/usr/local/lib/codecs && \
make -j 2 && make html-chunked && \
mkdir -vp doc-pak && \
cp -v DOCS/HTML/*/* AUTHORS Changelog LICENSE README doc-pak && \
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/mplayer_build" \
   --pkgname mplayer --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
   --pkgversion "3:1.0~svn$(LC_ALL=C svn info 2> /dev/null | \
     grep Revision | cut -d' ' -f2)" --provides "mplayer,mencoder" && \
make distclean && sudo ldconfig

And this is enough to get you a working copy of the great MPlayer!

Updating MPlayer...

When you wish to update the svn MPlayer, as you definitely should do from time to time, the following single command will suffice:

cd $HOME/mplayer_build/mplayer && \
svn up && \
PKG_CONFIG_PATH="$HOME/mplayer_build/mplayer_deps/usr/lib/pkgconfig" \
./configure \
           --extra-cflags="-I$HOME/mplayer_build/mplayer_deps/usr/include" \
           --extra-ldflags="-L$HOME/mplayer_build/mplayer_deps/usr/lib" \
           --codecsdir=/usr/local/lib/codecs && \
make -j 2 && make html-chunked && \
mkdir -vp doc-pak && \
cp -v DOCS/HTML/*/* AUTHORS Changelog LICENSE README doc-pak && \
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/mplayer_build" \
   --pkgname mplayer --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
   --pkgversion "3:1.0~svn$(LC_ALL=C svn info 2> /dev/null | \
     grep Revision | cut -d' ' -f2)" --provides "mplayer,mencoder" && \
make distclean && sudo ldconfig

And now you should have a beautifully updated working copy of MPlayer and also a working copy of the elegantly aging MEncoder.

Latest compile...

Latest successful compile is here:

andrew@athens:~$ mplayer | head -n 1
MPlayer SVN-r37893-5.3.1 (C) 2000-2016 MPlayer Team
andrew@athens:~$ 

I will test the installation from time to time and respond to updated libraries and any breakages, please send me an email if anything unusual comes up during compile or if some libraries need updating.

Using a gui...

The commandline MPlayer is all you will ever really need but I will confess that even I use a gui from time to time. Mplayer can be compile with the gui GMPlayer but SMPlayer is a far superior application. The following commands will set you up with SMPlayer taken from the developer's own PPA:

sudo add-apt-repository ppa:rvm/smplayer
sudo apt-get update
sudo apt-get install smplayer smtube smplayer-themes smplayer-skins

This completes the setup for this guide and I wish you all the best with your continued exploration of this great media player!

And in conclusion ...

I have found immense enjoyment in writing this page and my pleasure will be redoubled if you have profited by any of the material on this page. Send me an email and let me know! Perhaps also have a look at another page on this site that digs a little deeper in to MPlayer usage. Importantly I am still having a great and productive time in the world of Linux and I feel as if I have joined a community and am contributing to it. What about you?