What, Exactly, Is Compression?

What, Exactly, Is Compression?

Whether you realize it or not, your Mac probably uses compression nearly every day. Almost anything that comes with an Installer uses compression, and many file formats, such as GIF, JPEG, and PDF, have built-in compression and decompression. If you've ever seen StuffIt Expander doing its thing on your Mac, chances are it was decompressing a compressed file.

So what's this compression thing all about? Do you care? Do you need to care?

In the simplest terms, compression makes files smaller. Smaller files use less disk space and travel faster. As for whether you care, if all you want to do is to make some DVDs quickly and easily, the answer is a qualified, "no." Compression goes on "behind the scenes" or "under the hood." You don't see it but it's almost always there. And just as you don't need to know what's going on under the hood of your car to drive it, you don't need to know one iota about compression to make yourself a darned impressive little DVD.

But I believe that the more you know, the better your decisions can be. Since compression affects almost everything you do with iDVD (and with the Mac itself), you probably should know something about it (even though I just said you don't have to).

But first, we interrupt this chapter for an acronym break. As you know, where technology goes, acronyms follow, and DVD-making is no exception. So before we travel any further, here's a brief explanation of some common video and DVD-making word jumbles.

graphics/note_icon.gif

I won't waste trees defining them here. If definitions interest you, you can find better definitions than I'll ever write and a whole lot more at Web sites like http://mpeg.telecomitalialab.com/ and http://bmrc.berkeley.edu/frame/research/mpeg/mpeg2faq.html.


The Obligatory Acronyms

JPEG: Joint Photographic Experts Group

MPEG: Motion Picture Experts Group

TIFF: Tagged image file format

GIF: Graphics interchange format

CBR: Constant bit rate

VBR: Variable bit rate

AIFF: Audio interchange file format

fps: Frames per second

NTSC: National Television System Committee (U.S. TV standard)[*]

PAL: Phase alternating line (European TV standard)

VCD: Video compact disc

SVCD: Super video compact disc

DVD: Digital versatile disc (a.k.a. Digital video disc)

AAC: Advanced audio compression

MP3: MPEG-1 layer 3 audio

[*] Video professionals often joke that NTSC actually stands for "Never Twice (the) Same Colors," because the standard allows for a lot of variation.

Enough MPEG to get by

Though iDVD makes things easy, there's more to making a DVD that will play in a consumer DVD player than meets the eye. For one thing, the video has to be encoded in the proper format. In the case of DVDs, that's a format called MPEG-2.

I'm going to hit the high points of MPEG-2; if you want the down-to-the-bone nitty-gritty, with all the mathematics and buzzwords included, check out http://mpeg.telecomitalialab.com/ and http://bmrc.berkeley.edu/frame/research/mpeg/mpeg2faq.html.

But merely being encoded in MPEG-2 is not enough. To play back properly, the bit rate (data transfer speed) has to be within a certain range, the frame size has to be just so, and various support files must be on the disc and in the proper directory (folder).

MPEG-2 isn't just for making $3 DVD-R discs, either. SVCD is another format that uses MPEG-2 compression. SVCD can record up to 90 minutes of video on inexpensive CD-R discs (although for good quality, 40-45 minutes is more typical).

And that's enough about MPEG to get you by.

Compression types

Most compression algorithms (methods or recipes) are designed to work best on a particular type of data. Different schemes excel with different types of data text, graphics, video, audio, or whatever.

Whatever the technique (algorithm), compression comes in two flavors: lossless and lossy.

You use lossless compression when you want to lose nothing in the compression and decompression process. It's the proper choice to reduce the size of files containing text (such as word processor or spreadsheet files), or any other file that needs to be exactly the same when decompressed.

StuffIt, ZIP, TAR, and some flavors of GIF and TIFF use lossless compression. Figure B.1 shows the effect of compression on a 1 MB folder.

Figure B.1. StuffIt Deluxe's lossless compression shrinks the Royal Flush folder by more than 50 percent!

graphics/bfig01.gif

Aladdin Systems' StuffIt turned a 1 MB folder (Royal Flush) into a 472 KB archive file (Royal Flush.sit).

graphics/note_icon.gif

There are 1,024 kilobytes (KB) in a megabyte (MB).


When decompressed, the 472 KB StuffIt Archive will yield a 1 MB folder identical to the original, without having lost a single bit or byte.

The other flavor is lossy compression. It's called that because some data is always thrown away forever when the file is compressed. In most cases, it's data that doesn't affect the way the file looks or sounds after decompression, or at least doesn't affect it too much. JPEG and MPEG are types of lossy compression.

Figure B.2 shows the effect of lossy compression on a low-resolution picture (a screen capture). The one on the left is compressed around 25 percent, and doesn't look much worse than the original. If you were displaying this graphic on a Web page, the compressed version would load faster.

Figure B.2. Compare the slightly compressed (bottom left) and highly compressed (bottom right) JPEG-encoded pictures to the uncompressed original (top).

graphics/bfig02.gif

Figure B.3 shows the result of JPEG compression on a high-resolution photo.

Figure B.3. The more compression, the lower the image quality.

graphics/bfig03.jpg

There are three sets of pictures in Figure B.3. Each set has six images: The original 5.1 MB high-resolution TIFF file, four JPEG-compressed copies, and the Finder window displaying their sizes. The set in the lower right is actual size, the middle set is magnified 300 percent, and the set in the upper left is magnified 600 percent.

The 25 percent setting applies the least compression, but produces a file one-fortieth the size that looks almost identical to the (bloated) original.

The 50 percent setting applies a bit more compression, and yields a file even smaller a mere 88 KB. But as you can see in the magnified sets, you're beginning to get some image degradation.

You'd rarely use compression settings as high as 75 percent or 100 percent in real life, but you can see what happens to an image when you do detail is lost and image quality suffers. Sure the files are even smaller, but now they're ugly.

Video compression works almost the same way the more similar each frame is to the ones before and after it, the more compression you can apply without ill effects.

There are many other ways to reduce the size of a movie file besides compression. The two most obvious ways are reducing the frame size and the frame rate. The smaller the image, the less disk space required; the fewer images displayed per second, the less disk space required.

Beyond these rather brute-force techniques, though, you'll find a plethora of compression schemes for video involving the use of one codec (compressor-decompressor) or another.

The codecs used for video CDs and DVDs are different flavors of MPEG. Other codecs that QuickTime can use include DV Stream, Sorenson, Animation, and CinePak, to name just a few. The one that's most important to you at this time is DV Stream, since it's the format iMovie feeds to iDVD.

Why Some Pictures (and Movies) Compress Better Than Others

You'll soon find out that some files compress better than others. Some will continue to look great even after you've saved them with high compression settings. Others display visible "compression artifacts" even if you save them using low compression settings. Furthermore, some files shrink a lot and others shrink a little.

Why is this? The technical reasons could fill a book, and have more than one, too. But the simple explanation is that the less complex an image is, the better it responds to compression.

I selected the picture in Figure B.3 not because I have a gigantic ego, but because it exaggerates the effect of compression. It has a relatively small color palette (I know it's black-and-white here, but trust me on this one) and large areas of the same or similar color (the white background, the black T-shirt, and the red guitar in particular), so it can withstand a lot of compression before you notice the image degradation.

graphics/note_icon.gif

One thing you'll notice about video compression is that it decompresses a lot faster than it compresses. It isn't unusual for compression to take five or more times as long as decompression. The main reason for this difference is that during compression the data has to be analyzed to determine which compression techniques need to be employed. During decompression, that analysis is unnecessary. See the discussion "Down to the Real Nitty-Gritty" below.


At the end of the day, it all comes down to this: the more compression, the worse the image quality. Compression is good, but there's such a thing as too much of a good thing. Don't overdo it.

I have two more compression tips for you before we move on.

  1. Start with the best raw materials you can.

    Remember that compression removes detail that can never be put back. It's like toothpaste once it's out of the tube it's nearly impossible to restore. So the better the image or footage is to begin with, the better it will look after compression.

    graphics/note_icon.gif

    This is a variation on the well-known GIGO (garbage in, garbage out) theory.


  2. Use a tripod whenever possible.

    Unnecessary camera movement is the enemy. The less you move the camera, the better compression will work (and look). If you can't use a tripod, stabilize the camera against something like a wall or tree to minimize accidental motion.

    graphics/warning_icon.gif

    Many set-top DVD players choke on SVCD and its older brother VCD. In fact, even some DVD players that claim to support SVCD or VCD don't. Try a disc or two in either format with your DVD player before you get too excited about squeezing 80 minutes of video onto 20 cents worth of disc.




The Little iDVD Book
The Little iDVD Book
ISBN: 0321197747
EAN: N/A
Year: 2003
Pages: 62

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net