> Guide Index

Codecs and Containers

Now that you know the basic concepts and terminology behind video compression, we can talk about various containers and codecs, and which one is right for you. First off, we need to point out what the difference between a Codec and a Container is. Codec stands for Compressor/Decompressor (or Coder/Decoder), meaning it is something which can both encode and decode something, in this case video. Codecs include things like MJPEG, Sorenson, Cinepak, and DivX. Some codecs may have specific containers associated with them, such as MPEG. Some other containers you are probably familiar with include AVI, Quicktime, or Matroska. A container simply holds everything together. For instance, the AVI container holds both the video stream (which is compressed with a Codec) and an audio stream. Without the container, the video and audio would be in seperate files! More advanced containers like Matroska can allow for additional things like subtitle streams, multiple audio and video steams, chapters, and more.

A container does not necessarily mean anything about the video quality, it only dictates the underlying structure of a file. I always scratch my head when people say things like "I like AVIs better than MPEGs because they're smaller," which is a statement that makes absolutely no sense. I've had an AVI file that's 26GB large, orders of magnitude larger than most MPEG files. The fact is that containers like AVI and Quicktime have little to nothing to do with the underlying Codec, except that the limitations of a container must be adhered to in the codec. For instance, AVI does not support many of the features required for h.264 (MPEG-4 AVC) compressed video.

I. Containers

1) AVI: Microsoft defined the AVI (Audio Video Interleave) container as a special kind of RIFF (Resource Interchange File Format). As a container it had very simple design attributes which would, in years to come, reveal all kinds of limitations of the format. However, it was able to contain a very large amount of video formats by having a Four Character Code (FourCC) to define which Codec was used to store the video stream. All sorts of clever "hacks" have allowed AVI to do all sorts of things that it was never designed to do, such as support B-frames. However, the container can only be stretched so far, and more advanced codecs like x264 can't reach their full potential in the AVI container. Although technically superior containers like Matroska exist, AVI remains a strong choice. Editing applications often don't even support many newer containers, so AVI is likely your best option. For distribution, AVI has been losing ground to other containers lately, because AVI doesn't support many features needed by some advanced video codecs.


MPEG: The MPEG container holds audio and video that are compressed with... you guessed it... MPEG. The MPEG standard not only defines the MPEG audio and video codecs, but also the container that they are stored in. DVDs use a special MPEG container called VOB that supports additional features like many audio and subtitle streams. (And Blu-Ray uses a version called M2TS)


Quicktime: While Microsoft defined their rather simplistic AVI container, Apple developed a more robust and intricate container called Quicktime. During the late 90's the Quicktime container became the de-facto standard for movie trailers and other types of online video which is designed to be viewed in a web browser. Cross compatibility, however, has not always been smooth. Although Quicktime is available for many different systems, the windows implementations of Quicktime have sometimes been less than desirable. While it's an excellent container, bad implementations and invasive software has dogged Quicktime for years. If you edit on a Mac, then by all means use this container. If you are editing on a Windows machine though, AVI is probably a far better choice. For distribution, Quicktime is often highly frowned upon by viewers who have Windows.


Matroska: This open-source container is a very impressive container that offers many interesting features you wont find anywhere else. Because of it's great subtitle support, it is frequently used for anime fansubs. For the purpose of AMVs though, most of its unique features aren't typically very useful. For editing, you would be hard-pressed to find any serious editing software that supports this container. Hopefully this will change in the coming years, though. As for distribution, most people tend to go with the more standardized MP4 container for their AMVs.


MPEG4: The MPEG4 container is designed to hold MPEG4 compressed audio and video. Technically, it can hold some other different video and audio codecs, but if you want your files to comply with the MPEG4 standard, you should use only the standard MPEG4 video and audio codecs. Their are 2 compliant types of video codecs that you need to be aware of. MPEG4 ASP (advanced simple profile) codecs, such as DivX and XviD, and h.264 (also known as AVC, or Advanced Video Coding) codecs, such as x264. The standard MPEG4 audio codec is called AAC, though it is also acceptable to use MP3 audio. These days MPEG4 has become the de-facto option for distribution.


Windows Media: This proprietary container is designed exclusively for holding Windows Media Audio and Video (WMA & WMV). Microsoft created this container because their aging AVI container couldn't support all of the features that they needed. While it is in many ways technically superior to AVI, it doesn't offer nearly the openness and flexibility that AVI does. Most Windows users shouldn't have too much trouble playing these files, but users on other operating systems or older versions of Windows may have difficulty. If you edit using Windows Movie Maker, this might be an option for you, but otherwise this probably isn't the best choice.

II. Common Editable Codecs


DV - Digital Video

DV is not lossless, but it still provides very good quality. The filesize can also be much smaller (by about 3 times) than the lossless options. If you are only going to be doing a recompression once or twice, the quality shouldn't be much of an issue. With repeated recompression though, you can start really losing quality.

The main disadvantage is that DV is fixed to 720x480 in 29.97 FPS (or 720x576 in 25 FPS) at 25MBit/second. Some variants of DV exist that may support different resolutions, or allow for progressive (non-interlaced) video. But for the most part, DV severely limits what you can put into it.

My recommendation is don't use it. The limitations it imposes aren't really worth the trouble.



Huffyuv was one of the first really great lossless codecs that came around. It is very fast, and compresses decently. It orignally only supported YUY2 and RGB colorspaces, but some modifications of it can support YV12. However, better codecs exist now, so it's best to just skip this one.



Like Huffyuv, Lagarith is a lossless codec, so you get back exactly what goes into it. In addition to offering better compression than Huffyuv (so it doesn't use as much disk space), it also has support for additional colorspaces such as YV12, and it offers interesting features such as a "reduced resolution" mode, which is useful for editing with proxy files (discussed later in this guide).

Both compression and decompression can be slower than HuffYUV. If you have a slower CPU, you may want to consider other options. It also seems to occasionally have some compatability issues with some software, like premiere pro.

This is generally a good, solid option for an editing codec, but because of the compatability issues and slow speed, I wouldn't recommend this one anymore.


UtVideo - Probably your best choice

This lossless codec is blazing fast, and also offers very good compression (almost as good as Lagarith). It also supports all of the colorspaces that you will need.

Because of its awesome speed and great compression, this is my editing codec of choice. You can't go wrong with this one.

III. Common Distribution Codecs


MPEG1 was the codec which made distributable digital video happen. MPEG could be streamed, stored on CDs - you could do all sorts of stuff with it. However, MPEG1 is old. In terms of technical quality there are much, much better things out there. It's not worth using anymore.

2) XviD

XviD is a free codec that has been around for a while now and works very well. It can give you good video quality at a reasonable size.

XviD's main disadvantage is that it's starting to get old, and has been surpassed by better codecs such as x264. XviD is a sort of middle ground between MPEG-1 and x264. I can't really recommend this codec anymore.

3) Windows Media Video 9

The quality is roughly similar to Xvid, but most people tend to frown upon WMV files because they are associated with poor quality, and poor AMVs. About the only reason that someone would be using this option is if they are stuck with the poor "Windows Movie Maker" editing software.

Don't use this unless you have to.

4) x264

x264 is a freely available open source implementation of the h.264 standard. H.264, or AVC as it is sometimes known is a very advanced compression method that is part of the MPEG-4 standard. This simply offers the best quality at the smallest filesize, bar none.

This is currently your best choice for a distribution codec. It's what all the cool kids are using.

Key Concepts

- Containers such as AVI or MPEG4 do not really have much to do with video quality.

- For editing, a lossless intra-frame codec is ideal. The recommended codec for editing is UtVideo.

- For distribution, the x264 codec is recommended.