Video Codecs and the Free World

How codecs are hurting multimedia, how Linux is dealing with it, and why free codecs can save it.

Few video producers ever would have guessed that the term codec would become a household term, but with so many codecs on the market, average computer users have little choice but to be painfully aware that if their computer does not have the correct codec installed, they will not be able to view their favorite Web or DVD video content. Therefore, any computer enthusiast, professional sysadmin or video producer should be familiar with codecs, why they exist and how to deal with them.

The term codec is a combination of two words: code and decode. The concept is simple; if I had only one page of paper upon which I wanted to write two pages of content, I might write a note in some kind of code, leaving out certain letters or words. This would fit the content onto the one page allotted, but it would make no sense to intended readers, unless I gave those readers a key on how to decode the writing so they could piece it all back together and understand what had been written. This is precisely what a codec does with video.

Ideally, a codec effectively delivers high-quality video to end users in a reasonable amount of download time. However, large companies often opt to use a codec for its exclusivity so they can charge for the key to decode that video, such as with DVDs and streaming video. So the reason that many codecs exist at all is not to further the quality and effectiveness of video compression and delivery, but to hinder delivery to the nonpaying audience—sometimes even at the expense of video quality.

Acquiring the Right Codec

End users, system administrators and video content producers are all affected by codec compatibility and availability. Being familiar with codecs is important, as computers are now the hub of many people's entertainment centers.

A missing codec typically affects the entire system. If, for example, Xvid is not installed on the system, Xvid will not be available for Web browsers, media players or media editors. Install the Xvid component, and all of the applications on a GNU/Linux system will recognize it and utilize it when needed.

With proprietary software, even though a system has a codec installed, proprietary applications may not utilize the codec, simply because it has been programmed not to use the codec for political reasons. There is no practical reason, for instance, that Digidesign's Avid or Apple's Final Cut Pro cannot recognize and edit Ogg files, especially given the price tags of these applications.

Keep in mind that there is a difference between a codec and a file format. File formats, such as .mp4, .mov or .avi, are actually just containers for video and audio streams. So an .mp4 file, for example, may use a codec like Xvid, h.264, x264, Decklink and so on, or it may, in fact, use the actual MPEG-4 codec (or any number of other codecs). Although the system usually can detect the actual codec being used within a file, it may confuse the user if a file format (container) is taken to be the same thing as a codec (encoder).

Most systems come with a certain amount of codecs ready to use with the OS's default Web browser and media player. Apple and Microsoft bundle their own proprietary and supported codecs with their systems, and Linux distros distribute their supported open-source codecs. Still, in all three cases, end users or system administrators are going to have to download non-bundled and unsupported codecs at some point.

On today's systems, acquiring codecs often is reduced to a few clicks of the mouse. The smoothest experience for end users may easily be on the Linux desktop, as distributions, such as Ubuntu, Linspire, Fedora and OpenSUSE, are so sensitive to the Linux-doesn't-play-media preconception that they have made it almost automated.

To get a codec to watch DVDs on your Linux machine, simply place a DVD into the computer, and the default player opens (such as Totem or Kaffeine or Xine). If an MPEG-2 decoder is not installed already, the system offers to download and install it. A few clicks of the mouse, and the codec is installed, and the movie player, usually without so much as a relaunch, plays the DVD.

Similarly, most Web browsers will detect a missing codec and either direct users to the Web site containing the downloadable installer for the codec, or, even better, the system will intervene and offer to download and install the package automatically. Again, with a few clicks of the mouse, the codec is installed and ready to enable the video in the browser.

If the Web browser attempts to play a video without the proper codec installed, there are cases where the only feedback the user will get is a blank space where the video should be. You can, however, easily force the system to prompt for a codec download.

First, right-click on the empty space in the browser where the video should be playing, and open that movie (it may be missing sound and picture though) in your distro's default movie player. When the system's media player is unable to play the video, it will offer to find the appropriate codec and install it.

If the Linux system does not recognize the codec being used, or if your distro of choice does not offer an automated codec solution, you can do a little detective work and discover what codec you need to find and install it manually.

This kind of codec forensics is most easily done with VideoLAN's VLC player; it's free, open source and prepackaged for most popular Linux distros. Once you've installed VLC player on your system, open the movie you want to play. Most likely, VLC will play the video, but if you still need to discover its codec so that the video can play on your system outside the VLC player, go to the View menu and select Stream and Video Info. This opens a comprehensive list of the streams (video, audio, timecode, subtitle and so on) contained in the file and what codec was used in creating each stream.

Armed with this information, go back to your distribution's package manager, and search for the codec that VLC has revealed is being used. Or, if you are running Slackware or Gentoo or something similar, seek out the codec on-line. A typical open-source solution will be a GStreamer package, containing a number of open-source decoders for popular proprietary codecs. Again, these can be installed either via your package manager or manually.

If you are trying to achieve in-browser playability, be aware that sometimes a decoding package, such as Flash, will be specific to the Web browser in which you are trying to view video. So, take care to install the correct package for compatibility with your browser (Firefox, Konqueror, Opera and so on).

After you've installed the codec, relaunch your browser if necessary, and try to play the video again.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

In later version of ffmpeg

Fanta's picture

In later version of ffmpeg you need to prefix
the video codec with lib

e.g libxvid and not xvid

great explanation

Anonymous's picture

This whole codecs business always felt like a big scam to me, and now I know why- because it is! Thanks for a detailed and helpful article.

Video Codecs

Anonymous's picture

Yes i agree! I would be also happy, if you have explained which kind of video codec is best in current scenario. e.g H.264, MPEG-4, xvid etc

for instance i came across to one blog called: video codecs :pros & Cons

Video codecs

alphakamp's picture

Video codecs in linux and windows have always been a hassle for me. I go so far as to not even bother unless the video format is flash. As far as DVDs I'll put it in a regular DVD player thank you.

As far as DVDs I'll put it

Torres's picture

As far as DVDs I'll put it in a regular DVD player thank you.

Yes it is true.