Nov 21, 2008

Video Codecs Explained (Gizmodo)
This is such a good article, I'm blatantly posting the meat of it here. Kornfused by the multitude of video formats? DVD VCD, Blu-Ray, VHD, SVHS, SVCD, AVI, MP4, Quicktime, WMV, etc:?

Video Standard Standards



• H.261 is not a term you have to worry about, but it's the technology that most video standards and codecs were originally based on. Originating in 1990, it's the first major digital video compression standard, and like other "H" standards, it was developed by the International Telecommunication Union. This one was primarily for teleconferencing over ISDN lines, and as such, it looks like it (bad).

• MPEG-1 Part 2 is another oldie, developed by the Movie Picture Experts Group and approved in 1991. (BTW, the whole "part" thing is because video is just one "part" of each MPEG standard.) Based quite a bit on H.261, MPEG-1 was designed to take VHS quality video and squeeze it down to a bit rate of about 1.5Mbps, optimized for CD transfers. No surprise, it's the standard used for all VCDs (which can play in most DVD players), still looks bad.

• With MPEG-2 Part 2, approved in 1994, we're finally talking decent vid. Also known as H.262, since it was developed jointly by the ITU-T and ISO, MPEG-2 is an extension of MPEG-1 that delivers better resolution and higher bit rates (3-15Mbps for standard def and 15-30Mbps for HD). It's the video codec used by DVD and digital television, though now it's slowly being replaced by the more efficient MPEG-4, except on DVDs, where it'll ride out that disc format's lifetime.

• H.263 is designed for sending video over poor connections. So it's used to encode most Flash video and to send video over mobile networks.

• MPEG-4 is where we really stand right now. It has a much broader scope than past MPEG standards, aiming to tackle both the low end (cellphones on a slow network) and the high end (Blu-ray). It's still developing, so it's not-so-coincidentally where this whole story gets messier. There are two relevant parts of the MPEG-4 standard for our myopic video purposes: Part 2 and Part 10—which is also known as H.264 or Advanced Video Coding (AVC). To be clear though, even though they're both part of the MPEG-4 standard, they're totally different formats. Nevertheless, both are more efficient at compression than past MPEG codecs, delivering better quality using less space.

• Okay, so if you've ever frequented a Torrent site, you've actually watched tons of videos that use MPEG-4 Part 2, though it's not like they would've had a flashing sign telling you so. MPEG-4 Part 2 actually has different "profiles"—the two that matter being Simple Profile, for low bitrate, low-res stuff, and Advanced Simple Profile. The latter profile is what's used by movies you would download in formats like DivX or XviD or 3ivx—which are all codecs that are essentially just differing implementations of the MPEG-4 Part 2 standard.

• MPEG-4 Part 10, the other part, was actually co-devopled by MPEG and the ITU-T, so it's also known—in fact, more commonly known—as H.264. It's more efficient than MPEG-2 and MPEG-4 Part 2, delivering the same quality video in as little as half the space, making it suitable for the low and high-end. Because of this, it's quickly becoming the standardest standard. It's part of the HD DVD and Blu-ray spec, replacing MPEG-2 in digital TV (like with satellite services and AT&T's U-Verse IPTV) and supported by pretty much every portable video player on the planet from the iPod to the PSP. Apple has a decent, if Kool-Aid flavored, FAQ about H.264.

• VC-1 is essentially a Microsoft developed alternative video codec to H.264 released as a standard by the Society of Motion Picture and Television Engineers, though it descends from the same H.26X/MPEG family. (It essentially started life as WMV9, but then Microsoft shopped it to the SMPTE to make it an industry standard, and now it is.) It too, is part of the mandatory Blu-ray and HD DVD spec, and is the official video codec of the Xbox 360. It's pitch is the same as H.264's—trying to deliver better quality using less space, like HD video in 6-8Mbps.

Free-Floating Codecs
Okay, so all that stuff up there are industry-wide standard video codecs. On top of all of those, various entities love putting out their own spin on those standards. As we mentioned before, DivX (proprietary) and XviD (open source), for instance, use MPEG-4 Part 2 (more specifically, MPEG-4 ASP) compression, meaning stuff that'll natively play back MPEG-4 ASP will also play back DivX. Like the Xbox 360, for instance. There are a ton of MPEG-4 ASP-based codecs, actually, like FFmpeg, 3ivx and others, but DivX and XviD are the most common. Same deal with H.264: Some well known codecs that use it are Apple's Quicktime H.264, x264 and Nero Digital. You've also got Windows Media Video (WMV) codecs, which are Microsoft's proprietary twists on industry standards.

Containers aka Wrappers
Alright, well you've probably noticed that none of your video files have the extension .h264 or .vc1 or the like. That's because videos are packaged in containers or wrappers that stuff things like the audio, navigational info, etc. along with the video in a single pretty file. Naturally, there are about as many of them as there are codecs. To be clear, you would take a video encoded with, say, H.264, and wrap it up as a .mp4 or .avi file.

The majors ones are:
• AVI (Audio Video Interleave) is Windows' standard multimedia container
• MPEG-4 Part 14 (known to you as .mp4) is the standardized container for MPEG-4
• FLV (Flash Video) is the format used to deliver MPEG video through Flash Player
• MOV is Apple's QuickTime container format
• OGG, OGM and OGV are open-standard containers
• MKV (Mastroska) is another open-specification container that you've seen if you've ever downloaded anime
• VOB means DVD Video Object. Guess what? It's DVD's standard container, and what you get when you rip a DVD.
• ASF is a Microsoft format designed for WMV and WMA—files can end in .wmv or .asf

So, in order to play a video file, your setup has to be able to handle both the actual video codec and the container. It's why you can try to play an AVI file and Windows Media Player laughs at you, even though it totally played one a minute ago— the container was no problem, but it didn't have the right codec. Or conversely, even though an iPod could play back an H.264 encoded video, if it was wrapped up in MKV, it won't be able to read it.

No comments: