Codec
A codec ("coder-decoder") is a system for compressing an audio or video file down to a smaller size for easier distribution or storage. This process of compression is called
encoding. In order to play or view encoded media, your media player (e.g. Windows Media Player) must have the appropriate codec for that type of encoded media.
If you try to play a media file without the correct codec, it either won't work at all, or in the case of a movie, will just play the sound but no video (or vice-versa). In order to get the movie to play correctly, you can either:
- Use another media player such as VLC, which has all the common codecs already built-in.
- Install the required codec. Finding out exactly which codec you need can be tricky, since a single filetype can support more than one codec. Desperate users who don't want to mess with VLC can install G-spot (yeah, laugh all you want...at least they get a lot of search engine hits), which can peer into the inner workings of the movie file in question and tell you what codec it uses.
Common codecs include:
Audio
- MP3 (*.mp3)
- OGG (*.ogg)
- AAC (*.aac)
- AC3 (*.ac3)
- WMA (*.wma)
Video
- DivX (*.avi, *.ogm, *.mkv, *.mp4)
- Xvid (*.avi, *.ogm, *.mkv, *.mp4)
- H.264 (*.avi, *.ogm, *.mkv, *.mp4)
- WMV (*.wmv)
- RealVideo/Media (.rv, .rm)
It's important to remember that the codec used can sometimes be independent of the type of file. For example, files ending in .wmv
always use the WMV codec, but those ending in .avi might use either DivX or Xvid (or something else). As mentioned above, the best way to find out in these cases is installing the creatively-named
G-spot.
Music formats are nice in that a filetype (e.g. .mp3) are associated with a single codec (in this case, you know...MP3). In video formats, things aren't so simple.
What codecs do
The MP3 codec is probably the best-known example of a codec in action. A normal, uncompressed song file (.wav) is about 20-30 MB - a prohibitively large size. Instead of holding 20,000 songs, your iPod could only hold about 3,000. Boo! This is why a normal song CD can only hold about 20 songs max. However, if the same song is encoded with the MP3 codec, its file size drops to about 4-5 MB. Much better!
MP3 compression, like all codecs, reduces filesize in two ways:
- It find sections of repeated or predictable data that can be expressed in a shorter form ("compression")
- It removes redundant or not easily noticeable data. In the case of MP3s, the extreme high (treble) and low (bass) ranges are cut out, since we can't hear them very well anyway.
All codecs use the first option. Those that also use the second option are called "lossy" codecs since data is "lost" (the opposite being "lossless"). For example, MP3 sound quality, while quite acceptable to most people, is still inferior to the original CD track because it has "removed" data. If too much data is removed, the song starts to sound very mechanical and "flat".
Codecs are complicated algorithms that accomplish this compression and cropping. As an analogy, imagine this original message:
We cannot move the unbelievably large stand-up piano at Carmichael's lousy apartment because it is too heavy.
was put through a codec. The analogous result might be:
can't move the lg. piano @ carm. b/c it's hvy
That's half the length of the original! Notice that commonly used words get abbreviated and unnecessary adjectives and other hyperbole are removed altogether. If another person who is familiar with common abbreviations (e.g. has the codec) came along, they would get back:
We cannot move the large piano at Carmichael's because it is too heavy.
Now, we can't resurrect the parts that were completely left out, the same way that MP3's lose sound quality in the (hard to hear) extreme bass and treble. However, we still have received all the information we need.
An audio/visual codec provides your media player with a way to take something like our encoded message and turn it back into something understandable.