Encoding MPEG-2 for DVD

To make a DVD that is playable in home set-top players, all video content must be encoded to MPEG-2 within certain parameters. This guide covers how to encode MPEG- 2 video that is compliant with the DVD specification. While this guide focuses on using TMPGEnc to do the encoding, the general principles must be applied to any MPEG-2 encoder.

Separating Audio and Video

Most DVD authoring packages (the program you use to create your DVD program) require the audio and video to be in separate files. To do so, load your completed movie (which will probably be a DV avi) in a video editor such as Premiere or VirtualDub. Export the audio of the entire video as a wav file. This wav can then be imported directly in to the authoring program or compressed to Dolby Digital (ac3). Obviously, once you have separated the audio and video, you do not want to make changes to the length either file, since this will cause them to be out of sync.


Encoding Video

As stated above, this guide is geared towards TMPGEnc. First, select your video source. In the movie contains audio, then the movie will be listed as the audio source as well, but since we are working with the audio separately, you can delete the audio source.

At the lower right is a selection for stream type. Your stream MUST be "Video only." In other programs, this stream type is referred to as an elementary stream. It will have a file extension of .m2v. Most authoring packages cannot import system streams (also called program streams) that have the .mpg or .mpeg extension.


Setting Menu

The bulk of your tweaking in TMPGEnc occurs in the MPEG Setting (sic) menu. It is accessible by pressing the "Setting" button at the lower right corner of the screen. There are six tabs of settings:

Video Tab

Stream Type: MPEG-2 Video. For high quality DVD video, this is the standard. Note that while DVD players can play back MPEG-1 on a DVD, you cannot mix MPEG-1 and MPEG-2 on the same disc. Plus MPEG-1 is of much lower quality than MPEG-2.

Size: 720x480. This is for NTSC (US) video. For PAL, the size is 720x576.

Aspect Ratio: 4:3 Display. This is what you want to use 99.9% of the time. DVDs can also use 16:9 display, but only use this if your source video is 16:9 (widescreen).

Frame Rate: 29.97 fps. This is for NTSC. For pal, use 25 fps.

Rate Control Mode: Your have two choices here:

Constant bitrate (CBR): CBR gives much faster compression yet is less efficient, so will usually give you larger file sizes. If your video is rather short (under 30 minutes) then you can use CBR at a high bitrate without worrying about space.

