One of the caveats that many people have with using Linux is the current state of media support. While media playback on Linux is presently much better than it has ever been before, it still requires a little bit of know-how and tweaking to get everything working properly. This guide will go over each step of optimizing your media capabilities.
The reason why some types of media do not work out of the box on Linux is due to legal and technological reasons. Many of the popular media formats (like DVD, MP3, Adobe Flash, etc.) require a codec, DRM workaround, or other sort of player before content in any of those formats can be viewed. Because of patent and copyright law, Linux distro maintainers are not able to include these extra packages in their distros, so media performance is somewhat crippled as a result. Some distros actually license these codecs (e.g. Mandriva's Codina tool) and have working media support out of the box. However, such features are not free and many people balk at the notion of paying for Linux. If it provides any reassurance, it helps to know that this problem is not specifically limited to Linux. Windows XP and some of the low-end editions of Vista are unable to play DVDs out of the box as well, and no version of Windows offers out of the box Blu-Ray support.
Even if you have the requisite codecs, you may still be hindered if the file you are trying to play is protected by strong DRM. Many people have gotten burned over the years by DRM-encumbered media that has a built-in time limit, requires a special player, or must “phone home” for license confirmation each time you want to play it. The last method is especially bad, since you will no longer be able to view the files you are legally entitled to if the media company suddenly shuts down the authentication server; this has happened several times in the past and customers were left high and dry in all instances. Aside from breaking the copy protection (which requires some skill in most cases in addition to being technically illegal thanks to the infamous Digital Millennium Copyright Act) there is little you can do in such instances except hate the media companies that insist on such strong measures.
On the other hand, Linux is capable of playing unencrypted DVD video (like discs you make yourself) and various open audio formats like OGG Vorbis and FLAC (Free Lossless Audio Codec) out of the box. CD audio and WAV also work without any tweaking. Most distros include a wide assortment of players that can handle almost any kind of media when properly configured.
Although most distros are not able to ship codecs for every type of media out of the box, these codecs are relatively easy to come by from both official and unofficial sources. To facilitate ease of installation, virtually every codec is stored in a package that can be handled by a distro's package manager.
The media feature that is essential to most people is DVD playback. Virtually every retail DVD sold off the shelf contains a fairly weak (by today's standards) 40-bit DRM encryption scheme called Content Scramble System, (CSS) meant to prevent unauthorized disc reproduction. CSS relies on decryption through keys located on a non-copyable area of the original disc, (the lead-in area) so any homemade copies made from the original disc will not have the keys necessary for decryption and will therefore be unwatchable. CSS-protected video is almost completely obscured by extensive multicolored blocking and artifacting when viewed without a means to decrypt it. (interestingly enough, the audio tracks are unprotected and may still be listened to)
Every standalone hardware DVD player or the various proprietary DVD player software programs (like PowerDVD) are capable of decrypting CSS so the video may be displayed properly. Doing this legitimately requires licensing various patents and key sets from the DVD Copy Control Association, so free software was mostly left out in the cold in the early years. As a consequence, it used to be impossible to watch (much less copy) DVD video on Linux, and the only reliable way to replicate DVD video back then was through analog capture. Several years ago, John Lech Johansen, working with other people who have never been identified, released a program called DeCSS that used a rather simple algorithm (the functional code of DeCSS can fit on a t-shirt) to break the CSS copy protection through a brute-force attack.
After the inner workings of DeCSS became widely understood, many derivatives of it became available, mainly to survive eradication attempts on the part of the media companies through sheer redundancy. While few systems still use the original DeCSS, the most common DVD decryption module for Linux systems is now libdvdcss2. Whereas the media companies fought aggressively against DeCSS, libdvdcss2 has largely been left alone.
Unlike DeCSS, (which relies exclusively on brute force) libdvdcss2 includes a pool of potential keys that are tested until a working one is found; if none of the keys work then brute force is used instead. Brute-forcing strong encryption is usually pointless, but today's computers can break the weak CSS encryption in anywhere from a few seconds to a few minutes.
Many players (like VLC) rely exclusively on libdvdcss. Once you install it for one player, it should work for all of them since it is a shared library. For Ubuntu, the package you need is called libdvdcss2. You can install libdvdcss through Ubuntu's libdvdread package, which is available in the main Universe repository. This method will acquire libdvdcss from the Medibuntu (the multimedia-focused variant of Ubuntu), make a package out of it for easy management, and then install it. To do this, you need only follow this procedure:
1. For Ubuntu 9.04 and up, run “ sudo apt-get install libdvdread4 ”. For older versions of Ubuntu, use the libdvdread3 package instead of libdvdread4.
2. After the libdvdread4 package has been installed, open a terminal and run “ sudo /usr/share/doc/libdvdread4/install-css.sh ”. For libdvdread3, you should use “ sudo /usr/share/doc/libdvdread3/install-css.sh ”.
3. Your computer should now be able to play encrypted DVDs with any player that uses libdvdcss2.
Alternatively, you have the option to install the libdvdcss2 package manually. The actual libdvdcss2 package is not found in the standard Ubuntu repositories, (in the first method, you make the package yourself) but can be found in third party locations like the Videolan repository. To enable this resource in apt-get, do the following:
1. open /etc/apt/sources.list with your favorite text editor (sudo/root is required to save changes)
2. add “ deb http://download.videolan.org/pub/videolan/debian sid main ” as an entry in the sources.list file. Make sure it is all on one line and there are no line breaks. Although the version of libdvdcss in that repository is for Debian's unstable branch, it will work fine in Ubuntu 9.04 and older.
3. Save the sources.list file.
4. Run “ sudo apt-get update ” to refresh the package list and make libdvdcss2 available for download.
5. Run “ sudo apt-get install libdvdcss2 ”.
6. The apt-get program will warn you that the package cannot be verified. Unfortunately, there is no GPG signature for that repository listed on the developer website, so you will have to install the package without verification. (In this instance, it is safe to do so)
7. Your computer should now be able to play encrypted DVDs with any player that uses libdvdcss2.
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.
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.
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 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 ”.
As previously stated, there is an abundance of media players for Linux, but they are not all created equally. Each player is best suited for a specific purpose or situation; some are best used with (or are exclusively for) audio whereas some are best used with video.
VideoLan (or VLC Media player) is one of the most prominent open source video players, easily identified by its orange traffic cone icon. Videolan is cross-platform and is extremely versatile; it has been able to handle virtually any format that we've thrown at it over the years and is even able to play damaged files. Since VLC includes its own set of codecs for most file types, VLC supports almost everything except CSS-protected DVD playback or other DRM-encumbered media out of the box.
From our experience, Videolan works best as a movie player due to its design. Videolan readily accepts the libdvdcss2 package without requiring any additional configuration. Once DVD decryption is installed, VLC has nice features that automatically skip various undesirable DVD features that you would normally be forced to watch on most other players. (the pointless FBI warning nag screens, trailers and other assorted advertising, etc.) Videolan also has the capability to bypass menus and jump directly to the main feature of a DVD. The playlist functionality could be better than it is, but the program's sheer power and ease of use more than makes up for it.
Videolan also has many powerful under-the-hood tools and features that many advanced users would like, including sophisticated post-production tools and streaming capability. Some people have reputedly have had stability problems with it, but it has always worked well from our experience. With that said, Videolan is easily one of the best media players for Linux and should be your first or second pick.
To install Videolan in Ubuntu, run “ sudo apt-get install vlc ”.
Mplayer is another of the best players available for Linux and other operating systems. Once libdvdcss2 is installed properly, Mplayer is able to play practically anything. Like Videolan, Mplayer has the ability to skip DVD nag screens and trailers and can go right to the main feature. (unlike Videolan, this is Mplayer's default behavior) For convenience, many of the most important functions of mplayer are automatically bound to hotkeys, which eliminates much of the need to use the menu system.
Mencoder, Mplayer's companion program, is also quite useful. Many other open source multimedia tools like Acidrip and DeVeDe use it to convert video from one format to another, like DivX to MPEG2.
To install Mplayer in Ubuntu, run “ sudo apt-get install mplayer ”.
Kaffeine has been KDE's main video player for several years now. (A very trimmed-down alternative called Dragon Player has mostly taken over Kaffeine's role in KDE4) Kaffeine occupies the mid-range in terms of features—while not quite as versatile or powerful as Videolan or Mplayer, Kaffeine offers more functionality than far simpler alternatives like the new Dragon Player. Kaffeine uses Xine as a backend.
Kaffeine is a multi-function player, in that it can handle many different kinds of media in addition to being able to rip and encode audio. It can play retail DVD, (with libdvdcss2 installed) unencrypted DVD, Video CD, Audio CD, and more. Kaffeine is capable of automatically retrieving codecs as you need them, so you will very seldom have to do so yourself.
To install Videolan in Ubuntu, run “ sudo apt-get install kaffeine ”.
Amarok is regarded by most to be one of the best (if not THE best) audio players for Linux. It has support for MP3, FLAC, OGG, WAV, WMA, etc in addition to built-in access to various streaming Internet radio resources. Amarok currently exists in two versions: The original “classic” amarok and the new Amarok2 that ships with KDE4. Either version will suffice for those who want a powerful audio player with close KDE integration.
Like Kaffeine, Amarok uses Xine as a backend. Ogg Vorbis and FLAC are supported out of the box, and MP3 playback can be enabled by installing the libxine1-ffmpeg package, as previously stated. Unlike other players, amarok is heavily dependent on the KDE architecture due to its integration; installing Amarok requires that large portions of KDE be installed as well. Basically, if you are going to install the player, you may as well install the whole desktop environment along with it.
To install Amarok in Ubuntu, run “ sudo apt-get install amarok ” (messy way, since you're installing an incomplete KDE) or run “ sudo apt-get install kubuntu-desktop ”. (clean way)
Audacious is designed for those who prefer a more minimalistic media player. Audacious has its own codec pack, which means that it can support MP3, FLAC, Ogg Vorbis, AAC, etc. out of the box and has various visualization and effects as well. Audacious is the latest incarnation of a whole series of media players: Audacious was derived from Beep Audio Player while Beep was derived from XMMS while XMMS was a clone of the original Winamp 2.x for Windows. As such, Audacious is virtually identical in function to its predecessors; even skins originally written for Winamp 2 “Classic” (and there are plenty of those) are fully compatible with Audacious.
To install Audacious in Ubuntu, run “ sudo apt-get install audacious ”.
Rhythmbox is GNOME's answer to Amarok, with one of the key differences being that Rhythmbox is built on Gstreamer rather than Xine. Rhythmbox has most of Amarok's features, including audio disc ripping/burning, internet radio (including last.fm), support for MP3/FLAC/OGG Vorbis, automatic podcast retrieval, etc. In addition to that, Rhythmbox has built-in Ipod support and integration with Jamendo and Magnatune.
If you're using the GNOME desktop environment, Rhythmbox is probably already installed on your system. Pure Kubuntu users should run “ sudo apt-get install ubuntu-desktop ” to get Rhythmbox, since it depends on most of GNOME and you may as well install the whole thing.