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[@] 

Content Viewers Guide
Content Creators Guide
Links and further info

Codec info for viewers

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:
WMV - Windows Media Format - proprietary
Quicktime 6 - implementation of MPEG-4
DivX - free implementation of MPEG-4
XviD - open source implementation of MPEG-4

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.


Other issues:
There are a mess of legal restrictions that mar codec standards. The licensing agreement for Microsoft's MPEG-4 codec actually states that you can't encode video into an AVI formatted file with their MPEG-4 codec. Technically you can do this, and there are tools that let you do it, but it's non-standard. Also on MS's WMV codec it states that it's illegal to convert a WMV encoded movie to another format. Older versions of some tools like VirtualDub used to allow you to do this but cease and desist letters where appropriately dispatched to end this 'illegal function' and as such this feature disappeared from most video editing software packages. There is only one tool I know of that does this, TMPGEnc which is developed out of Taiwan. Taiwan is not a participating member of the Berne Convention which basically is an agreement between nations to allow enforcement of each others copywrite inside of other member nations.

The "Four C's":
In the header of most if not all media files is a unique identifier comprised of four characters. This is referred to as the Four C's or 4CC. An example is "DX50" for DivX version 5 encoded files. GSpot is a good tool for identifying the encoding method. There are other tools and you can use a hex editor too for this purpose.

Common Problems:
Often people run into problems viewing videos because they don't have the needed codec installed or they have multiple codecs for the same function installed. Having more than one codec on your system for a given format may cause problems. Also note that a lot of codecs are not free, they come with software packages like Adobe Premier or hardware like video cards. Just so everyone is on the same page; this means these types of codecs are usually illegal to share or download if you find them online.

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:
When you play a movie, there is only audio, no picture. Or the reverse, video with no sound. This often means you are simply missing the right codec. There are places to find new codecs, I'll list them at the bottom of this section. Also remember that video codecs don't work for audio and vice versa. This means a separate codec may be needed to decode the audio in your movie file. Use a tool to identify what codec the movie is encoded as and verify it's installed. If it's not you'll have to track it down online.

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

There are two ways of doing this depending if your video equipment is analog or digital. If your source video is analog (8mm, Hi8, VHS-C, VHS, ect.) then you will need a video capture device. There are many different types, usually they consist of a video card (AGP or PCI) with some additional inputs and outputs for connecting to your analog equipment. There are also external capture devices made by companies like Hauppauge (WinTV products) and Pinnacle (Dazzle products).

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.

If you are shooting with a digital camcorder you have it made. Firewire is the best way to go if possible. Sony calls this iLink, PC users call it 1394, and Mac users call it firewire. Firewire is not only a high speed medium for transferring data between your camera and the computer, but it also carries control data for remotely controlling your camera and other equipment. This means you can play, stop, fast forward, and rewind all from within your editing application if you hardware is supported.

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.

Where can I get more info?

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.

Frameserving info
DebugMode Frameserver (Free?)

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

This site is © Copyright Nathan Heald 2004-2005, All Rights Reserved.
Free web templates