2-pass VBR: This option uses a variable bitrate where more bits are allocated to scenes that need them, while reducing the bitrate for rather simple scenes that do not require many bits. As a result, the compression is much more efficient (no bits are used that aren't needed) and the file sizes are smaller. The disadvantage is that VBR is much slower to encode. This options uses two passes. The first pass the encoder goes through the video and calculates how many bits to allocate to each part of the video. No actual encoding is performed during the first pass. The second pass is when the video is actually encoded. VBR is useful for when you are trying to cram a lot of video onto the disc yet you don't want to skimp on the bitrate to fit it all (and you also have a lot of time on your hands).

Rate Control Setting: Next to the rate control option is a Setting button. Click on it to bring up the bitrate controls for your chosen rate control option. This window varies by which rate control mode you have selected.

If you selected CBR then this window will contain the bitrate control.

If you selected VBR then this window will contain settings for Average birate, Maximum bitrate, and Minimum bitrate.

A bitrate of 9.8 Mb/s (or 9800 kbit/sec, as TMPGEnc expresses it) is the maximum bitrate allowed by a DVD. This includes EVERYTHING; video, audio, subtitles, etc. Audio that is a PCM wav file has a bitrate of about 1.5 Mb/s, which leaves a maximum of about 8 Mb/s left for the video (with ReelDVD, audio can be compressed to Dolby Digital, providing more space for video).

However, there is an additional concern, and that is that some DVD players have trouble playing back DVDs encoded at high bitrates (this is usually exhibited as stuttering and skips in the video). Therefore, if you want to make a DVD that is compatible with as many DVD players as possible, a good rule of thumb is to stick to a maximum video bitrate of 7 Mb/s. If you are just making a DVD for yourself, you can go higher if you know your DVD player can handle it.

In TMPGEnc, an average bitrate of 6000 kbit/sec (6 Mb/s) tends to give very good quality for most video projects. High action and video that is "busy" may require more. With VBR, you can usually set the max bitrate to 7 or 8 Mb/s, and the minimum bitrate to 2 Mb/s or even 0.

Most Hollywood DVDs use VBR and have an average bitrate of only 3.5 Mb/s. However, they use much more powerful MPEG-2 encoders and have trained compressionists (yes, that is a real job) tweak the video scene by scene to get top-notch results. You probably won't get Hollywood quality at 3.5 Mb/s using TMPGEnc, which is why I recommend at least 6 Mb/s, but even 3.5 Mb/s average VBR encode will probably look not bad.

Bitrate: This setting is only enabled for CBR, and is the same as the setting found in the rate control menu when CBR is selected.

VBV buffer size: 0 (automatic)

Profile and Level: Main Profile & Main Level (MP&ML)

Video Format: NTSC (for US. If in Europe, use PAL)

Encode mode: You have two options:

Interlace: Use this if your DVD will be viewed primarily on a television set. If viewed on a progressive source (such as a computer) interlace artifacts will be noticeable.

Non-interlace: Use only when you have progressive scan content (or video that has been deinterlaced) and your video will be viewed primarily with progressive players such as a computer or a projector. When progressive content is viewed on an interlaced TV, the motion can look choppy.

YUV format: 4:2:0

DC component precision: 10 bits

Motion search position: If you are not rushed for time, use Highest quality, the only drawback of which is that it encodes very slowly. If you want to preserve quality yet you want to encode quickly, use Motion estimate search, which is much faster and for most content the quality difference is not very noticeable.


Advanced Tab

Video source type: Interlace or Progressive, depending on what your source is. (The interlace/non-interlace setting on the video tab referred to what your target MPEG-2 file would be).

Field order: Bottom field first (field B). All DV video is bottom field first (analog video is top field first, yet we only capture DV here at the lab).

Source aspect ratio: 4:3 display. (Or 16:9 display in the unlikely event that you have widescreen footage)

Video arrange method: Full screen (keep aspect ratio)

Filters: Various filters take up the rest of the advanced tab. Click the box to the left of the filter name to enable the filter, double click on the filter name to bring up its settings. I won't go into how to use each one of them here, as you probably won't ever need them. Two that might be of interest are: the Deinterlace filter, which is quite good (there are many deinterlacing methods available. Trial and error is usually the only way to pick the best one), and the Source range filter that lets you choose to encode only a part of your source, which is great for when you want to trim unwanted footage from the beginning or end of a clip.


GOP Structure.

GOP stands for "Group of pictures," which is a collection of frames based upon a single keyframe. In MPEG-2, there are three types of frames: I, P and B-frames.

I-frames are where the entire frame is compressed independent of other frames; that is, they don't use information from preceding or following frames. An I-frame is a bit like a JPEG image, since only intraframe compression occurs. I-frames take up the greatest number of bits.

P-frames are predictive frames that use information from previous I and P-frames. Theses take up much less space than I-frames.

B-frames are frames that use information from I and P-frames that both precede and follow it. B-frames take up the least amount of space and are the reason you can really squeeze a lot of video into a small space. However, they offer the least quality and too many B and P-frames in a scene with a lot of movement can look very bad.

The GOP structure tab is where you designate how many I, P and B frames you want. Note that the NTSC DVD spec requires that GOPs be a maximum of 18 frames.

Number of I pictures: 1

Number of P pictures: 3 recommended, any number between 1-5.

Number of B pictures: 2 recommended, any number between 0-3.

Output interval of header: 1

Output bitstream for edit (Closed GOP): Enable.

Detect Scene change: Enable.

Force picture type setting: Usually this should be disabled. Enabling this and clicking on the setting button to the right lets you select exactly where I-frames will be inserted. This is important because chapter markers on a DVD can only be set on I-frames, so if you have exact spots in your video that you wish to be able to skip to on the DVD, then you may want to enable this option and designate the particular frames you wish to be able to skip too. Otherwise, if you just let the encoder determine the placement of I-frames and you later insert chapter marks, your chapter marks may be up to a half-second off. Inserting your own I-frames is very tedious and time-consuming, so you'll probably want to do it for only really important projects.

I picture only, I,P picture only, Standard: These buttons are presets and are rather self- explanatory. In most cases you will not use them. I picture only is useful for very short clips (1 or 2 seconds) or clips with extreme motion that probably won't contain enough I-frames to accurately capture the motion using a standard GOP sequence.


Quantize Matrix

Quantize matrix: This is a very complex topic that you usually don't need to deal with. Just select "Default" or "MPEG standard" from the pull-down menu and you'll be fine.

Output YUV data as Basic YCbCr not CCIR601: Enable. You may want to disable this if you have computer graphics that use illegal NTSC colors. But then again, you read and followed my "Making Computer Graphics NTSC Compliant" page and so you don't have this problem, right?

Use floating point DCT: Enable.

No motion search for still picture part by half pixel: Disabled.

Soften block noise: Disabled. This soften block artifacts that result from low bitrates, but if you follow my bitrate recommendations, then the rate should be high enough that you won't need this.


Whew! That's it for the settings. Now just return to the main screen, hit the Start button, and wait for the encoding to finish.


Return to Video Guide