Google Chrome OS unveiled, released to open source community

167793638 bytes, or 167.8 megabytes. That's how big a single second of video would be without compression. Taking that to its logical extreme, a full two hour DVD would be around 150 gigabytes without any sort of compression. Obviously these file sizes make working with video for any sort of reasonable use impossible, since most people don't have terabytes of storage to deal with; so computer scientists, in their infinite wisdom, have come up with a variety of schemes to compress video. These so-called codecs allow video to be efficiently transmitted over the internet, played back on portable devices, stored on DVD and Blu-ray discs and even transmitted digitally over the airwaves. In this guide, we'll break down which compression scheme does what, and which ones users should be aware of, and how to find the right codec to play back that pesky video.

What is a codec?

Codec is a word that's short for compressor / decompressor. A codec defines a standard set of mathematic principles by which video is processed. Codecs vary in their methodology for compression, but their aim is similar: to shrink video down from 167.8 megabytes per second into something more manageable.

Most codecs work by turning a video signal into a pattern of blocks, and then defining what each block looks like. The higher quality the compression, the greater amount of blocks defined, and the higher the file size. We took a rose and dramatically showed what it might look like to a video compressor. The image on the right would be a low-quality compression job.

Obviously, there are large limits when using blocks to encode video, and that's why older video compression schemes were noted for their pixelated effect. Newer codecs account for this by creating intelligent blocks that actually move according to the video, and create variable block sizes according to the content of the video.

Which codecs do I need to know about?

Rather than run down every codec ever created (there are hundreds), we'll talk about the codecs most used by consumers, and the codecs that people should know about for moving their video from one place to another.

H.264

Potentially one of the most important codecs to date is H.264. Initially refined and published back in 2003, H.264's standards define most of the modern video compression happening on the web and on portable devices like the iPod. H.264 takes a modern approach to block definition, allowing variably-sized blocks and "smart blocks" that move with the video. As a result, videos encoded in H.264 don't suffer from the same artifacts as videos produced with older codecs.

H.264 is a lossy standard, which means H.264 looks at each frame of video and decides what important parts to keep, while other less important parts get discarded. As a result, H.264 is a great way for most consumers to save video, but professionals who long for every bit of quality don't find H.264 an adequate "archival" codec. That being said, H.264 is so efficient many people can't distinguish a difference between H.264 video and other lossless standards.

H.264's big use is video on the web. Most video that is distributed in iTunes is H.264, and web-video services like YouTube are converting most of their collection over from the proprietary Flash format. Some consumer camcorders can record to the AVCHD format, which is another type of H.264. 

What do you need to know to use H.264? Fortunately not much. H.264 is a standard, and comes with all Macs. Windows XP users who install Quicktime also shouldn't have any problems playing back H.264 footage, and Vista users can playback H.264 video natively in Windows Media Player. People looking to convert their own media for personal use, using DVD ripping software like Handbrake, don't need to worry either, as most software has H.264 built-in as a preset.

MPEG2

The old kid on the block when it comes to video compression is MPEG2. This standard, originally implemented in the mid '90s, served as one of the blueprints for the computer-based video revolution. Most video that is professionally provided is encoded in MPEG2 format. That includes DVDs, HD-DVDs and Blu-ray discs; satellite providers as well use MPEG2 as the primary compression method of transimssion over their satellites.

MPEG2 works by the traditional means of defining individual blocks of content, and as the data rate increases the block size decreases. The good news is that the blocks aren't that noticeable, but the bad news is that when they are noticable they're very distracting. Have you ever seen an explosion on cable? Notice the large amount of blocks and fuzz? That's one of the big problems with MPEG2. It's not as smart as H.264, so encoding artifacts are easier to spot.

What do you need to know to use MPEG2? Not much, since this standard is essentially the standard for video compression, most devices that need to play back MPEG2 already have the ability to do so, without the user having to do much. If computer users need to play back MPEG2, a program like PowerDVD will do so on a PC without a hassle, and the Mac's DVD player software will do the same thing for Apple machines. Otherwise, you'll need to install a compatible codec pack — like one of the ones we've listed at the bottom of the article — to play back MPEG2 content.

Xvid, DivX, X.264 and others

H.264 may be the standard, but a group of other codecs exists that offer even smaller compression sizes. Xvid, DivX, X.264 and others are variants of the standard MPEG4 codecs, and as a result they offer some aditional features that those standards lack. For example, the DivX codec predates the official H.264 implementation by a few years, but offers a similar filesize and featureset to H.264. Xvid is the free version of DivX, which doesn't require any sort of licensing fee to implement. X.264 is an open source version of H.264.

Each of these different codecs offer tradeoffs. The biggest tradeoff of all is a lack of guaranteed compatibility. People who distribute DivX video, though the videos are smaller, require their users to download and install an additional codec to watch the videos, which might be an additional frustration for users. The same is true for Xvid, though X.264 hooks into the standard H.264 decoding subsystem.

Codec packs

