Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


Closed Thread
  Search this Thread
Old 01-27-2008, 06:05 PM   #1
Registered: Sep 2007
Posts: 152

Rep: Reputation: 30
MPlayer and MEncoder (The DVD/Movie/Video/MP3 Player and Encoder for Linux)

Compiling MPlayer.

This was copied from:

[url removed]
[url removed]

MPlayer allows you to play DVDs, watch video clips, and even listen to MP3s. MPlayer is probably the best movie player there is. Certainly, the best I know of.

An earlier version of this page (for mplayer-1.0pre8) can be found [url removed].

If you follow the instructions given here you will be able to watch almost all video formats, watch DVD's, watch streaming video, rip DVD's to MPEG-4 avi files, and preform many other useful video functions. MPlayer plays just about everything. And, if you so wish, you can add a graphical user interface.

To get a list of the formats supported, see this page. Here are some:

Video codecs: 3ivx, Cinepak, DivX, DV, H.263, H.264/MPEG-4 AVC, HuffYUV, Indeo, MJPEG, MPEG-1, MPEG-2, MPEG-4, RealVideo, Sorenson, Theora, WMV, XviD

Audio codecs: AAC, AC3, ALAC, AMR, FLAC, MP2, MP3, RealAudio, Shorten, Speex, Vorbis, WMA

Container formats: 3gp, AVI, ASF, FLV, Matroska, MOV, MP4, NUT, Ogg, OGM, RealMedia

So, lets get on with the compilation:

Make sure that you have the following programs and packages installed.

gcc libgcc glibc glibc-devel glib2 glib2-devel gcc-c++ libstdc++ libstdc++-devel

Make sure you are the root user, then make a directory in which to work:

mkdir /mplayer

Download the following files, saving them in the directory /mplayer/

font-arial-iso-8859-1.tar.bz2 all from
live555-latest.tar.gz from (currently live.2007.12.27.tar.gz)
lame-3.97.tar.gz from
twolame-0.3.10.tar.gz from
libsndfile-1.0.17.tar.gz from

cd /mplayer/

The sourceforge links were once deliberately sabotaged (by HTTP redirect) so you can try going direct, with:


The following commands unpackage the archives:

for a in *.tar.*; do tar -xf $a; done

Even though most compilations install into /usr/local/, some Red Hat derived distributions do not include /usr/local/lib in the default library loader path. This is just another example of Red Hat making it a little harder for you to compile your own programs. To fix this problem, add /usr/local/lib to the file /etc/, with the command:

echo "/usr/local/lib" >> /etc/

Setting the LD_LIBRARY_PATH no longer seems to be necessary, but it doesn't hurt:

export LD_LIBRARY_PATH=/usr/local/lib/

So, lets proceed:

rm -fr /usr/local/lib/{live,win32} (remove some old stuff)

cd /mplayer/live
./genMakefiles linux
make (nothing happens if the C++ libraries are not installed)
cd /mplayer; mv /mplayer/live /usr/local/lib/

mv /mplayer/all-20071007 /usr/local/lib/win32

The latest version of the codecs does not come with DivXc32f.dll, so if you have a need for it, you will have to copy it from a previous edition. If you do not have a need for it, just ignore this step:

cp DivXc32f.dll /usr/local/lib/win32

The default configurations, of all the programs below, install their libraries in /usr/local/lib/.

cd /mplayer/libsndfile-1.0.17
make install

If you have any queries about the configuration, use the following command:

./configure --help (viewing the help)

Now, do the same thing with the other packages:

cd /mplayer/lame-3.97
./configure --with-fileio=sndfile

This will use the libsndfile libraries. You get read/write ability to these file formats:

Microsoft WAV
Paris Audio File PAF
Commodore Amiga IFF/SVX
Sphere Nist WAV
Creative VOC
Sound forge W64
GNU Octave 2.0 MAT4 & 2.1 MAT5
Portable Voice Format PVF
Fasttracker 2 XI
HMM Tool Kit HTK
Apple CAF

See the local documentation accompanying the source code.

Drop the option, if you wish to use lame's io routines. You get RAW & WAV.

There are problems getting lame's mp3 frame analyzer, mp3x, working. Click here, to see how.

make install

cd /mplayer/twolame-0.3.10
make install

Usually ldconfig is run to update newly added libraries, but the install scripts for lame and twolame don't bother, so you have to do it:


