Data & Compression
Data and Compression
What’s good about HD is that, with five times the number of pixels as SD, the pictures are fantastic. What’s not so good is that the amount of data you need to store and move around goes up by a factor of five as well. This, to put it mildly, is an issue.
A Whole Lot of Data
To put it in perspective, standard definition video generates around 15 floppy disks worth of data per second! In plain text, you can store War and Peace on a single floppy. Multiply the 15 floppy disks you need for a second of SD by five and you reach the staggering conclusion that HD generates the equivalent of 75 copies of War and Peace per second. If you’ve ever read War and Peace, you’ll know that’s an awful lot of data.
Incredibly, computers can actually deal with uncompressed HD, which generates an almost unimaginable one gigabit per second, but you need to have a computer that is fit for the job, with huge quantities of extremely fast storage. You’ll know if your storage is extremely fast, because it will have been extremely expensive. But for the rest of us, who don’t want to spend a fortune on enough storage to house the entire US Library of Congress every six minutes, there has to be a better way. There is, and it’s called compression.
Compression vs. Quality
As you might expect, compression is a complex subject. The programs that perform compression — called codecs — are mostly designed by mathematicians. Luckily, these programs work so well that it’s perfectly OK for most of us to remain blissfully ignorant of the way they work. If all you ever want to do is simple video editing, using pre-configured settings, then you can safely skip the next bit. But if you’re ever going to go beyond that and make videos for distribution using a variety of media (DVDs, the web, etc), then it’s worth knowing a bit more.
As we already know, the most popular video format used by camcorders today is DV, along with its close relatives (Panasonic) DVC Pro and (Sony) DVCAM. We often refer to these three formats as DV25; where the “25″ is the number of megabits per second. DV compresses standard definition video by a very useful factor of five. It brings the data rate down to a point where you can get an hour or so of DV on a videotape, and several hours on the average desktop computer’s hard disk. Over the last five years or so, computers have gotten faster and hard disks have gotten bigger, to the extent that you can work quite happily with DV on almost any modern computer.
But HD produces five times as much data as SD. If we were to only compress HD by the same amount as we squeeze SD, then we’d only manage to get about 12 minutes of video onto a DV tape, and we’d only be able to do that if we could move the tape at five times the speed. With a rotating head recording system this is not a trivial engineering task. So, HD has to be compressed a lot more than SD if we’re going to be able to work with it. And this presents us with a dilemma: compression reduces quality, and yet the very reason we’re using HD in the first place is to improve quality.
Until HDV appeared on the scene, there was no way out of this particular conundrum. And it solves it in a very clever way -— by using time.
Squeezing the Most Out of Compression
First, understand that we’re not talking about the type of compression used to “zip” files on a PC. This type of compression can reduce data files by analyzing the statistics of character use, and assigning “tokens” to the more frequently used ones. The more common the character, the shorter the token used to describe it, and vice versa. This, together with a few other techniques, means that when you “unzip” the file, you’ll get a perfect copy of the original. This is called “lossless” compression and it works very well.
But it doesn’t work so well with audio and video because, to a lossless compressor, digital audio and video look like random data. So there are no patterns to recognize, and so they can’t be compressed (there are some lossless compression codecs that work with audio and video — including the Canopus Lossless codec included with EDIUS editing solutions — but while they give very good quality, they don’t work at the high compression ratios that are essential for fitting HD onto a small-format videotape).
Video compression works differently. With such huge compression ratios needed, there’s simply no way to reconstruct the original data file. There’s no need, either, because if the result looks the same (even if the data file is different) then, to all intents and purposes, it is the same. As we’ve already mentioned, video compression is a complicated business. But it’s very easy to understand the basics. It’s a good idea to learn a little bit about how this stuff works because compression does affect the way your video will look. Knowing where the problems are will help you work around them, or avoid them in the first place.
Video compression normally works by looking at the content of a frame, analyzing it, and looking for ways to describe it that don’t involve giving a value for every individual pixel. There are several ways to do this. In a simple case like this, all the compressor has to do is say “every pixel in this frame is the same shade of white”. That’s a lot less data than writing “255, 255, 255″ four hundred and fourteen thousand, seven hundred and twenty times. Another way that video compression works is to look how sharp the borders between light and dark shades are and find ways to describe them more efficiently. It does this by dividing the scene into blocks of pixels, called macroblocks, and representing them with numbers that can recreate the patterns within them (all so-called Discrete Cosine compressors, including DV and MPEG work like this).
Despite the complexity of this process, it’s an established technology and works very well. But it doesn’t give a good enough compression ratio for high definition. This is where time travel comes in handy. We’ve already seen that video compression works by looking for easily describable features within a video frame. If these features are repeated, then it’s only necessary to describe them once. And exactly the same applies to nearby frames, as well as within the frames themselves.
Imagine a white wall. There’s nothing at all in the frame, and nothing changes over time, either. So all the compressor has to do is count the number of frames in the shot, and say “all these frames are the same”. If every frame is the same, you only need to record the details once.
Things get a bit more complicated when there’s movement in the video. If there is movement in only part of the frame, then only the moving parts need to be updated as time passes. The pixels describing the motionless parts still only need to be sent once. And even where there’s movement, it’s still possible to reduce the data by “tracking” the path of the moving objects. Suppose there’s a car driving from right to left in the frame, while the camera viewpoint is fixed. The block of pixels that describe the car effectively doesn’t change at all, but their position in the frame does. So all the compressor has to do is figure out where the motion of the car begins and ends, and move the same block of data along that path.
HDV uses MPEG-2 Compression
MPEG-2 is exactly the same type of compression that DVDs use — so it’s well tried and tested. The only difference is that the pixel count is scaled up to cope with HD resolutions. MPEG-2 is very good at using similarities between frames, so it divides video into bunches of frames called a Group Of Pictures or GOP. A GOP contains several different types of compressed frames. There’s no need to go into too much detail here, but these are the basic types:
- “I” frames are compressed frames that do not depend on any frames around them.
- “P” and “B” frames are predicted from the content of adjacent frames. You can’t decompress an isolated “P” or “B” frame because of their dependency on other frames.
There is a version of MPEG-2 used by broadcasters that doesn’t use GOPs, it only has I frames. It doesn’t compress the video as much as long GOP formats. DV compression is like this too, with good reason. When you’re editing video, you need to have equal access to every single frame. Editors want precise control over their footage so they can make cuts in exactly the right place. If you were only able to make cuts every five or ten frames, it would be difficult, not to say impossible, to edit — especially where dialogue is involved.
Working with HDV
We’ve already seen that compressing HD tightly enough to fit it onto a DV tape presents us with a fundamental difficulty: greater compression leads to lower quality. And we now know that the compromise that makes it all work is MPEG-2 Long-GOP compression (a bit of a misnomer because Short GOP means I-frame only, which isn’t a group of pictures at all).
The truth is that Long-GOP compression wasn’t designed for editing video. It was devised as a way of delivering video to end users. MPEG-2 Long-GOP is how digital TV gets to most digital TV viewers in the world. It’s used for satellite TV, cable TV, digital terrestrial TV and DVD. It works extremely well. Most people think that DVD video is the best they’ve ever seen. So Long-GOP can deliver outstanding pictures.
Long-GOP is good for delivery because it offers very high compression, and good quality — and because end users typically don’t edit incoming television programs. But with HDV you have to edit a long-GOP format. We’re going to look at how this works, and how to get the best from this clever compromise.
First of all, let’s dispose of the idea that the non I frames in HDV (i.e. the P and B frames) aren’t actually there. Even though they are completely derived from the frames around them, P and B frames do actually deliver a picture. They have to, or none of this would work at all! When HDV is decompressed, all the frames are there on your screen. When it’s all working properly, you can’t see any difference between I, B and P frames.
There are several schools of thought about the best way to edit HDV. Canopus gives you all the options so that you can choose whichever is best for you. But remember, the quality of your finished video is only as good as the weakest link in the chain, which is why Canopus has concentrated on these potential problem points and has given you the best possible solution.