DEAD BEEF's beginners guide to CODEC's
I felt that codec information deserved it's own page from the video beginners guide so here it is. It is divided into two main sections: the viewers guide and creators guide. If all you want is to understand codecs and get some troubleshooting info, all you need is this. However if you are wanting to encode video then you will also want to read the content creators guide.
This document is intended for the absolute beginner to intermediate codec user. In the process of writing it I actually learned quite a bit and referenced a lot the sources I learned from in the links and further info section.
If you find an error or problem in something that I have here please let me know: deadbeef[@]packetsniffers.org.
Content Viewers Guide
A codec is a software algorithm to decode and play different audio and video formats. There are hundreds or more codecs out there for different purposes. Codec stands for 'compressor/decompressor'. The purpose of a codec is to reduce the size of your audio or video. The problem is that usually you loose A/V quality since some of the information is lost during the compression cycle. The trick is to get as much information into the file with the least amount of loss of quality.
Examples of common codecs:
The second concept that you should understand is that there are open compression standards like MPEG-4 which are outlined by the Moving Picture Experts Group. Don't confuse this with the different implementations of the standard. Anyone can write a codec that encodes and decodes MPEG-4, and there are several different codecs that do this. Unfortunately most implementations do it differently and in a way that is not compatible with the next. Some of these like Microsoft's codec for MPEG-4 are proprietary and cost money to use. Others like the DivX MPEG-4 variant are free to use (Only the pro version costs money to use).
And one last important concept for you to digest: file formats. Most people should recognize AVI, Quicktime, and MPG file formats. These have nothing to do with codecs, but it's important to understand why. AVI is the defacto file format of Microsoft and is a specification for how audio and video are laid out inside of a movie file. The same is true for Quicktime and .MPG files, however Quicktime and MPG file formats are generally only used to contain their respectively formatted data (A .qt file will only have data encoded by the Quicktime codec and .mpg files will only have MPEG encoded data).
For AVI, this standard says nothing about how the video and audio inside the file are encoded. It could be raw uncompressed data, MPEG-4, Indeo, or any other type of encoded video and audio data. You've probably downloaded an AVI file and found that it would only play if you installed the DivX codec. This is why. It's an AVI file, but the data inside it was encoded with the DivX MPEG-4 codec.
The "Four C's":
There also hacked codecs. These start out as copyrighted non-free codecs like Microsoft's MPEG-4 codec but have been reverse engineered and given another name (Angelpotion is most notorious, it's a hacked MS MPEG-4 codec.) These are well known for the problems they cause, they are buggy. Avoid them if possible.
Another way to cause yourself problems is to install as many codecs as you can find onto your system. Codecs can often interfere with each other so only install what you need if possible. There are things known as 'codec packs' out there too. If they work for you, that's fine. Just be sure you know what codecs are being installed. If you already have a known good DivX codec on your system be sure not to install a second DivX codec that might come with the codec pack.
Troubleshooting codec problems:
Corrupted video output can be caused by a buggy or conflicting codec. This can also be caused by a missing codec too. Check out your installed codecs and make sure you don't have multiple codecs that decode the same format installed.
CODEC info for content creators
If you are looking to work with digital video in any form you are going to have to learn a little about codec encoding. This is a little primer if you aren't sure where to start.
Getting the video onto a computer
For external capture devices, firewire (1394, iLink, ect.) and USB are the way to go. Any external device that uses your parallel port or other legacy connection is not worth your time or money.
For USB devices, be sure it can handle the bandwidth of your raw video. What this means is, if it uses USB 1.0 then it will compress your video before it gets to your PC and then you are left with crappy video to start off with. For USB devices make sure it has a "High Speed USB" label on it. Not all USB 2.0 devices are actually "High Speed" thanks to unscrupulous venders that wanted to unload USB 1.0 kit when the higher speed USB 2.0 standard arrived. They literally changed the USB standard to slow speed USB 1 devices could be "USB 2.0" compliant.
Your analog capture device will usually come with some proprietary codecs for encoding. Some are better than others, you'll have to do some research too see what options you have here. This means as you capture video it will be encoded on the fly before it hits your hard drive. Even raw video will have a codec of some type, even if it's just little to no quality loss. This is the format you will want your video in for editing. Once you are done editing you can export it back out to your analog media or re-encode it into another format or codec. This is the part that this guide will try to assist you in, this can be a complex and confusing process.
Basically, all you do is plug in your camera and use your software to start capturing video to your drive. With older editing equipment like VHS decks you had to add time-codes and such before you could edit. Digital video takes care of this for you, once you capture you are ready to edit.
Codec Corner - An excellent video codec resource
Indezine - An excellent audio codec resource
Doom9 is another excellent place to look for codec help. Also check out Video Help.
Tsunami MPEG Encoder - for exporting AVI and WMV files to MPEG formatted files, especially useful for making movies for VCD and SVCD. Supports many file and encoding formats.
VirtualDub - an open source video editing and conversion tool, lots of plug-ins and functionality.
GSpot - A free tool that determines what codecs (audio & video) are required to play a given AVI file. It also shows you what codec your system is using to play a given video. Many other features also, check out the site.
MPEG Pointers & Resources
Everything you ever wanted to know about AVI and how Windows processes video:
An article that discusses the differences between Quicktime, AVI, and MPG formats.
Spoons Audio Guide - A Light Hearted Look at the Music Industry