Mplayer is perhaps the most popular multimedia program in the open source world. The reasons why it is so popular are the versatility, portability and large number of supported formats, drivers and codecs. This guide covers installation, configuration, and basic options.
1. Installation
Download the source, configure and install it. A suitable place for mplayer sources would be / usr / src / or / usr / local / src. so:
its root [enter password] cd / usr / src svn checkout svn: //svn.mplayerhq.hu/mplayer/trunk mplayer
For the second command to work you need subversion. If it worked, a new mplayer directory was created.
cd mplayer
The ./configure command follows, along with specific options. Some options:
options:
--prefix = DIR installation directory [default: / usr / local]
--codecsdir = DIR directory for binary codecs
--win32codecsdir = DIR directory for windows DLLs
--xanimcodecs = DIR directory for XAnim codecs
--realcodecsdir = DIR directory for RealPlayer codecs
--disable-mplayer does not compile mplayer but only mencoder
--disable-mencoder does not compile mencoder but only mplayer
--enable-gui compile GMPlayer [gtk + gui]
--language = ro select the Romanian language for messages and for the GUI
--charset = charset converts messages to the specified character set
--enable-color-console colors the output from the terminal
In principle, the rest of the options are self-detected, for details run
./configure --help
We must take into account one more thing:
This configure script is NOT autoconf-based, even though its output is similar. It will try to autodetect all configuration options. If you –enable an option it will be forcefully turned on, skipping autodetection. This can break compilation, so you need to know what you are doing.
This explains why sometimes, especially with -enable-gui, the compilation stops with error, seemingly inexplicable. Finally, we assume some harmless options:
./configure --language = en --enable-color-console
These options result in an output like the one in the screenshot:
If all went well, there are only 2 steps left for installation:
make make install
Now you have a new mplayer installed in the system. It's time to give up root. If you used 'su root', press CTRL + D.
2. Configuration
Next is the creation of the ~ / .mplayer directory, where we will keep the configuration file and the symlink to the preferred font, which will be used to display the subtitles and the OSD.
cd ~ mkdir .mplayer
For the font we can proceed in several ways. An option would be, for example:
ln -sf /usr/share/fonts/dejavu/DejaVuSans.ttf ~ / .mplayer / subfont.ttf
Replace the Deja Vu font with any other font you find there. Another option: create a .fonts directory, in which to store your favorite fonts, such as microsoft ttf fonts:
mkdir ~ / .fonts cp /calea/spre/fonts/Arial.ttf ~ / .fonts ln -sf ~ / .fonts / Arial.ttf ~ / .mplayer / subfont.ttf
The configuration file remains. Open the ~ / .mplayer / config file with your favorite editor (if it doesn't exist, create it). It could look like this (I put the explanations for each line in parentheses):
~ / .Mplayer / config
# Write your default config options here!
subcp = cp1250 (For subtitles with diacritics)
subfont-text-scale = 3.25 (Sets the subtitle font size; you can experiment with this value)
ao = alsa (Select ALSA for audio output)
af = volnorm (Select as audio filter volnorm - sound normalization)
For a complete list of possible options run in the terminal:
mplayer -vo help (list of available video drivers: x11, xv, gl, etc ..)
mplayer -ao help (list of available audio drivers)
mplayer -vf help (list of video filters)
mplayer -af help (list of audio filters)
mplayer -vc help (list of video codecs)
mplayer -ac help (audio codec list)
Now you already have a fully functional mplayer.
3. Examples of use
To play a multimedia file (eg a movie):
mplayer movie.avi -sub subtitrare.srt
For movies with soundtrack in several languages:
mplayer movie (twin audio) .avi
The output in the terminal will be:
Video stream found, -vid 0 Audio stream found, -aid 1 Audio stream found, -aid 2
Select the desired audio stream:
mplayer -aid 1 movie (twin audio) .avi
You can also add the line in ~ / .mplayer / config:
alang = en
for mplayer to always select the soundtrack in english.
Video filters:
mplayer -vf rotate = x movie.avi
x = 1: rotates the image 90 degrees to the right
x = 2: rotates the image 90 degrees to the left
Flip, Mirror:
mplayer -vf flip movie.avi mirrors the image vertically mplayer -vf mirror movie.avi mirrors the image horizontally
Changing the dimensions:
mplayer -x 640 -y 480 movie.avi
Scales the image to the specified size. Very useful for wrong size movies.
4. Mencoder
mencoder supports all filters and codecs used by mplayer and is an extremely powerful tool for video encoding. Usage example:
mencoder -oac copy -ovc lavc -lavcopts vcodec = mpeg4: mbd = 2: trell -ffourcc divx movie.avi -o output.avi
-oac copy - mencoder will copy the audio stream without modifying it
-ovc lavc - use libavcodec - the best existing codec
-lavcopts vcodec = mpeg4: mbd = 2: trell
I invoked the mpeg4 codec with the parameters:
mdb = MacroBlock Decision: mdb = 0 is the default,
mdb = 1 will use the fewest bits,
mdb = 2 selects the macroblock mode with the best distortion rate.
trell = Trellis quantization
-ffourcc divx: Put the divx tag on the resulting video so that it is recognized by all players. xvid is good too.