LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Closed Thread
  Search this Thread
Old 01-27-2008, 05:05 PM   #1
ComputerGreek
Member
 
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/

MPlayer-1.0rc2.tar.bz2
all-20071007.tar.bz2
font-arial-iso-8859-1.tar.bz2 all from www.mplayerhq.hu
live555-latest.tar.gz from www.live555.com (currently live.2007.12.27.tar.gz)
lame-3.97.tar.gz from lame.sourceforge.net
twolame-0.3.10.tar.gz from sourceforge.net/projects/twolame
libsndfile-1.0.17.tar.gz from www.mega-nerd.com/libsndfile

cd /mplayer/

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

wget http://puzzle.dl.sourceforge.net/sou...me-3.97.tar.gz
wget http://puzzle.dl.sourceforge.net/sou...-0.3.10.tar.gz


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/ld.so.conf, with the command:

echo "/usr/local/lib" >> /etc/ld.so.conf

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
./configure
make
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:

RAW
Microsoft WAV
SGI/Apple AIFF/AIFC
Sun/DEC/NeXT AU/SND
Paris Audio File PAF
Commodore Amiga IFF/SVX
Sphere Nist WAV
IRCAM SF
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
make install

cd /mplayer/twolame-0.3.10
./configure
make
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:

ldconfig

cd /mplayer/MPlayer-1.0rc2
./configure

./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
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://address.of.site/movie.wmv (watch a "Microsoft Media Server" stream)
mplayer rtsp://address.of.site/movie.wmv (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://address.of.site/movie.wmv -ovc copy -oac copy -o output.avi
2) mencoder rtsp://address.of.site/movie.wmv -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 04:23 PM. Reason: pages good, site bad
 
Old 01-28-2008, 10:56 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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, 04:09 AM   #3
ComputerGreek
Member
 
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, 06:45 PM   #4
ComputerGreek
Member
 
Registered: Sep 2007
Posts: 152

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

mplayer -vo help
Code:
                                                                                                      
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 06:47 PM.
 
Old 02-02-2008, 03:16 AM   #5
ComputerGreek
Member
 
Registered: Sep 2007
Posts: 152

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

mplayer -ao help
Code:
                                                                                                      
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, 03:09 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
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 09:40 AM.
 
  


Closed Thread

Tags
audio, codec, mencoder, mplayer, pipe, video



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 06:37 PM
DVD movie player Linux31 Fedora 1 03-03-2006 07:43 PM
Mplayer=useless? I need a DVD player and other video playback support servnov Linux - General 6 12-27-2005 12: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 06:08 PM
DVD movie player that works? confused_bof Linux - Software 6 03-05-2005 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:37 PM.

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