Tag/tag.png

Needs Updating
This article needs updating to include the latest versions of Ubuntu. More info...

Tag/tag.png

Unsupported Version
This article applies to an unsupported version of Ubuntu. More info...

This guide details how to install the development version of MPlayer on the latest release version of Ubuntu Linux. The guide was formerly hosted in the 'Tutorials and Tips' section of the Ubuntu Forums where early versions began on September 17th, 2007, but was transferred to this wiki in July 2012. Support is available for this guide on the Ubuntu Forums.

This guide will work for Ubuntu 12.10 Quantal Quetzal, 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! I believe that it is best to run the latest version of Ubuntu to successfully compile MPlayer so I hope that future wiki writers will rewrite this guide to match each Ubuntu release.

Preparation: Quantal Quetzal...

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 Quantal Quetzal. To start with some basic tools are required, we will also create our build directory:

Build tools...

By default Ubuntu does not install compiling tools so we will rectify this first:

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

Next to install an updated yasm:

Update yasm...

The version of yasm in Quantal is a little dated so the following single command downloads, compiles and installs an updated version:

cd $HOME/mplayer_build && \
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz && \
tar xvf yasm-1.2.0.tar.gz && cd yasm-1.2.0 && \
./configure && make -j 2 && \
mkdir -vp doc-pak && \
cp -v Artistic.txt AUTHORS COPYING doc-pak && \
sudo checkinstall --pakdir "$HOME/mplayer_build" --backup=no --deldoc=yes \
                  --pkgname yasm --pkgversion "1.2.0" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean

Next a considerable volume of interlinked development files are required:

Dev files...

The following single command downloads a considerable volume of so-called -dev files for MPlayer to use:

sudo apt-get -y install libaa1-dev libasound2-dev libcaca-dev libcdparanoia-dev libdca-dev \
libdirectfb-dev libggi-target-fbdev libenca-dev libesd0-dev libfontconfig1-dev libfreetype6-dev \
libfribidi-dev libgif-dev libgl1-mesa-dev libjack-jackd2-dev libopenal1 libpulse-dev \
libsdl1.2-dev libsvga1-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 libdirac-dev libdv4-dev \
libopencore-amrnb-dev libopencore-amrwb-dev libmp3lame-dev liblivemedia-dev libtwolame-dev \
libmad0-dev libgsm1-dev libbs2b-dev liblzo2-dev ladspa-sdk libopenjpeg-dev libfaad-dev \
libmpg123-dev libopus-dev libbluray-dev libaacs-dev

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. You will note that I have included the necessary files for bluray playback but more work will be required before playback of encrypted disks can occur. Our Arch colleagues outline the issues well and this page can also be helpful for both vlc and MPlayer users to get playback of their own legally purchased bluray disks.

Next to 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. Some may prefer to use the Medibuntu repository for this but I personally prefer to keep exposure to all external repositories and PPAs to a minimum. 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) 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

Note that static linking with x264 and others now works in the current svn of MPlayer. 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.

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" \
           --confdir=/etc/mplayer \
           --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 "2: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! If you wish to add a gui read on...

Installing SMPlayer...

Many people will also want a gui for the commandline MPlayer and SMPlayer is a good choice. The following adds the creator's PPA and installs his great application:

sudo add-apt-repository ppa:rvm/smplayer && \
sudo apt-get update && sudo apt-get -y install smplayer smtube

There is a great alternative called UMPlayer which I would encourage you to experiment with, I am happy with SMPlayer myself.

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" \
           --confdir=/etc/mplayer \
           --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 "2:1.0~svn$(LC_ALL=C svn info 2> /dev/null | \
     grep Revision | cut -d' ' -f2)" --provides "mplayer,mencoder" && \
make distclean && sudo ldconfig

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

Compiling MPlayer2...

This guide deals with the original MPlayer but there is a fork of the MPlayer code called MPlayer2 that is at the very least worth looking at. First remove the MPlayer from your system (this will also remove SMPlayer for the moment) and then run the following single command:

sudo apt-get install -y python3 dh-autoreconf && \
cd $HOME/mplayer_build && \
git clone git://git.mplayer2.org/mplayer2-build.git --depth 1 && \
cd mplayer2-build && ./init --shallow && make && \
cd mplayer && \
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/mplayer_build" \
   --pkgname mplayer --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
   --pkgversion "2:1.0-git-$(date +%Y%m%d)-$(git show --abbrev-commit \
    | grep '^commit' | cut -f2 -d " ")" && \
cd .. && ./clean

The initial removal of the MPlayer package has removed SMPlayer so you should now replace this:

sudo apt-get -y install smplayer

If you have profited by your experience with MPlayer2 I would encourage you to return and update your installation from time to time. The following single command should be enough to do this:

cd $HOME/mplayer_build/mplayer2-build && \
./update && make && cd mplayer && \
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/mplayer_build" \
   --pkgname mplayer --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
   --pkgversion "2:1.0-git-$(date +%Y%m%d)-$(git show --abbrev-commit \
    | grep '^commit' | cut -f2 -d " ")" && \
cd .. && ./clean

And I shall leave you to decide which version of MPlayer you are happier with! And remember discussion is available concerning this guide on the Ubuntu Forums. Have fun!!!


CategorySoftware

Compiling MPlayer (last edited 2017-09-02 17:12:38 by ckimes)