All About Video Codecs and Containers

Page 2 of 2

The Right Container: Flexible and Usable

I'm only going to touch on commonly used container formats you'll encounter currently. Each serves different purposes and audiences, and which you choose depends on what you want to accomplish. Since container formats also carry audio along with them, we'll touch on audio codecs.

When you actually render your video in your video editing package, you'll be creating a container file, which will include the compressed video and audio, as well as the information needed by the rendering device's data format, so the actual video and audio can be decoded by the target hardware. This is why knowing the final destination for your video is critical to choosing the best container.

Unlike codecs, the usage models of container formats tend to overlap heavily. These are the most common ones in use.

Containers for Archiving and Capturing

As mentioned with codecs, you need to pick the highest quality archive medium. Most consumers may simply want to store video in a way that's easy to stream to other PCs on the network--or even over the Internet--but you don't want it to look like a pixilated mess. The right container will help you strike the right balance between quality and streamability for your particular needs.

Advanced Systems Format: ASF is a Microsoft-based container format. You'll see various file extensions for ASF files, including .asf, .wma, and .wmv. Note that a file with a .wmv extension is probably compressed with Microsoft's WMV (Windows Media Video) codec, but the file itself is an ASF container file.

ASF files can, in theory, contain video and audio files compressed with any codec. In practice, it's playback that can become a problem, particularly with video compressed with H.264 codecs. If you're planning on remaining within the Microsoft universe, ASF is fine, but you might have problems with non-Microsoft media.

Audio Video Interleave : AVI is an older Microsoft container format. It's still fairly common, but you probably won't want to use it with new projects.

QuickTime: QuickTime is Apple's own container format. QuickTime sometimes gets criticized because codec support (both audio and video) is limited to whatever Apple supports. This is true, but QuickTime supports a large array of codecs for audio and video. Apple is a strong proponent of H.264, so QuickTime files can contain H.264-encoded video.

MP4: People sometimes confuse MP4 files with QuickTime, but they're actually different standards. MP4 is another container format developed by the Motion Pictures Expert Group, and is more technically known as MPEG-4 Part 14. Video inside MP4 files are encoded with H.264, while audio is usually encoded with AAC, but other audio standards can also be used.

MPEG and BDAV MPEG-2 Transport Streams: These are the container formats used in DVDs and Blu-ray discs, respectively. The VOB (Video Objects) container file format is a subset of the MPEG transport stream, and is used specifically in DVD video creation. (VOBs can also hold other types of data, but that's beyond what we're discussing here.) MPEG-2 Transport Streams, as the name suggests, uses video compressed with MPEG-2 Part 2 encoders, but it's actually not limited to MPEG-2. MPEG-2 TS data can also be compressed with H.264 and VC-1, since those are also defined as part of the Blu-ray standard. Audio files can be Dolby Digital (AC3) files, Dolby Digital Plus, Dolby Lossless, DTS, DTS HD, and Linear PCM (uncompressed) multichannel audio data.

AVCHD: This is the standard container used by many camcorders. Video captured with these devices is compressed with the H.264 AVC codec. Audio is encoded as Dolby Digital (AC3) or uncompressed linear PCM.

Flash: Adobe's own container format is Flash, which supports a variety of codecs. More recent Flash video is encoded with H.264 video and AAC audio codecs, but don't expect all Flash sites to use only those codecs, particularly if the video was created and encoded in years past.

Others: A variety of other formats are widely used, particularly for delivering video over the Internet. These include Matroska (.mkv), OGG (and the related containers OGM and OGV), and DiVX.

How to Use Your Codecs and Containers

First, let's consider what amateur videographers who are creating and editing their own videos need to consider. One key thing you'll have to invest in is storage--lots of it.

My own video projects consist of mixed video and audio, plus photographs. I shoot video using digital HD camcorders that record AVCHD files, but I often get files delivered to me in QuickTime (.mov) and AVI formats. I have a few older files rendered in MJPEG, and someday I'll probably transcode those to a more modern format.

All these live on a combination of a 2TB RAID 1 array on my production PC, or on a 4TB home server attached to the network. So far, I haven't had to archive off any data, but if I do, I'll probably use external hard drives, rather than tape-based or optical-disc-based media.

Editing video in Adobe Premiere Elements 9.
I tend to keep videos on my home server in their original formats, and to use Adobe Premiere Pro CS5 to create videos that are delivered via disc formats; my most recent projects involved Blu-ray delivery.

If you're more interested in playing other people's videos instead of making your own, your needs will be different--if you plan on ripping your personal collection of DVDs so you can stream them over your home network, most container formats should do fine. However, you might want to use the format that's best suited for your delivery vehicle. For example, if you're using the freely available VLC Media Player and all the client hardware in your home consists of PCs or Macs, ripping to MP4 containers is a good choice--you get a good mix of compression versus storage requirements.

On the other hand, if you're storing video on a home server, but delivering it to a set-top box or a portable media player, you'll need to know what that particular device supports. Right now, most networked CE devices support a mixed bag of standards, and you need to know which formats will play. You're almost always safe encoding in MPEG-2 in those cases, but high-quality MPEG-2--particularly high-definition video--can consume a lot of storage space.

Looking Forward

Right now, so many codecs and containers are available that it's hard to ensure your video can be watched by everyone out there. The good news is that the future seems to lie with variations on the H.264 codec and MP4 containers. If you store your video in those formats today, transcoding to other widely supported formats (QuickTime, Flash, ASF) becomes pretty simple.

I've really only scratched the surface on codecs and containers. It's enough to get you started, but if you want to dive deeper, here are a few online resources.

Wikipedia: Wikipedia offers a good starting point if you want to dip your toes a bit deeper. Check out the entries on Comparison of Video Codecs article and Comparison of Container Formats. The descriptions are terse, but these entries have lots of links to deeper articles.

Master New Media's Video Encoding Guide: Robin Goode's article on codecs and container formats is a great jumping-off place, with links to other great articles, plus good basic information.

High Definition on Youtube: If you're looking to get the most out of uploading your HD videos to YouTube, this is a concise, useful place to start.

This story, "All About Video Codecs and Containers" was originally published by PCWorld.

To comment on this article and other TechHive content, visit our Facebook page or our Twitter feed.
| 1 2 Page 2
Shop Tech Products at Amazon