cd /mplayer/MPlayer-1.0rc2

./configure, provides a summary of the optional drivers that it will enable, eg,

Enabled optional drivers:
-- Input: ftp network tv-v4l2 tv-v4l tv live555 mpdvdkit2 vcd dvb
-- Codecs: qtx libavcodec real xanim dshow/dmo win32 faad2(internal) libmpeg2 liba52 mp3lib tremor(internal) libmad twolame
-- Audio output: alsa jack esd arts oss nas mpegpes(dvb)
-- Video output: xvidix cvidix md5sum pnm jpeg png mpegpes(dvb) aa opengl dga xv x11 xover tga
-- Audio filters: ladspa

Disabled optional drivers:
-- Input: vstream tv-bsdbt848 cdda dvdread smb
-- Codecs: opendivx x264 xvid libdv amr_wb amr_nb faac musepack libdts libtheora speex toolame liblzo gif
-- Audio output: sgi sun openal polyp dxr2 dsound win32 sdl
-- Video output: winvidix bl zr zr2 dxr3 dxr2 directx sdl vesa gif89a fbdev svga caca ggi xmga mga xvmc directfb tdfx_vid s3fb tdfxfb 3dfx
-- Audio filters:

Check to see if you have all the drivers you want. If you want one of the "disabled optional drivers" then you will have to download and install additional software, or, as in the case of the Audio/Video output option sdl, you need to install the sdl development package included with your distribution.

You should also take a look at the configure.log:

less configure.log

Check that ./configure found the lame and twolame libraries.

make install

Now install the global font for sub-titles:

