Text

Sunday, April 16, 2006

How to get mplayer working on Ubuntu 5.10

  1. Add "multiverse" into your repository of packages.
    1. Edit "/etc/apt/sources.list"
    2. At the line that starts with "deb http://au.archive.ubuntu.com/ubuntu breezy", make sure this is followed by the following: "universe main restricted multiverse". So the line should read as: "deb http://au.archive.ubuntu.com/ubuntu breezy universe main restricted multiverse".
      • Note: if you didn't have "universe" in your original line, congrats! You now have access to a much wider range of applications!
    3. Run the following to update your repository: "sudo apt-get update".
  2. Next, determine which mplayer you need.
    1. Run "apt-cache search mplayer" to give you a list of mplayer packages.
    2. The packages of interest I got were:
      1. mplayer-386 - The Ultimate Movie Player For Linux
      2. mplayer-586 - The Ultimate Movie Player For Linux
      3. mplayer-custom - The Ultimate Movie Player For Linux
      4. mplayer-k6 - The Ultimate Movie Player For Linux
      5. mplayer-nogui - The Ultimate Movie Player For Linux
    3. For each you can use "apt-cache show" to read its description. The description ends with a note saying which CPUs the particular package is for. For my case, I chose "mplayer-k6" as I am running a Duron.
      • If you cannot find a package that is specifically built for your CPU, use "mplayer-386".
  3. Install your selected mplayer package. Assuming my case: mplayer-k6. We will also install "mplayer-fonts" for fun.
    1. Run the command "apt-get install mplayer-k6 mplayer-fonts"
  4. Test on a mpg/avi file. Assuming we have the file "~/pom.avi". Note: "pom" not "porn".
    1. Run the command "mplayer ~/pom.avi"
    2. While it's running, press "f" for fullscreen.
      1. Gah! No full screen?
  5. Edit the file "~/.mplayer/config". I'm not sure if the "~/.mplayer" directory is created on install or on the first time you run mplayer. That's the reason for the "testing" step. :) Put the following in:


    # Specify default video driver (see -vo help for a list).
    vo=xv,sdl,x11

    # Specify default audio driver (see -ao help for a list).
    ao=alsa,oss,sdl,esd,arts

    # Drop frames to preserve audio/video sync.
    framedrop = yes

    # get a default OSD font from fontconfig
    fontconfig = yes
    font = "Sans"
    subfont-text-scale = 3

  6. Now rerun the earlier test and see if "f" for fullscreen works.
  7. Now try a WMV file.
    1. Get one from http://www.wimp.com. Just stop the browser from trying to load the video and use the "download" link to get the file.
    2. Assuming you downloaded "whatever.wmv" on to your Desktop, run "mplayer ~/Desktop/whatever.wmv".
    3. You'll probably have mplayer crash like mine did.
    4. Kill it by opening another terminal and running "pkill mplayer".
  8. Get CODECs for mplayer.
    1. Goto "http://www.mplayerhq.hu/design7/dload.html"
    2. Download "essential codecs package"
    3. Untar its contents. Assuming the file you downloaded is "essential-20050412.tar.bz2.tar" and your command promt is in the directory containing that file, run the command "tar jxvf essential-20050412.tar.bz2.tar"
    4. Enter the directory: "cd essential-20050412"
    5. Read the README file: "cat README" to determine where to copy the codecs. The file says that for prebuilt codecs, this is "/usr/lib/codecs". If that doesn't work, try "/usr/lib/win32", and maybe "/usr/local/lib/win32".
      • You need to use "sudo" when making /renaming those directories.
      • You also need to run mplayer from outside of the directory containing all the codecs. As I found out, my first test worked only because mplayer found the codec it needed in its working directory.


Short version for a Duron CPU, and codec directory "/usr/lib/win32"


sudo emacs /etc/apt/sources.list
# add "multiverse"
sudo apt-get update
sudo apt-get install mplayer-k6 mplayer-font
if [ ! -f ~/.mplayer/config ]; then mplayer; fi
emacs ~/.mplayer/config
# add the text below

# START TEXT ############################

# Specify default video driver (see -vo help for a list).
vo=xv,sdl,x11

# Specify default audio driver (see -ao help for a list).
ao=alsa,oss,sdl,esd,arts

# Drop frames to preserve audio/video sync.
framedrop = yes

# get a default OSD font from fontconfig
fontconfig = yes
font = "Sans"
subfont-text-scale = 3

# END TEXT ##############################

wget http://www1.mplayerhq.hu/MPlayer/releases/codecs/essential-20050412.tar.bz2
tar jxvf essential-20050412.tar.bz2
sudo mkdir /usr/lib/win32
sudo cp essential-20050412/* /usr/lib/win32/.