Configuring TMPGEnc for high-quality, DVD-compliant MPEG-2



This guide is © Rui del-Negro / Azul SPI. You may place links to this page on your site, you may download or print the guide for your own personal use and you may put it on-line at any other free public site as long as you do not change it in any way and include a link to the original page. Any other use (including, but not restricted to, commercial use) is forbidden without prior written consent by the author.

The settings I will use in this guide are for high-quality DVD-compliant MPEG-2 encoding. If you need faster encoding (and don't mind lower quality) or if you're encoding video for web distribution, Video CD, etc., you will need to make some changes (I have very little experience with VCD/SVCD; if you do a quick search on the web you'll find several sites with guides about those formats).

If some settings in TMPGEnc appear to be locked, this may be due to the fact that you loaded one of the original templates. To unlock all settings, load a settings file called unlock.mcf, that you will find inside the template\extra sub-folder. Newer versions of TMPGEnc also let you unlock the settings by clicking on the text on the left side. If TMPGEnc starts with a step-by-stop wizard, close it and use the full configuration interface.


Note: Due to the size of the screenshots, this page looks significantly better if you use a screen resolution of 1024x768 or above.

If you haven't already, start TMPGEnc (by double-clicking on a shortcut or on the excutable file).

Select Video only as the stream type and click on the Settings button.



In the Video tab, set the following parameters:


Video 2-Pass VBR
Stream type:

MPEG-2 Video
This is the DVD standard.

Size:

720x576 (for PAL) or 720x480 (for NTSC)
These are the standard DV / DVD / D1 full-resolution sizes.

Aspect ratio:

4:3 Display or 16:9 Display (depending on footage)
The aspect ratio should usually be the same for all clips (some authoring programs won't let you use clips with different aspect ratios on the same DVD). Use 16:9 only if the footage was shot with a 16:9 camera, otherwise the image will be squashed.

Frame Rate:

25 fps (for PAL) or 29.97 fps (for NTSC)

Rate control mode:

2-pass VBR
This will give you the best compression and best quality, but takes longer to encode. If you have less than 1 hour of footage, you can use (single-pass) CBR at 8 Mb/s and save some time.

Rate control settings:
Average bitrate: between 4000 and 6000
Maximum bitrate: between 6000 and 8000
Minimum bitrate: between 0 and 2000
Enable padding: Disabled

The final bitrate on a DVD cannot exceed 9.8 Mb/s (including sound, subtitles, etc.). You may use a higher value for the maximum bitrate (up to 9000 or so) if you're going to use compressed sound or if the DVD won't have any sound. You may want to decrease the bitrate (especially the average bitrate) if the footage you're encoding is too big to fit in one DVD. Generally, a value of 6000 for average and 8000 for maximum will produce good results and allow you to fit about 90 minutes into a 4.7 GB disc (assuming you use compressed sound; if you use uncompressed sound you'll have to lower the average bitrate value). Some authoring programs don't like files with bitrates that drop below a certain level, so I suggest keeping the minimum at 2000.

NEW: I have made a simple bitrate and GOP calculator for DVD encoding. It will take information about the length of your movie and its format and suggest values for the bitrate and GOP picture types (described below). You can find it here.


VBV buffer size:

0 (automatic)

Profile and level:

MP@ML
This is the DVD standard. Using higher values may improve the quality, but will make the video incompatible with some DVD players.

Video format:

PAL or NTSC
Depending on the standard you're working with.

Encode mode:

Interlace
The other modes are for film and progressive-scan video. Normal video is interlaced. Some cameras can record in non-interlaced mode (sometimes called "progressive-scan").

YUV format:

4:2:0
This means that for every square of four pixels (2x2) there are 4 brightness samples and 1 colour sample. This is actually the same kind of sampling used by PAL DV. NTSC DV uses the format 4:1:1 where colour information is stored for (horizontal) segments of 4 pixels, instead of squares. The "square" approach usually produces much cleaner-looking images, with less colour bleed, and it's a bit of a mystery why NTSC DV uses 4:1:1 (analog NTSC is a nightmare but they could have got it right when they moved to digital). Regardless of your footage's format (PAL or NTSC), DVD MPEG-2 always uses 4:2:0.

DC component precision:

10 bits
This controls the precision of the discrete cosine values used in the image compression (this translates the image into a series of interfering frequencies and lets the program eliminate frequencies that aren't visually relevant - this is similar to the compression used in JPEG images). A higher value results in better quality.

Motion search precision:

Highest quality
If you need faster encoding, select the high quality mode (significantly faster than highest quality) or the motion search estimate mode (which is even faster - this was actually the mode I was using when I took the screenshot). Quality will be nearly as good, and it will encode much faster. If time isn't an issue, though, stick with highest quality.




Now we move to the Advanced tab:
Advanced
Video source type:

Interlace
This refers to your original footage. Normal video is interlaced.

Field order:

Bottom (for DV) or Top (for analog)
This is the source of many problems, since some systems don't say what field order they use, and some pseudo-DV systems actually capture in analog mode. The field order is set by the capture hardware, not by the editing program, so you can't change it in software without re-compressing all the footage. All you can do is make sure you set this parameter right, so that TMPGEnc knows how to encode the file. If you notice your MPEG video flickers whenever there is fast movement (this will only be visible on video monitors and TV sets, not on the PC screen), then the most likely cause is a wrong field order setting.

Source aspect ratio:

4:3 Display or 16:9 Display (depending on the footage)
In older versions of TMPGEnc, the n-line modes compressed the image horizontally by a few pixels (in PAL, at least). This appears to have been corrected in newer versions, but there is no real reason to use them as long as your original footage has the right size (720x576 for PAL, 720x480 for NTSC). Just pick the "simple" aspect ratios (without any mention of the number of lines) and the resulting file will keep the right aspect ratio.

Video arrange method:

According to the "tooltip" in TMPGEnc, this only influences the display window. However, several people have told me this will have an influence in the finished file if the source and destination aspect ratios and resolutions don't match perfectly. So if your source footage is full-resolution video, any option here should produce the same result. However, if the source resolution does not match the standard DVD resolutions (720x576 for PAL and 720x480 for NTSC), you may need to try different settings to get the result you want. When I have the chance, I'll do some tests and post a description of what each method does.

Filters:

Normally you don't need to apply any, so just make sure none are selected, or processing will take longer. You may want to use the "source range" filter to trim the clip or "clip frame" to crop the image. TMPGEnc's filters are usually somewhat slow, and you only see the result after encoding is finished, so I would recommend applying all the filters you need in your video editing (or compositing) program and using TMPGEnc just for the encoding.







The next tab controls the GOP Structure:

GOP structure
Number of I pictures:

1
I-pictures are compressed independently (similar to JPEG images). This means they're ideal when the image changes too much, but take up a lot of bits. So if you use too many I-pictures, you will need an overall higher bitrate to keep the quality up. If you're using very short GOPs (under 6 frames), you may increase this value and effectively have several sequences in each GOP (see note at the end of this section). Generally, though, stick with 1.

Number of P pictures:

4 (use a value between 1 and 7)
P-pictures are based on previous I and P-pictures. This means they can re-use existing parts of the image and therefore take up much less bits than I-pictures. Using P-pictures lets you keep an overall lower bitrate, and use the excess to improve the I-pictures. However, P-pictures may decrease the image quality if there are too many changes from the previous frame. The option to detect scene change (below) will automatically insert an I-picture if it detects a big change between two frames.

Number of B pictures:

1 (use a value between 0 and 3).
B-pictures are based on past and future I and P-pictures. They provide the best compression but, as with P-pictures, have problems when the image changes too much. Also, bear in mind that B-pictures cannot be based on other B-pictures, so don't use too many in a row or the image quality may suffer, especially if there are any cuts or sudden changes. If you're using a high average bitrate (above 6500), you can use I and P-pictures only.

Max frames in GOP:

15 (for PAL) or 18 (for NTSC).
These are the standard DVD limits. This option is not present in older versions of TMPGEnc. If you're using one of those versions, you will need to control the number of frames using only the three previous settings. If a GOP has more frames than the standard allows, authoring programs will usually reject the file.



Output interval of header:

1 (very important)
This tells TMPGEnc to include a header describing each GOP (group of pictures) before the actual GOP. This is required by many authoring programs.

Output closed GOP:

Disabled (except in special cases)
If you plan to edit the MPEG file or if you're creating streams for multi-angle DVDs, then you should turn this on. Leaving it off improves the compression.

Note: If for some reason your authoring program rejects your files, try enabling this setting; I've been told that some programs have problems dealing with open GOPs. In general, however, you should leave this off, as you'll get better compression (especially if you use B-pictures).



Detect scene change:

Enabled
This will automatically insert I-pictures when it detects very big changes in the image. If you know your footage has no scene changes, or if for some reason you want consistent GOPs, you can disable this.

Force picture type:

Disabled
This lets you define the picture type and encoding parameters for each frame in your video clip. This is a difficult and tedious process, but if you are encoding some very complex (and short) clips, it may pay off. Only for pros with a lot of free time. If you are planning to create chapter points later (in your DVD authoring program) and want them to be frame-accurate, you may use this to force an I-frame at the points where you want to put the chapter marks.



The last tab controls the Quantization matrices:

This subject is too complex to discuss here, and normally you don't need to worry about it. If you're compressing normal video or photo-realistic animation, pick Default or MPEG standard from the list box. If you're compressing (non-realistic) animation, pick CG/Animation. This will load appropriate matrices. Here are the settings for the rest of the options on this tab:

Quantize matrix
Output basic YCrCb:

Enabled
Generally, you should select this option. It will preserve the original contrast of your source footage. De-select this only if some areas of the image are too bright for video monitors to handle. You may also want to turn this off if you're encoding high-contrast computer generated animation.

Floating-point DCT:

Enabled
This will improve the quality by minimising round-off errors.

No half-pixel motion:

Disabled
Turn this on if you notice still images look blurry. Leaving it off will improve the quality of areas with subtle motion.

Soften block noise:

Disabled
You may want to turn this on if you're encoding MPEG-1 or low-bitrate MPEG-2; it will make the image lose some sharpness, but will eliminate some compression artifacts (blocks). For DVD you'll usually use a high bitrate, so you should leave this off.









Two more tabs will appear if you select Video+Audio instead of Video only as the stream type. These are Audio and System. The audio options are fairly straightforward (use the settings that correspond to the original sound format and a bitrate between 128 and 384 for stereo), and the system tab lets you pick the kind of stream you want to create. However, for DVD authoring it's generally a bad idea to create system / program streams. You should create a video only stream and use an uncompressed sound file (48 KHz, 16 bits, stereo) for the audio. Some set-top players will not play MPEG audio; you should leave the sound uncompressed or convert it to Dolby Digital™ AC3 format (for this you will need a separate encoder, or an authoring program that is capable of converting uncompressed sound to AC3). See you authoring program's manual for details on how to load and link the audio and video files.

Now that you have created an encoding template, click on OK and then Save it in TMPGEnc's Templates folder with any name you want (ex., "VBR-PAL-DVD.MCF". Every time you use TMPGEnc, remember to load that template so all your settings are restored. If you install a new version of TMPGEnc, you should re-create the template manually. Old templates may not load correctly.

Before closing TMPGEnc, go to the Options menu, pick Environmental settings and make sure the folder for temporary files is in a drive with plenty of free space. You may check the other options here, but most of them aren't very relevant (and the default settings are fine). If you have a Pentium 4 processor, make sure you have SSE-2 enabled. This should make encoding much faster (although I've been told by several people with Pentium 4 systems that the difference is minimal). If your system has multiple processors, activate multi-threading, otherwise TMPGEnc will only use the first CPU (if you only have one CPU, enabling multi-threading will usually make things slower).

Note: In case you didn't know, TMPGEnc is an abbreviation of the program's original name: Tsunami MPEG Encoder. You can download the trial version for free at the program's site, but now a commercial version (without the time limit) is also available. Despite being relatively slow, TMPGEnc is affordable and widely regarded as one of the best (if not the best) MPEG-2 encoder currently available. Although I am in no way associated with the program or its author, I strongly encourage you to register your copy as soon as possible. I wouldn't be at all surprised if some big company bought it and increased its price dramatically. After all, MPEG-2 compressors of similar quality sell for over 1000 dollars / euros.




If you came here from the AVISynth guide page, just close this window to go back to it. If you came to this page directly, click here to see how to set up AVISynth to export video directly from Premiere to TMPGEnc (that page also has links to TMPGEnc's and AVISynth's sites). Send any questions or comments about this page to rmn@netcabo.pt. Please don't send me any questions about DVD ripping, DivX or VCD. I have very little experience with those. This guide is about converting full-resolution, professional (or semi-professional) video formats (such as DV or Beta) to DVD.

Also, if you use MS Internet Explorer or MS Outlook, please do not add my e-mail address to your address book. These two programs are known for their security problems and several viruses are able to use their address books to automatically e-mail themselves to other people. Other programs (such as Opera, Mozilla, Eudora, etc.) are secure. I receive several e-mail viruses on a daily basis from people with Outlook / IE. Instead, keep a link to this page on your "Favourites" or "Bookmarks", and click on the link above to send me mail.




Copyright © Rui del-Negro / Azul SPI 2002 - All rights reserved.

Valid HTML 4.01