Home » Opinions » The Codec Primer: Part Two

An Intro to MPEG and GOP

by | Go to comments

Share:

Last week, we explained what a codec is and why we need them, before looking at the two main container formats - QuickTime and Microsoft Video for Windows. We also explained what DV does to reduce video data rates. But the kind of frame-based compression it uses was not going to be sufficient for consumer digital video consumption, nor the HD revolution. A new type of compression was required, and the end result was MPEG, from the Motion Picture Experts Group.

MPEG

MPEG now comprises a whole family of codecs. Most of these can be embedded within AVIs and QuickTime MOVs as well as operating standalone. The most important MPEG standards for the computer user are MPEG-1, MPEG-2 and MPEG-4. It's worth noting here that MP3 audio is not MPEG-3 but a shortened name for MPEG-1 Layer 3. So MP3s are part of the original MPEG-1 standard. The MPEG-3 standard was originally meant for HDTV, but this was rolled into MPEG-2.

The most important thing to know about MPEG is that it is the father of all interframe formats. As we touched upon in Part One of this series, MPEG only records a single I-frame every so often, with the intervening P-frames referring back to this. It's also possible to include B-frames which refer forwards as well as backwards. So, instead of being based around a single frame, the basic unit in MPEG is a bundle of frames called a Group of Pictures (GOP).


The exact structure of a GOP is variable. Typically, 12-15 frames will be included, defined by a parameter N. Of these, only one is a full I-frame. The rest of the frames will be a mixture of P and B frames, indirectly defined by another parameter M, which dictates the spacing of P frames. A figure of 3, for example, means that every third frame will be a P frame. So, for a GOP with N=12 and M=3, there will be one I-frame, three P-frames, and eight B-frames.

Motion-compensated predictive coding (MCPC) helps prevent rapid motion from throwing the forward and backward referencing out of whack. With bidirectional B-frames involved, the frames have to be read in a different order to the one in which they end up on the viewer's screen. This is one of the reasons why MPEG is much more complex to edit than video compressed using intraframe-based methods only.

It's also possible to specify a much larger group of frames called a Long GOP, which can allow much higher compression but won't be compatible with certain playback devices. It can also cause colours to drift towards green. A version of the DVD specification called XDVD with GOPs up to 60 frames was announced in 2005, promising as much as 10 hours onto a single-layer 4.7GB DVD. A somewhat outdated list of supporting players is available here.

Go to comments
comments powered by Disqus