I finally figured out how to install new codecs on Mplayer. Once you figure it out, it seems easy, but the documentation out on the Web is confusing and sometimes applies to other circumstances. I finally asked for help on the #mplayer channel on IRC and was given some clear answers. Hope this can help the newbies. I wonder if this post belongs in "success stories"? But then people seeking help with Mplayer wouldn't look for it there.
This post applies to you if you use the Mplayer program to play video (or audio) files, and Mplayer does not properly recognize or play a file that you have. You might have an old version of Mplayer, but you don't necessarily have to install a new version; just install the newest set of codecs. A codec is a set of instructions that tell how to play a video/audio file.
You can get the newest codecs from
http://www.mplayerhq.hu/homepage/design7/dload.html (under the Codecs section). That gets you a .tar.bz2 file that contains a bunch of codec files. Use the "tar" command to extract those files to a directory. (Explaining the tar command is left to others, although I think the command is "tar -jvxf <the_filename>".) There are other ways to do this, too, like through Konqueror if you are using KDE.
Anyway, now you have a bunch of files. Where do you put them? The key to the whole thing is: you put them in the directory "/usr/local/lib/codecs". To do this, you need to be root, so sign in as root or use the "su" command. If that directory does not exist, create it with
mkdir --parents /usr/local/lib/codecs
and then move your files into that directory.
You have to make sure that the bunch of files (for example, "divx.dll" and "qtmlClient.dll" etc.) are actually in that directory itself, not in a subdirectory, and not in other places.
That's it! But I'll point out some things that did confuse me:
You might read other web pages that suggest putting the files somewhere else. Be careful: some of the instructions are for how to *compile* Mplayer, but you probably don't need to do that: Mplayer should be able to load codecs when it is run ("run-time loading"), even if they weren't already built-in when compiled. To check this, you can try:
mplayer -vfm help
which should list all of the available codecs. Look for any "(win32 codec)". These are guaranteed not to be compiled in, so if you see any, then your version of Mplayer is able to do run-time loading. You might want to use "mplayer -vfm help | grep win32" if the list scrolls by too quickly.
Another helpful hint: when you run Mplayer with the -v option, such as
mplayer -v MyVideoFile
it tells you where it looks for codecs. (It also tells you a whole bunch of other stuff, so you have to sift through for the info you need.) Here's part of what Mplayer replied:
Win32 LoadLibrary failed to load: wmv9dmod.dll, /usr/lib/win32/wmv9dmod.dll, /usr/local/lib/win32/wmv9dmod.dll
So, for that particular file, it was looking for the codec "wmv9dmod.dll" under "/usr/lib/win32/" and "/usr/local/lib/win32". Hmm, that's a different directory from what I had just said. Anyway, now you know where to put the codecs and what codec you need to play that particular file.
Hope that helps!