Friday, 15 August 2008

Downloading, Compiling and Installing MPlayer on a Ubuntu System

We are going to download MPlayer sources and binary codecs, configure, compile and install them on our Ubuntu system.

I do not want a graphical interface, so I will compile MPlayer without it.


DOWNLOADING MPLAYER SOURCES


We first download the sources: (I pick up the latest source version, if it does not work pick up latest stable one)

(I choose to download it from a German mirror: MPlayer source download page)
$wget http://www7.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2


DOWNLOADING BINARY CODECS


MPlayer binary codecs download page

As I have a Linux x86 platform ,I choose its corresponding package:
$wget http://www7.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2

This page shows an updated list of supported codecs: Codec Status page


In order to install the binary codecs

We create the directory where we will place the codecs:
$sudo mkdir /usr/local/lib/codecs

We untar the codecs and then move them into their place:
$tar xvfj essential-20071007.tar.bz2
$cd essential-20071007/
$sudo cp * /usr/local/lib/codecs


CONFIGURING OSD FONTS


To be able to support truetype fonts:
$sudo aptitude install libfreetype6-dev

Look after this directory to find some fonts on your system: /usr/share/fonts/...
To install some fonts: $sudo aptitude install ttf-freefont

Now we create a symlink to the font file we choose:
$cd #We go to our home directory:
$mkdir .mplayer
$cd .mplayer
$ln -s /usr/share/fonts/truetype/freefont/FreeSans.ttf subfont.ttf

Our subtitle font will be automatically selected


NOTE: Another way to select a font file is using -font switch when executing mplayer command.
e.g: $mplayer -font /usr/share/fonts/truetype/freefont/FreeSans.ttf -vo x11 -framedrop ....

Some more font configuration info.


COMPILING MPLAYER SOURCES


First we untar the sources:
$tar xvfj mplayer-export-snapshot.tar.bz2
$cd mplayer-export-2008-08-13/

We choose and add some video drivers:
x11 support ----> $sudo aptitude install libx11-dev libxext-dev
Xv support -----> $sudo aptitude install libxv-dev
AA library support ----> $sudo aptitude install libaa1-dev
Alsa sound support ----> $sudo aptitude install libasound2-dev
Add ogg theora support ----> $sudo aptitude install libogg-dev libtheora-dev

Avoid X screensaver activation.
$sudo aptitude install libxss-dev

And finally configure, compile and install mplayer:
$./configure
$make
$sudo make install


Now we can enjoy our multimedia files:
e.g $mplayer -vo xv -framedrop -sub foo.srt foo.avi

NOTE: If you want to switch off MPlayer console messages pass this argument -msglevel all=0 when calling mplayer command.
e.g $mplayer -vo xv -framedrop -msglevel all=0 -sub foo.srt foo.avi

You can obtain more info executing $man mplayer.


NOTE: Mplayer also provides mencoder utility, which you can use to encode multimedia files.


REFERENCE URLS:

MPlayer official site.
Installation instructions from MPlayer site. This text is also available within MPlayer sources.


YOU MAY ALSO BE INTERESTED IN


Convert videos to VP6 codec format using MENCODER

Joining two AVI files with MENCODER

Split a Media Video File (AVI, FLV,...) using Mencoder and Mplayer

6 comentarios:

Anonymous said...

thanks for the post. i followed it and got mplayer running.

cheers!

Vicente Hernando said...

Always great receiving reader's comments.

Thank you for your comment!

K-2 said...

Thanks for your post. It helped me a lot (I'm a total newbie).

Sathishkumar said...

Thanks for the post and can you please tell me how to use mencoder VP6 with ffmpeg. I am trying to convert videos to VP6 codec format from H.@64 using ffmpeg. Since ffmpeg do not have VP6 encoder. So i plan to use Mencoder VP6 + ffmpeg.


Thanks in advance,
sathish

Vicente Hernando said...

Hi Sathishkumar,

these two links may be useful to you:

http://kishalmi.net/cms/node/73

http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-video-for-windows.html

Regards,
Vicente.

Vicente Hernando said...

In the end I wrote an article about how to convert videos to VP6 codec format using MENCODER