Understanding the concept of MPEG-2 and DVD authoring can be frustrating, but when you break down the terminology, you'll have better understanding of the process.
"A full body cast?!" I shrieked.
"Well," my mother replied, "you know your great aunt Edna, she always said she was going to ski jump on her 80th birthday."
"She broke eight bones ski jumping?"
"Oh no, she went through the jump without a hitch. The broken bones came when she got thrown from the mechanical bull at the party afterwards."
And there she was, poor Aunt Edna, stretched out on a hospital bed wrapped in plaster from nose to toe. She wasn't able to do much of anything on her own, so my mother insisted I come visit with her.
"So," I said, sitting down, "is the food here any good?"
Aunt Edna's eyes darted left and right. She was always sharp as a tack. The clock ticked. Somewhere I heard a dog bark. I tried to think of something that was going on in my life that I could tell her about.
"Hey!" I said finally, "let me tell you about MPEG-2 encoding for DVDs!"
What is MPEG and How Does It Work?
MPEG stands for Motion Picture Experts Group. As you might imagine, it's a consortium of people who know a lot about how to make moving pictures and wanted a digital compression standard which would best represent their interests. This means getting the highest quality of video in a relatively small space. There are two types of MPEG encoding that can be used on a standard video DVD: MPEG-1 and MPEG-2. MPEG-1 is almost never used because of its comparatively pathetic bitrate.
MPEG-2 is a highly compressed, lossy format. ("Lossy" means you "lose" a lot of image quality when you apply a lot of compression.) Different encoders produce different results, and some compress better than others do. How good your MPEG encoder is has a direct result on how much video of what quality you can fit on a DVD.
How Does MPEG Store Audio and Video?
MPEG compresses groups of frames together. This is very useful — if the sky is blue in frame one, chances are it will be blue in the next frame, and the one after that, and the one after that. The more repetition there is, the higher the rate of compression. If, for example, you had a 900 page document that consisted solely of the letter "a" replicated two million times, you could compress that entire book down to the instruction "repeat the letter 'a' two million times". We use a rudimentary form of compression every day when we use "Dr." to represent the word "Doctor" and "St." for "Street." Both of these we decompress on the fly without thinking of it when we say, "Doctor Jones lives on Elm Street." We have these automatic compression schemes because we use these words frequently. By viewing multiple frames, the MPEG compressor is able to find frequently used "words" and come up with the best compression for them.
By doing this, MPEG can achieve remarkable rates of compression. An hour of DV encoded at a rate of 5:1 can take up 20 gigabytes of disc space while a 4.37GB DVD can fit a two hour movie on it and still have space left over for a couple of trailers and a blooper reel. That's significant compression. The down side of this great compression is that one blob of data now represents several frames of video — which means there is no frame-accurate editing without that blob of frames first being uncompressed. MPEG, remember, is lossy compression, so every time you uncompress and re-compress, you lose video quality.
Constant Bitrate vs. Variable Bitrate
Not all compression is created equal. A high action play on a televised football game and a newscaster sitting at a desk talking represent significantly different problems for MPEG encoding. Since frames are bundled together, a talking head without much motion can be compressed significantly (the only thing that really changes in great detail is a small portion of the newscaster's face), whereas the streaking motion of a fast-moving sports play requires a lot of updating. For this reason, many MPEG encoders are "variable bitrate" (VBR) — they'll compress slow-to-change sequences highly (say maybe at 4 megabits per second) and rapidly changing ones less so (such as 8 megabits per second). Typically, these average out to 6 megabits per second over time. Constant bitrate encoders (CBR) work faster than their variable counterparts, but if encoding something with a lot of action, can have compression legacies. The best encoders use multi-pass VBR encoding where the data is first examined on one or more passes and then compressed on a final pass. This assures that the data receives the best compression.
You can put audio on your DVD in one of several formats.
- Uncompressed PCM (Pulse Coding Modulation) — usually Microsoft WAV format or Apple's AIFF (Audio Interchange File Format): Huge size, 10x larger than AC3.
- Dolby Digital compressed AC3 (Audio Codec 3): Highly compressed, can be stereo or surround, bitrates from 128-384k. Probably the best all around choice.
- MPEG (Layer II) compressed: Not officially supported except in PAL, but most NTSC players can now handle it.
- DTS (Digital Theater Sound) compressed: Similar to AC3 in terms of quality, but it uses higher bitrates.
Authoring Your DVD: Final Word
We're probably in the minority, but we wish that when you put a DVD in, it would just play. No hunting around for the remote, no clicking on the "play movie" option, and, most importantly, no 10 second loop of music to play over and over again, driving us insane while we're out in the kitchen making popcorn. Break the trend — resist the urge.
However, there are reasons you may want to have your DVD open up to a menu that allows you to, for example, set up different audio features or choose between one of several videos on the same disc.
"So," I said, as my mom came in with a vase of flowers. "Anything else you want to know about MPEG-2 encoding, Aunt Edna, you just let me know." I gave her a kiss on the forehead, and three months later, when she was out of the cast, she sent me a DVD of her snow jump and the unfortunate mechanical bull incident. I was pleased with the technical advisory credit she gave me.
Contributing Editor Kyle Cassidy is a video artist, network engineer and co-author of Enterprise Internetworking and Security.