cp /mplayer/font-arial-iso-8859-1/font-arial-18-iso-8859-1/* /usr/local/share/mplayer/font/

You can also install a local font preference. Exit the root account, to your usual user account, then execute the following commands:

mkdir -p ~/.mplayer/font/
cp /mplayer/font-arial-iso-8859-1/font-arial-18-iso-8859-1/* ~/.mplayer/font/

The above process, has given you two binaries, one called mplayer, to play movies/videos, and the other, called mencoder, to encode movies/videos. For more information concerning the playing and recording of video, see the local documentation and FAQ accompanying the source code.

You play videos/movies with commands like:

mplayer name.wmv (watch the video with filename name.wmv)
mplayer WishYouWereHere.mp3 (listen to Pink Floyd)
mplayer mms:// (watch a "Microsoft Media Server" stream)
mplayer rtsp:// (watch a RTSP stream)
mplayer dvd://1 -dvd-device /dev/hdc (watch a DVD starting at chapter one)
mplayer -dumpstream rtsp://site/movie.rm (download movie.rm to stream.dump)

The -dvd-device /dev/hdc in the last command, is not necessary, if your DVD has been properly setup. The last command also assumes the movie starts at chapter one. If it starts at chapter 3, you will need dvd://3, etc. RTSP stands for "Real Time Streaming Protocol."

If I get time, I will write a tutorial, or two, on how to use mencoder.

A good page on how to rip a DVD to an MPEG-4 avi file is:

[url removed]
[url removed]

In the mean time, here are a few simple examples:

1) mencoder mms:// -ovc copy -oac copy -o output.avi
2) mencoder rtsp:// -ovc copy -oac copy -o output.avi
3) mencoder movie.wmv -ovc lavc -lavcopts vcodec=msmpeg4:vbitrate=750:vhq -oac mp3lame -o output.avi
4) mencoder dvd://1 -aid 129 -oac mp3lame -lameopts br=48:cbr:vol=6 -ovc frameno -o frameno.avi
5) mencoder movie.wmv -ovc copy -ofps 24000/1001 -oac mp3lame -of mpeg -o output.mpg

The above commands do the following (in order):

1) save an MMS video stream to the file output.avi (AVI is the default format).
2) save an RTSP video stream to the file output.avi.
3) encode WMV video as MPEG4 video with MP3 audio.
4) rip the German audio stream from a DVD and save it as an "MP3 video" labeled by frame number.
5) change the WMV file from AVI format to MPEG format with MP3 audio.

Sometimes, in order to convert an audio file to an MP3, you must first convert it to some huge WAV file. This WAV file can be many gigabytes in size. If you are short on filespace, you can create a named pipe to pass on the WAV file, as it is created. This way, you never need to write the whole file. In the following example, mplayer will write the WAV file to the pipe and lame will read it from the pipe and convert it to an MP3.

First, grab a file that you wish to convert to an MP3.

mplayer -dumpstream -dumpfile music.ra rtsp://site/music.ra

Without the -dumpfile tag, the download would be saved as stream.dump.
Create a named pipe called pipe.wav

mkfifo pipe.wav

Now execute the following command. It will hang, as it is waiting for the data to flow through the pipe.

lame pipe.wav music.mp3 (add your favorite lame options (including ID3 tags))

In a different terminal, execute the following command, to get the data flowing.

mplayer -ao pcm:file=pipe.wav music.ra

You can also execute the last two commands in reversed order, but it doesn't illustrate what is going on as clearly. This whole idea of named pipes, is also very useful in scripts.

So, we are able to convert music.ra, to music.mp3, even when space is limited.

[url removed]
[url removed]

Last edited by XavierP; 03-28-2008 at 05:23 PM. Reason: pages good, site bad
Old 01-28-2008, 11:56 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Mate, this really isn't a good place to repeat documentation. Assuming you did write this yourself, then you're encouraged to make additional submissions to our documentation subsite linked at the top right side of the page, but this right here is a help forum, for probelms and snwers, not documentation.
Old 01-30-2008, 05:09 AM   #3
Registered: Sep 2007
Posts: 152

Original Poster
Rep: Reputation: 30
Took me ages to even find the documentation (I was looking for the word Documentation not Tutorials).
Old 02-01-2008, 07:45 PM   #4
Registered: Sep 2007
Posts: 152

Original Poster
Rep: Reputation: 30
Mplayer has some extra help items:

mplayer -vo help
Available video output drivers:
        xv      X11/Xv
        x11     X11 ( XImage/Shm )
        xover   General X11 driver for overlay capable video output drivers
        gl      X11 (OpenGL)
        gl2     X11 (OpenGL) - multiple textures version
        dga     DGA ( Direct Graphic Access V2.0 )
        sdl     SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)
        fbdev   Framebuffer Device
        fbdev2  Framebuffer Device
        aa      AAlib
        xvidix  X11 (VIDIX)
        cvidix  console VIDIX
        null    Null video output
        mpegpes Mpeg-PES to DVB card
        yuv4mpeg        yuv4mpeg output for mjpegtools
        png     PNG file
        jpeg    JPEG file
        tga     Targa output
        pnm     PPM/PGM/PGMYUV file
        md5sum  md5sum of each frame

Last edited by ComputerGreek; 02-01-2008 at 07:47 PM.
Old 02-02-2008, 04:16 AM   #5
Registered: Sep 2007
Posts: 152

Original Poster
Rep: Reputation: 30
I forgot the audio out:

mplayer -ao help
Available audio output drivers:
        oss     OSS/ioctl audio output
        alsa    ALSA-0.9.x-1.x audio output
        arts    aRts audio output
        esd     EsounD audio output
        jack    JACK audio output
        sdl     SDLlib audio output
        mpegpes DVB audio output
        null    Null audio output
        pcm     RAW PCM/WAVE file writer audio output
Old 02-03-2008, 04:09 AM   #6
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
seriously, that's really not useful...
Old 02-03-2008, 10:39 AM   #7
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
I agree. Add this to the wiki or to the Tutorials section, but just copy/pasting things to LQ's main area doesn't really help. I've closed this as the main board isn't the place for tutorials.

Incidentally, this gives excellent install instructions for mPlayer.

Last edited by XavierP; 02-03-2008 at 10:40 AM.

Closed Thread

audio, codec, mencoder, mplayer, pipe, video

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
fast mp3 encoder to re-encode files before transfering to portable player bricedebrignaisplage Linux - Software 1 08-16-2007 07:37 PM
DVD movie player Linux31 Fedora 1 03-03-2006 08:43 PM
Mplayer=useless? I need a DVD player and other video playback support servnov Linux - General 6 12-27-2005 01:13 PM
Every DVD Player Fails to Play DVD Movie in SuSE 9.2 Pro....Please Help ! ! ! bedi-beparwah SUSE / openSUSE 2 03-14-2005 07:08 PM
DVD movie player that works? confused_bof Linux - Software 6 03-05-2005 05:25 PM

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration