Complete Guide to Playing Movies and Music on Linux
MP3 Playback
Unlike DVD playback, (which requires only a single library to work) Linux applications routinely use several different engines to provide MP3 playback, the most important ones being Gstreamer and Xine. Once you add support for one engine, all programs that rely on that engine will have support as well. Both Gstreamer and Xine use fffmpeg, which is a program that can convert audio (and video) from one format to another, so the various audio backends use it to process MP3.
Gstreamer is a codec set routinely used for GNOME-based players like Totem. While Totem is able to play open formats out of the box, it requires additional plugins to handle proprietary media formats like MP3; Without Gstreamer, some media players are only nominally functional. To enable this support, you need to install two packages: gstreamer0.10-plugins-ugly and gstreamer0.10-ffmpeg. Gstreamer0.10-ffmpeg is a plugin for ffmpeg and gstreamer0.10-plugins-ugly is the package that contains proprietary non-free media codecs (compared to the gstreamer0.10-plugins-good package which contains codecs for open media formats) for Gstreamer. On Ubuntu, both packages may be found in the Universe repository.
For players that use the Xine engine, you will need libxine1-ffmpeg package to be installed. Like the gstreamer packages, it can be found in the Universe repository.
Windows Media Formats
Playing Windows Media files has always been a tricky situation on Linux. Most Windows Media Audio (WMA) files work fine on Linux (barring any sort of DRM protection) but getting audio to work properly in Windows Media Video (WMV) is a bit harder. Mplayer currently supports WMV up through version 8, but WMV9 support is still sketchy.
Fortunately, WMV is implemented more effectively in the w32codecs package. (if you are running a 64-bit operating system, you will need the w64codecs package instead) This package cannot be found in the regular Ubuntu repositories, but can be located in those used by Medibuntu, the media-focused Ubuntu derivative. The following procedure will instruct you how to obtain the w32codecs or w64codecs package:
1. Open a terminal.
2. Run “sudo wget http://www.medibuntu.org/sources.list.d/jaunty.list --output-document=/etc/apt/sources.list.d/medibuntu.list”
3. Add the Medibuntu GPG signature and refresh your repositories: “sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update”
4. The appropriate codecs have now been installed.
Furthermore, the Medibuntu repositories also contain a working libdvdcss2 package, so once you have added the Medibuntu repository, you are able to install DVD playback capability if you have not already done so by running “sudo apt-get install libdvdcss2”. This method differs from the previous section in that you are able to acquire a working libdvdcss2 package from Medibuntu once you have configured its repository instead of assembling the package yourself.
Additional proprietary codecs like Apple Quicktime and Real are included in the w32codecs and w64codecs packages.
Adobe Flash
These days, Flash support is essential since many popular Web 2.0 services (like Youtube and Hulu) make heavy use of it. Currently, the Linux implementations of Flash are quite good, and there are several different options to choose from.
If you want to avoid proprietary software altogether, you should consider Gnash, a free open source implementation of Adobe Flash. Gnash has excellent support of typical SWF animation and offers good support for Flash Video, (flv) the current standard for online video content. However, the support for FLV in Gnash is not quite perfect yet, so some videos might have sound issues as a consequence. If your system does not have x86 CPU architecture, Gnash is your only option since the official Adobe Plugin only supports x86. To acquire Gnash and the Firefox plugin for it on Ubuntu, run “sudo apt-get install gnash mozilla-plugin-gnash”. After that, you will still need the gstreamer0.10-plugins-bad package to watch Youtube videos. (your package manager will acquire it for you, so there is no need to try to install it yourself)
For the best possible support and compatibility, you should rely on Adobe's own Flash player plugin. It has excellent support for swf and flv, with the only downside being that it is closed-source. To acquire the latest version of the flash player plugin for any distro, perform the following procedure:
1. Navigate to http://www.get.adobe.com/flashplayer
2. Select the “tar.gz for Linux” option from the list
3. Click “Agree and Install Now” when it appears
4. Download and extract the tarball (it doesn't matter where you extract to)
5. Open a terminal and navigate to the directory you extracted to. There should be two files in it: flashplayer-installer and libflashplayer.so.
6. The flashplayer-installer file is a shell script. Initiate it by running “./flashplayer-installer” or “sh flashplayer-installer”.
7. Once the script starts, press Enter to continue. Close any browser processes that are running if you have not done so already.
8. The script will ask whether it should install to the .mozilla folder in your home directory. Allow it to do so by typing “y” and then hit Enter.
9. The installation process is complete. Choose “n” to terminate the script.
MIDI Audio
MIDI audio has already had its heyday in the mid 1990s, back before MP3 audio and broadband made sharing high-quality music possible. At the time, large bulky WAV files were the only source of realistic audio, and it didn't take very many of them to fill up the small hard drives of the day (and you could just forget about transferring them over the standard 33.6kbs or 56kbs dialup) In those simpler times, synthesized MIDI renditions of songs were popular because they allowed full songs (sans lyrics) to be transferred easily over low bandwidth, and personal websites full of MIDI files were commonplace.
Even though MIDI is a mostly forgotten media format today, it still has its place. If you create or work with ringtones on your computer or are into retro/vintage gaming, it is sometimes necessary to be able to play MIDI audio on your computer. Linux does not offer MIDI playback out of the box due to its relative obscurity and fairly low demand, but it can be done through a program called Timidity.
Timidity is a program that runs as a daemon process in the background and allows other software to make use of your computer's MIDI capabilities. (most computers still have a MIDI synthesizer, although some are better than others) Timidity is not a specific player; rather, it allows MIDI to play where it is needed whether it be through a conventional media player or through a game. If Timidity is installed and the daemon is running, MIDI audio will “just work.” Timidity is able to handle MOD audio as well.
To install Timidity on Ubuntu, run “sudo apt-get install timidity”.