There are some lean movie players on linux (such as codeine), but the ultimate in lean is mplayer. There is of course a gui for mplayer, but if you want to use mplayer as it was intended, you need to run it from the command line.

starting a video or dvd

So how to play a video in mplayer? To play a file, just type mplayer followed by the path to the video file you want to play:

mplayer /path/to/file.avi

If you want to play a dvd, things are a bit different. mplayer doesn’t do dvd menus. So you have to point to the main video file on the dvd. Usually track 1 on the dvd. So type this into a terminal:

mplayer dvd://1

keyboard/mouse control

The best way to control mplayer is with the keyboard. This gives you a whole lot of power and control over the video, without having silly control buttons taking up precious screen real estate. Here are some useful keys/mouse controls:

  • f – toggle fullscreen
  • q – quit
  • space,p – pause
  • j – rotate through subtitiles
  • right/left – skip forward/back 10 seconds
  • up/down – skip forward/back 1 minute
  • pg up/pg down – skip forward/back 10 minutes
  • scroll wheel – skip forward/back
  • <> – skip to next/last file in playlist
  • 9/0 – decrease/increase volume
  • +/- – tweak A/V sync by 100ms
  • T – toggle window on-top

video playback tips

sluggish/jerky dvd playback

If your dvd playback is slow or jerky, add the cache and cache-min options to the command line like this:

mplayer -cache 8912 -cache-min 4 dvd://1

This means that you will have an 8MB cache, which should be plenty for a dvd. It will also fill the cache to 4% before starting, and the buffer should build up from there.

normalise the volume

Adding -af volnorm to the command line will maximise the volume of the audio track, without distorting.

widescreen fullscreen

If you’ve got a widescreen monitor/laptop, you can avoid aspect ratio distortion by setting the command line option -monitoraspect 16:9.

pretty subtitle fonts

You can specify the true-type font used for subtitles by copying a true-type font to ~/.mplayer/subfont.ttf. For example if you want to use bitstream vera sans, copy bitstream vera sans like this:

cp /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf ~/.mplayer/subfont.ttf

subtitle font size

If your subtitle font is too big/small, play with the -subfont-text-scale option. For example:

mplayer -subfont-text-scale 3 /path/to/file.avi

video output

You can change the video output to those which are supported by your video with the -vo option. To see what is supported, type:

mplayer -vo help

The most useful options will be xvx11gl and gl2. The best option is usually xv, however, sometimes this gets a bit funky with xgl/aiglx/beryl/compiz. If that happens, try x11. Bare in mind, x11 won’t allow you to change the size of the video, unless you add the -zoom option:

mplayer -vo x11 -zoom /path/to/file.avi

seeking un-seekable files

If you come across an avi file that won’t seek when you use the left/right/up/down keys, you can add the -idx option to make it seekable.

mplayer config

Instead of adding options willy nilly to the command line, you can set most of this stuff up in a config file, which mplayer uses as its default settings. Bear in mind that the config file options can be overridden by command line options. The config file is stored at ~/.mplayer/config. This is a reasonably generic config file that should work for most people:

#General setup
ao="alsa" #audio out
really-quiet="1" #Very very little console output
vo="xv" #video out
zoom="1" #Allow sofware scaling if you use x11 for vo from the commandline
aid="1" #audio channel
sid="0" #subtitle set
double="yes" #double buffering(recommended for subtitles)
monitoraspect="16:9" #Use for a widescreen laptop so keeps 4:3 content from stretching
framedrop="1" # For slow machines
hardframedrop="0" #Make sure hard frame drop is off but can turn on easily now
#subtitle code
#set this if you haven't copied your preferred font to ~/.mplayer/subfont.ttf
ffactor="10" #black outline
sub-bg-alpha="0" #background color ala closed captions
sub-bg-color="0" #black to white
subfont-text-scale="3.7" #truetype font scaling
subfont-blur="1" #Slight blur
#This sets the postprocessing into overdrive using all possible spare cpu cycles to make the movie look better
subpos="90" #By default subtitles are too low
#turns off xscreen saver...sometimes
#Some extra stuff you may want to try.  Remove "#'s" to activate
#Fix A/V sync problems on files with bad MP3 VBR audio

wierd stuff

If you want to play movies in ascii art, check out this article.