Using and Tweaking MPlayer
You can start MPlayer as a command line program with mplayer. Invoke the GUI with as gmplayer. The GUI is mostly self explanatory, but the command line options have some magic to explain.
- To open a file, use the command:
- To open a file with subtitles (such as divx), use the command:
mplayer filename -subfile filename.sub
- To open a VCD track, use the command:
mplayer -vcd <trackno>
- To play a DVD in almost any environment, using Vesa mode, use:
mplayer -o vesa -cache 8192 -fs -dvd <trackno>
- If your hardware is not fast enough and the movie skips, use the command:
- To list the available codecs, use the command:
mplayer -vc help
The main MPlayer config file is
~/.mplayer/config. This file has comments for every function. The defaults are usually fine, but you can tweak a few things. MPlayer stores key bindings in
~/.mplayer/input.conf. You can edit them extensively, but remember: first backup, then play it safe. The syntax is very simple and needs no explanation.
MPlayer also has several special command-line options to deal with weird media file behavior. Suppose that you have a Divx in Japanese but the subtitle track is not synchronized with the video; one has 25 fps and the other 23, meaning the film follows the subtitle. This command should solve your problem:
mplayer <filename> -subfile <filenmame.sub> -subfps 25
A worse case is where the movie is badly encoded and the audio can never catch up with the video. This boring case could ruin your precious Sunday afternoon if it were not for MPlayer. You can solve this problem by delaying the video slightly:
mplayer <filename> -delay <secs>
Both delays may be negative.
Suppose you have a file encoded with codec X, but MPlayer wants to play it with codec Y. You can force MPlayer to use a certain codec with:
mplayer <filename> -vc <codec>
Suppose you have just started to download a conference presentation and want to know its quality before committing to 700 MB–or you just have a broken divx. This command rebuilds the divx index from scratch, so that you can jump forward and backward in the broken avi:
mplayer <filename> -idx
If the avi still does not display, try these options with different configurations:
-nobps -ni -mc0 -forceidx -nocache
A decent media player is one of the prerequisites of a good desktop. Sometimes you may want more than that. For example, you may have backed up the hard-to-watch Robotech series to the .rm format, but now you would like to watch it on your vcd player. MPlayer also has a solution for this: it can crosscode nearly all media files. If you have compiled the MPlayer package, MEncoder is also present.
The syntax is very simple. This command line encodes the basket.rm file with the libav codec (the best divx codec for both performance and quality) and the soundtrack with mp3lame.
mencoder -ovc lavc basket.rm -oac mp3lame -o basket.avi
Remember the avi file with the broken index? Instead of always using the workaround, you can permanently fix it with MEncoder. The following command rebuilds the index and copies the whole audio and video stream as they are to the output file.
mencoder -idx input.avi -ovc copy -oac copy -o output.avi
Perhaps you’d like to catenate multiple avi files into one single file. Provided they use the same codec and have the same bitrate, this is also easy. It’s back to Unix roots:
cat 1.avi 2.avi | mencoder -noidx -ovc copy -oac copy -o output.avi -
I’ll not go into much detail here, because MPlayer and MEncoder have more options than I can describe in this article. Enjoy these rich programs and experiment with the settings.