Rather than surf the net endlessly for every iteration of every codec, people who use internet video frequently should instead opt for codec packs. One of our favorite codec packs for Mac OS X is called Perian. Perian contains codecs to play back all of the codecs we've listed, including MPEG2, DivX, Xvid and others. Perian installs as a preference pane, and will automatically update your video codec selection should a new codec come around.

On the Windows side, we opt for MediaCodec.org's Windows Essentials Codec Pack. If you've ever experienced one of those Windows Media Player "Cannot find the right codec" errors, WECP should take care of your problem.

Got a codec you'd like explained? Have a codec pack that's more comprehensive than the ones we listed? Sound off in the comments and be sure to let us know what we're missing.

News by company:
Apple, Microsoft
News by glossary term:
Blu-ray, DVD, DivX, Xvid, HD DVD, H.264, codec, AVCHD, Lossless, MPEG2, Lossy, x.264
News by brand:
Apple Mac OS X, Microsoft Windows
Profile pages:
Microsoft Windows Vista Home Basic, Microsoft Windows XP Home, Microsoft Windows XP Professional, Apple Mac OS X 10.5 Leopard, Microsoft Windows Vista Home Premium 32-bit, Handbrake, Apple Mac OS X 10.4 Tiger, PowerDVD

Comments (3)

Add a comment Inappropriate or promotional comments may be removed.

Reply
Wyatt (1:25 PM on Sun Dec 7, 2008)

This is something that many people need to read, as codecs are one of the more confusing aspects of digital video. There ARE a few points that I feel ought to be addressed more properly here, however, even bearing in mind that this is aimed at those who aren't especially well-grounded on this topic.

First, your math changed from the initial one second to the DVD (1920x1080 vs 720x480). That's more a nitpick than anything else, but the distinction between the two is significant (in terms of their size).

Second, H.264 is part of the MPEG-4 standard (this is noted in the glossary entry); specifically, part 10 (also known as Advanced Video Coding or AVC) and there are a number of implementations of it; that is, there are many encoders and decoders made by different groups. But it might be worthwhile to note that the "standard set of mathematic principles" in AVC presents a lot of options. This in turn leads into different profiles, including the Baseline Profile (BP, incorrectly identified on the glossary page as a "less complex sibling") and High Profile (HiP), which has emerged as the dominant one for HD video and is included as part of the requirements for Blu-Ray decoders. AVC also supports lossless compression of video and audio, though this option is not often exercised.

Third, the implication from this writing seems to indicate that x264, Xvid, and DivX are somehow "nonstandard" compared to H.264. As noted, however, H.264/AVC is just one part of the MPEG-4 standard; by contrast, each of these is an implementation (a piece of software made by a group for encoding and/or decoding) of part of a standard (in this case, parts two and ten of MPEG-4). x264 is a software encoder that is free and open. Its competition includes Apple, Intel, Sorenson, Adobe, and more. Each of them has an implementation that encodes a video with AVC. Xvid and DivX are two competing implementations of MPEG-4 ASP, along with ffmpeg, 3ivx and a couple others.

Finally, the second part of that section is almost entirely wrong. Having one encoder and decoder for one codec is enough, provided it adheres to the standard laid out by the codec. It's also important to note that though the filesize for many ASP videos is smaller, this comes with a substantial loss in quality-- all other things held equal, AVC will always outperform ASP in terms of video quality for a given bitrate.

As to the final point, that of codec packs; this is, to some, a holy war that rivals vi/emacs. For ease of use and support for the most codecs, I would strongly recommend ffmpeg's libavcodec in some form (it is available for a number of platforms). Another thing that you might cover is container formats (vob, flv, mkv, avi, etc), though it might be out of the scope of this article.

Oh dear...that became rather long.

Reply
Randall Bennett external link (1:51 PM on Sun Dec 7, 2008)

Hey Wyatt,

While I appreciate your lengthy explanation, I think you sorta missed the point.

"What are they, and how do I play back my video?" was the point of this post. I think your comment gives people an idea of exactly how deep these technologies go.

Thanks for clearing up some of those ideas, and to date this is the longest, most coherent comment I've received on a post. (That's a compliment!)

Thanks again for reading!

Reply
Stephen Schenck (6:25 PM on Sun Dec 7, 2008)

Don't forget one of the biggest uses of MPEG2: it's the standard for over-the-air high definition television in the US.

Add a comment

Click one of the three commenter types below. Member comments are added immediately once you confirm your email address. Anonymous comments are moderated by our editorial staff.

I want to comment as a new member an existing member anonymously

Email me

  

Comment Preview
Anonymous (6:35 AM on Sat Nov 21, 2009)

Preview your comment here.

Inappropriate or promotional comments may be removed. To create a clickable link, simply type the URL (including http://) and we will make a link for you. Line breaks and paragraphs are automatically converted — no need to use <p> or <br> tags, but if you're into that kind of thing, you can use any of the following tags: b, i, strong, em, a (href only), p and br.