Posts in Category "General Video Concepts"

Manic Compression

At some point in the life of a digital video clip, it gets compressed (often several times). The whole idea behind compression is to lower the amount of data in the video in order to make its file size smaller, and/or make the data rate lower. Smaller files take up less storage space, and are easier to move around, while video with a lower data rate can be streamed over the internet, or be played back on a slow computer. If it were not for compression, there would be no way to cram a feature film onto something as small as a DVD, or to record high quality video onto a tape as small as the ubiquitous Mini-DV format.

There are two kinds of video compression — lossless and lossy. Lossless compression lowers the amount of data in the video without any visible quality loss (although I know quite a few television engineers who will debate this point ’til somebody gets punched). Lossy compression degrades the video to some extent, sometimes noticably sometimes not. It all depends on the Codec used, and the settings of that particular Codec.

Codec stands for Compressor/Decompressor. There are Codecs that are hardware based (like the Codec used in a Digibeta camera) and others software based (like the On2 VP6 Codec used in Flash Video 8). The video on DVDs is compressed with the MPEG-2 Codec, which is also used for satellite and digital cable transmission (you know how the picture falls apart a bit on some of those esoteric channels on your digital cable? That’s your old pal MPEG-2 !).

Both Quicktime and Windows Media have many Codecs within them, and knowing which one to use when is a fundamental in digital video postproduction.

Let’s take a look at the most common workflow: DV. A Mini-DV camcorder records a compressed video signal to tape with its internal lossy DV Codec. DV compression is 5:1, meaning for every 5 bits of data, it only writes 1 to tape, throwing away the other 4. The resulting loss in quality is not generally noticeable to the untrained eye, but for those of us that do this for a living the loss of color range, digital artifacts, and plain old noise in the compressed video is easy to recognize (and debate until somebody loses a tooth).

When you capture your tape to hard disc using Premiere Pro or other software, the video becomes an AVI (Windows Media) or Quicktime file written with its DV codec.

The AVI Video Compression dialog in After Effects, showing the Microsoft DV Codec selected, within a pulldown menu showing all the AVI Codecs installed on my system.

Essentially, the compressed DV data is copied from video tape to hard drive via a Firewire cable, with no further compression taking place. If all you were to do is edit the video without rendering anything and lay it back to tape, it would never undergo any further compression.

But here’s the thing, if you render a DV Codec clip with the DV Codec, it will get compressed again. 5:1 lossy compression. That means you take something where you’ve already thrown away 4 bits out of 5, and then throw 4 bits out of 5 of that remaining 1 bit away. In other words, you wind up with something that looks like it went through a meat grinder. It’s not pretty.

So how to conquer this? Render uncompressed, or even better, to a lossless Codec. As you can see in the figure above, you can select “No Compression” and your rendered video will suffer no quality loss. You will, however, wind up with a huge wonking file, so this method means that you’ll need to have plenty of hard drive space if you’re doing lots of renders. A better solution is to render using the Animation Codec, which is part of Quicktime.

Quicktime’s Animation Codec, set to “Best” quality, which results in lossless compression.

When its Quality slider is set to “Best”, the Animation Codec’s compression is lossless. The files are much smaller than uncompressed files, but there is no noticeable loss in quality. This is one of the main Codecs used in the After Effects workflow, and is great “intermediate” Codec to use when working with DV material. As long as you render this way, you’ll never lose quality — although if you’re going back to Mini-DV tape you’re going to have to render your final results to a DV Codec eventually (a good reason to avoid doing this).

There are two Quicktime Codecs you should absolutely, under no circumstances, ever use. Those are Cinepak and Video (ironically). Starting with the latter, the Video Codec is a legacy Codec within Quicktime, dating back to the early ’90’s, and is simply not suitable for Video (although it must have been at some point back in the day). Cinepak is another oldie-but-baddie and was the first Codec used for cramming video onto CD-Roms. Like the Video Codec, it’s now obsolete, and is still included in Quicktime for legacy file support, but that’s the only reason it’s there so like drunk driving just don’t do it.

If you’re putting your video on the internet, you want to use Flash Video 8, which compresses and decompresses using the On2 VP6 Codec (a Codec we license from a company called On2). You can encode to Flash Video with Premiere Pro 2.0 by going to File>Export>Adobe Media Encoder. In After Effects 7.0, go to File>Export>Flash Video. You can also use the standalone Flash Video encoder that comes with Macromedia Studio 8, or just do it in Flash Professional 8.

To get your video onto a DVD, encode it to MPEG-2 using the Adobe Media Encoder, or bring it into Encore DVD which can also encode MPEG-2. In either case, it will be compressed with the super high-quality Main Concept MPEG-2 Encoder which is included with both Premiere Pro and Encore DVD.

The iPod uses a proprietary MPEG-4 Codec (by the way, “MPEG” stands for Motion Picture Experts Group), and you can encode your video for iPod by dragging and dropping it into iTunes. Mobile phones use Codecs such as H.263.

I could go on and on, but the main thing is to get to know the Codecs you work with on a daily basis – what their settings are and how to manipulate them to get the best results (although some Codecs, such as DV, don’t have adjustable settings). With lossy Codecs, it’s always a trade-off between quality and file size / data rate. You don’t have to become a Compressionist to get good at this, but if you want to dig deeper there’s some great reading out there. My favorite author/authority on the topic is Ben Waggoner, who explains this somewhat complex topic in an easy-to-understand way in his book Compression for Great Digital Video.