A basic introduction to how a video encoder works
- Video codecs generally use three different types of frames, I, P and B-frames.
- I-frames (I for intra, meaning within) are the keyframes. They are like a jpg (the only similar thing is that they are both compressed images really) of the particular frame in question, and are used to cut the video up into smaller areas, and as references for other frames. These frames depend on no other frames to get decoded, which is where 'Intra' comes from.
- P-frames are predicted frames (see where the P came from)? This means they are made up of two parts. The first part is original content, so just as with I-frames, parts (not all) of the frame are stored similar to jpg. The other parts are where the 'predicted' label comes in - they are taken from previous frames. This is the difficult part. Say you have someone's head on the frame, and it's moving to the left (a pan). Well, if the first frame was an I-frame, you could make the second frame a P-frame. Then you would say "take the info from frame #01 and move it all 4 pixels to the left. Then add this new data to the right". You then have a P-frame. Ahhh, that wasn't that hard after all.
- B-frames are just a logical extension of P-frames, with B standing for Bi-directional. B-frames are predicted from both past and future frames, and they can have original content. Until you learn more, just assume that this works, don't spend sleepless nights trying to work out why it does.
A Note About The Difference Between Standards and Codecs:
- Standards are a set of specifications which are intended to serve as descriptions on how a video (or whatever) format should work.
- Encoders (aka codecs) are implementations of a standard.
- See the difference? What this means is when a standard, like MPEG-4 ASP is produced, a number of different groups produce their own encoders, like DivX and XviD. Yes, you are reading this right. A DivX encode will produce a file that can be played by the same decoder as that which is required by XviD. Of course, real life is never this nice and different encoders will use different features from the standard, and even add on their own. A real world example:
- Quicktime h264 uses only the base features defined by MPEG-4 AVC. An encoder like x264 uses practically all of them. This means that you will have a hard time making a file in QT that is as good quality as you can get out of x264.
MeGUI only supports Xvid MPEG-4 ASP encoding and X264 MPEG-4 AVC encoding.
By far the most common group of standards for video formats are those published by the MPEG (Motion Pictures Experts Group) group. Some of the formats are listed below:
Probably the oldest video standard that still exists. Created to store video on CDs (i.e. VCDs) and other such devices. The most common use was 352x240 @ 1.5Mbit/s for NTSC and 352x288 @ 1.5Mbit/s for PAL, which is usually referred to as "VHS Quality"
Designed to produce better quality than MPEG-1, but at higher bitrates. In other words, if you are looking at a bitrate under 1.5mbits, there will be little difference. For any bitrate higher than this, MPEG-2 will give significantly better quality. This format is what DVDs use as well as SVCDs and KVCDs. Also notable for being one of the few video formats in which a colour space other than YV12 is seen in the wild, MPEG2 occasionally uses YUY2.
SP Stands for Simple Profile.
A cut down version of MPEG-4 ASP as described below. Removes lots of cool features and is almost obsolete now. Big name encoders for it were Sorenson (used in QuickTime) and 3ivx. Microsft attempted to provide an implementation of it (as Microsoft Video V1/V2) but their implementation did not conform to spec and was mostly ignored.
ASP Stands for Advanced Simple Profile. Also known as "MPEG-4 Part 2".
By far the most common format used in anime and 'scene' (i.e. American TV & movie) releases. The two biggest implementations are DivX and XviD. CPU requirements are pretty measley by computer standards now, and quality is still reasonable.
- Xvid. The best free implementation out there, and probably better than most commercial ones too. Supports practically everything of the ASP spec, definitely the recommended encoder for this content. This is the only
- DivX. Often used by newbie encoders, but XviD gives generally better results. Note that the included decoder produces bad quality and you should never use it should an alternative present itself.
- LMP4. Short for Libavcodec MP4, an encoder similar to XviD, but falls short in the quality stakes. Developed by FFmpeg and Libav team. Implemented in mencoder and a few other places.
AVC Stands for Advanced Video Coding.
Wikipedia has a nice article about MPEG-4 AVC, aka h264, aka AVC, aka MPEG-4 Part 10. The next step in MPEG video compression after MPEG-4-ASP. It provides significant compression improvements (one option alone can improve efficiency by 20%), at the cost of encoding and decoding speed.
- x264. Pretty similar to XviD - it's the only open source encoder for its standard, and it's better than all the commercial encoders. x264 supports most high profile options (see the Wikipedia page for the table of what feature is what profile level). The de facto encoder for personal high quality h264, because it's the only publicly available CLI encoder, and because as said previously, it supports the most and outputs the highest quality. Homepage at x264.nl. This is the only AVC encoder MeGUI supports.
- Nero Recode. It doesn't expose half as many options as x264, but includes a nice GUI which x264 does not. Although the final quality isn't as great as x264's, the fact it has a GUI makes it a good choice for people who are just starting out in the wild world of video encoding. Homepage is here: nero.com.
- Apple h264. The wooden spoon in this race goes to... Apple! Well, it's not really a wooden spoon, because even Apple's h264 implementation is a fair bit better than XviD. Their files are plain old baseline profile, but also use 1 b-frame. More info on the profile that's used here. Homepage: apple.com/quicktime
The set of video specifications developed by the standards institute ITU-T.
Basically a subset of MPEG4-ASP. Often found in the 3gp container for mobile phones.
h263 plus random stuff. Some of the random stuff is not compatible with MPEG4-ASP either. That said, h263+ is rarer than h263 in the wild, about the only places it exists is in proprietary videoconferencing software, and on some mobile phones. Often found in the 3gp container for mobile phones.
Another name for MPEG-4 AVC.
A free codec that was created when On2 released the source-code for VP3 and made it freely available for use. Development is rather slow, that is to say it doesn't happen. The biggest advantage of this format is that it's completely free for any sort of use at all, which means for any OSS zealot this is your must-use codec. The disadvantage is that the quality is not all that flash compared to the latest codecs, and ffdshow / VLC / mplayer are really the only Windows programs that support it. Quality-wise it's almost identical to VP3, which places it slightly above MPEG-1 but well below the latest codecs such as MPEG-4 AVC or VC-1
On2 is a company that make video specifications and codecs to go along with them. As they are a private company the specs they make are obviously closed and private. The company was acquired by Google.
On2's next codec after VP3, which has become one of the official encoders of the Flash Video format (.flv), and thus can be decoded by Flash. It's reasonably rarely used though, most people seem to have used h263 instead. Now that MPEG-4 AVC is also a support format by Flash Video this will probably quietly expire.
On2's codec after VP6. They claim quality is equal to MPEG-4 AVC and VC-1. Nobody really cared about it enough to test the quality, and it has long ago fallen by the wayside. There's a free encoder/decoder for personal use on their page.
On2's successor of VP7. It became a royalty free codec after Google acquired On2. It is used by WebM format.
Successor of VP8.
The Windows Media Video group of codecs, developed by Microsoft. Read the Wikipedia article for more info on the various formats (including VC-1) that make up the WMV family. Generally the only available encoders for all of these standards are the official Microsoft ones.
MS MPEG, Microsoft Video, etcEdit
A variety of ancient modifications to official MPEG specs (mostly), which existed before the WMV brand name was born. Mostly unseen these days, but there are VfW encoders still around for them in versions of Windows. Some full names: Microsoft H.261/3 Video Codec, Microsoft Video 1/2, MS MPEG Video 1/2 (possibly the same as the previous item).
Microsoft's video codecs that first came out probably around 2000. They are the codecs used in .wmv files, so quite common around the place. Relative quality has always been lower than the alternatives (read: xvid & x264) have been. That said, the lower quality is not a huge drop, and the decoders are guaranteed to be on every Windows computer ever. There is even playback support on Linux via libavcodec and whatever makes use of it.
An extension of WMV9 which adds a few necessities for the broadcasting world (in other words, full interlaced encoding (WMV9 only supported interlaced in 4:1:1 colour format)). Quality is claimed to be equal to that of MPEG-4 AVC, but that's been shown not to be true. VC-1 is effectively a subset of AVC features (a totally incompatible one of course), and it lacks many powerful coding techniques as a result. Most tests put the quality equal to or better than xvid, which is far short of decent h264 encoders. Found on HD DVD and Blu-ray discs.