A codec is a method for making video files smaller, usually by carefully throwing away data that we probably don’t really need, and they’re pretty smart about how they do that. A few years ago, I created a video that covers the main compression techniques that many codecs use. It’s not required viewing to understand this article, but it certainly won’t hurt.
If you cruise the Web forums of people who work regularly with video, you'll stumble across raging debates about which codec is best. In reality, the right codec really depends on your intended use. So it's worth looking at the different codecs in terms of their usage model, instead of just a long list. We'll mostly focus on video codecs, but will touch on audio issues in the section on container formats.
* Video Capture and Archiving :
Most modern consumer electronic devices capture content in some type of compressed format; usually, only professional videographers work with uncompressed HD video. In an ideal world, with infinite storage, you'd maintain archives of video captured in the original format, if possible, because that's the highest-quality capture. Once you transcode the video from one compression type to another, it's possible to introduce subtle errors that may reduce the quality of the image. (Good transcoding software minimizes this.)
H.264 / MPEG-4 AVC:This is the most common codec used in modern camcorders and digital cameras that capture to file-based devices (hard drives, memory cards, and so on). Again, note that this is the codec, not the container format, which is typically AVCHD.
MJPEG (Motion JPEG):This is an older format used by some digital cameras and older devices to capture video. It was developed by the same group (Joint Picture Experts Group) that developed the JPEG photography compression codec, hence the name.
DV and HDV:
DV was developed by a consortium of consumer electronics companies that manufacture and sell camcorders. DV is a tape-based standard and is common on camcorders that use mini-DV tape cartridges. (Some versions of DV are used in professional tape-based gear as well, like DVCPRO and DVCAM.) DV itself is limited to standard definition, so one version, called HDV, was created to allow capture of high-definition video to mini-DV tape cartridges.
Note that DV and HDV describe both the codec used and the container format.
* Disc-Based Delivery Formats :
The old-fashioned DVD or slightly more newfangled Blu-ray Discs or the new 4k Blu-ray for a bit. Despite the increasing popularity of streaming video, the capability to deliver disc-based media is still needed. I've created Blu-ray and DVD discs to hand out to parents of high school athletes, or to send to relatives, for example. Practically everyone has a DVD player, and you don't need an Internet connection to share a DVD.
Again, we have to distinguish the codec (MPEG-2 Part 2, also known as H.262) from the MPEG-2 container format. MPEG-2 is used exclusively as the compression standard for DVD video. MPEG-2 was also used in the early days of Blu-ray Disc creation, though most of the newer Blu-ray movies no longer use MPEG-2. MPEG-2 is also used to compress video for over-the-air HDTV broadcast.
H.264 / MPEG-4 AVC:This is essentially the same codec used by modern camcorders for capturing video. It's also used for delivering Web video. H.264 offers robust image quality at relatively low bit rates and high compression ratios. It's very scalable, so you can also have high-bit-rate H.264 video that looks fabulous. This is what's typically used for Blu-ray playback.
Microsoft VC-1:VC-1 is one of three codecs used to encode Blu-ray content. It's also used in Microsoft's Silverlight alternative to Adobe Flash. Blu-ray movies using VC-1 mostly use VC-1 Advanced Profile, also known as Windows Media Video 9 Advanced Profile or WVC1.
* Streaming From the Web:
Delivering video over the Web necessarily means compromises, mostly trading off image quality for lower bit rates. Broadband bit rates vary depending on the ISP and transport technology. Most of what applies to Web content delivery also applies to video stored on mobile, handheld devices.
MPEG-1:MPEG-1 is the old warhorse for delivering video over the Web. While YouTube, Netflix, and other relatively sophisticated streaming video providers have moved away from MPEG-1, a ton of MPEG-1 standard-definition video is still available on other sites. I've included it mostly for completeness; if you're planning on using high definition at all, you'll want to avoid MPEG-1.
WMV (Windows Media Video):Once again, we're talking about the codec, not the Windows Media Video container format. While not as common as MPEG-1, there's still a lot of WMV content available. Again, it's probably best to avoid using this.
H.264 / MPEG-4 AVC:H.264, at lower bit rates, delivers fairly high-quality video. H.264 will likely become the most common codec used: Adobe supports it in Flash, HTML5 canvas can use H.264, YouTube is steadily moving to H.264, and Apple fully supports it. While creating a video compressed in H.264 might not play on older devices, it's a sure bet going forward.