May 2, 2008

MPlayer from source with 3GP support on Ubuntu

UPDATE: Instead of amrnb,wb you need to use opencore-amr for now.

* Download the required packages .
# sudo apt-get build-dep mplayer
# sudo apt-get install subversion

* Download MPlayer, MPlayer skin (for the gui), 3GP AMR codecs.
NOTE: we will get the current sources of MPlayer not the stable RC2. It has more features, bugfixes.

# svn checkout svn:// mplayer
# wget
# wget

* Extract the files.
# tar xvf opencore-amr-0.1.2.tar.gz
# tar xvjf Blue-1.7.tar.bz2

* Compile and install opencore-amr
# cd opencore-amr-0.1.2
# ./configure --prefix=/usr
# make
# sudo make install

* We can now compile MPlayer.
# cd ../mplayer
If you need GMPlayer (GUI) please use --enable-gui.
For more configuration options see:
# ./configure --help

I will enable GUI this time because I want to show how we can install Skins for it.
# ./configure --enable-gui
After this you can read what will be enabled and disabled, what you will see will be enough.

Now we can compile and install it:
# make
# sudo make install

NOTE: it seems that the current Makefile is broken so the GUI wont be installed we need to execute:
# sudo make install-gui

* Install the Skin and Font.
# cd ..

This will copy the Blue directory recursively to /usr/local/share/mplayer/skins
# sudo cp -R Blue /usr/local/share/mplayer/skins

We need to create a symlink because else MPlayer won't recognize it:
# sudo ln -s /usr/local/share/mplayer/skins/Blue /usr/local/share/mplayer/skins/default

For subtitles and menus we need a font:
So, we create a symlink.
# ln -s /usr/share/fonts/truetype/freefont/FreeSans.ttf ~/.mplayer/subfont.ttf

* Remove the "working directry".
# cd ..
# rm -rf ~/build
NOTE: You can keep this time at least the mplayer directory if you want to weekly checkout the sources and rebuild it.

Now you can enjoy your movies :)

PS: if something is not clean or it fails somewhere, please leave a comment or:
- you can subscribe to MPlayer mailing lists at the MPlayer site
- you can enter #MPlayer at Freenode