Home Page | About Me | Home Entertainment | Home Entertainment Blog | Politics | Australian Libertarian Society Blog | Disclosures

Know It All: Video Compression -- The Weird and Wacky World of Video compression

Published in Geare magazine, Issue #55, 2009

Digital video requires enormous truckloads of data. A dual layer DVD with its 8.5GB of storage would fit a little over nine minutes of uncompressed digital video in standard PAL format. For 1080p high definition, a dual layer Blu-ray disc could squeeze in only 11 minutes.

Digital video is practical for one reason: compression.

Like audio, video doesn't really lend itself to compression. There is little redundancy (repeated or unnecessary data) or predictability in a stream of video. So all practical compression systems are lossy. That is, they throw away some of the signal -- hopefully the parts that you wouldn't notice anyway -- to achieve massive savings in data space.

We are not going into the mathematics of how they do that. All you need to know is the concept.

The simplest common system is the 'DV' format used on older consumer-level digital video cameras. You will recall the compact tape cassette ('MiniDV') that they used. In essence, the picture is compressed like a series of JPEG photos. JPEG is a lossy compression format. There are differences between a DV video frame and a JPEG photo, but both use the underlying mathematical engine of the Discrete Cosine Transform to do their stuff.

The losses in DV are quite mild, so good results are achieved.

In the PAL format, uncompressed digital video consumes about 120Mbps (megabits per second) -- not counting error correction and overheads. DV cuts this back to 25Mbps, for a compression ratio of about 5:1.

Of course, DV has largely been supplanted in the camcorder field by models using DVDs, a hard disk or, increasingly, a flash memory card as recording media. These newer models do not use DV at all because ... well, DV uses too much space!

A single layer 8cm recordable DVD could only hold about eight minutes of DV. A more efficient compression system was needed, but one that wouldn't do too much damage to picture quality.

Well, we now have a proliferation of them. The most famous one is that used on the DVD: MPEG2. MPEG2 has survived to Blu-ray, but newer formats such as VC1 and MPEG4 AVC can be (and usually are) used instead. For our purposes, they work in a similar way.

So how to get more efficient? How to reduce data requirements without damaging picture quality?

Remember that DV used a sequence of compressed pictures. Its compression is called 'intra-frame' because it compresses each frame independently of the others. MPEG2 and the others also use intra-frame compression, but they add temporal compression. 'Temporal' is a fancy word for 'over time'.

Basically, MPEG2 works by taking something like two frames per second (it's typically every 12th or 15th frame), applying some intra-frame compression to them and recording them, and then for the rest only recording the differences between those so-called 'I' or 'anchor' frames and the other eleven or fourteen frames being encoded. That's what allows the very high levels of compression.

The 'I' frames are intact. You can pull one of those out of the video and decode it back to something like the original picture (not perfectly, of course, because the compression is lossy). All the other frames can only be decoded with reference to those 'I' frames. Some of those in between frames are 'P' frames, which record only the differences from the previous 'I' or 'P' frame. The rest are 'B' frames which can look both backwards to the previous 'I' or 'P' frame, and forwards to the next 'I' or 'P' frame.

Almost all DVDs will have their frame sequence as: I B B P B B P B B P B B I.

This yields huge savings. The maximum bitrate allowed for DVD is only 10Mbps, or forty per cent of that provided for with DV. Most DVDs use average video bitrates of between 3.5 and 7Mbps.

MPEG2 is a variable bitrate (VBR) system, unlike DV which is constant. A fast moving action scene will have greater differences between two adjacent frames than a lingering shot on some scenery. So more data is consumed in those faster moving parts of the program.

With 1080 HDTV as delivered in Australia, the average video bitrate is typically around 11 to 14Mbps. With 1080p24 on Blu-ray, the average for a movie can range from as low as 13Mbps up to the high twenties.

MPEG2 style video compression is much more difficult to edit than DV. With DV, you can dump the video into a computer (via a Firewire connection) and then cut and paste easily, down to a precise frame. But older computer-based video editing software, and most DVD recorders, limit cuts to 'I' frames. Remember, those are the frames which are self-contained. To do a cut on one of the other frames requires whole new frames to be generated. More modern software tends to deal with these requirements, but DVD recorders generally remain clunky with their editing.

Serious amateurs still prefer the DV format. Sure, the tapes don't provide fast access, and can wear out from overuse. But they edit well and for fast action provide significantly better picture quality than MPEG2 and its variants.

© 2002-2009, Stephen Dawson