Step 5: AviSynth Script Creation
We will now use QuEnc to transcode our AVI files to a DVD compliant MPEG-2 stream. However, QuEnc only accepts AviSynth scripts inputs, not AVI files directly. This is not a problem at all though, because AviSynth scripts are basically just text files that one can create with any text editor. What is more difficult, it working out the aspect ratio and resolution settings, which due to DVD's way of storing and displaying video, can be somewhat confusing. Doom9 has a guide which explains the process quite well, but what I have done here, and it's a first for a guide here on Digital Digest, is to provide a function that will generate the AviSynth script for you with all the resizing parameters filled in based on your source file's input size.
To use this function, simply enter in the local path to your video file (eg. C:\temp\Borat\Borat-fixed.avi), the source resolution in width/height, whether it's NTSC or PAL (as determined all the way back in Step 1) and whether you want an anamorphic encoding or not.
The last point need to be expanded upon further before we proceed. Since most AVI inputs are using square pixels, there's only a little bit to be gained from anamorphic encoding unless your input video exceeds the DVD resolution (720x480 for NTSC and 720x576 for PAL) or if your input video uses high bitrates and you don't want to lose valuable available bitrates by using too much of it on the black borders. But it makes very little difference to encoding time and authoring (if your DVD authoring tool supports anamorphic video, which it should), so it might be worth the effort. If your input video is already anamorphic, then do not select the "Encode Anamorphic?" option.
Once you generate your AviSynth script, simply copy it into your favourite text editor and save the file with the .avs extension. This script is now ready to use in QuEnc in the next step. Note that if you decided to use QuEnc to encode your audio as well, then change the part of the script where it says "audio=false" to "audio=true".
Step 6: QuEnc MPEG-2 Encoding
Start QuEnc. Load in your AVS script that was generated in the last step. Make sure the "Codec" setting is set to "MPEG-2". For your bitrate settings, you will need to calculate the bitrate to use so the size of the file fits into your DVD project. This involves the length of your video, the bitate already used by the video, the amount of space you will use for menus and other videos on the disc. But if you already known the amount of space your video file will occupy (and the video length, of course), the bitrate of your audio file(s), then the calculation is (if you are using QuEnc to encode the audio too, then don't minux the "Total Audio Bitrate" as the bitrate entered here will include the audio's bitrate):
((Amount of available Space in MB minus menus and other videos) * 1024 * 8 / (Number of Seconds of Video)) - (Total Audio Bitrate)
For example: ((3800 MB) * 1024 * 8 / (120 min * 60 sec)) - (2 x 448) = 3427 kbps
There are many bitrate calculators available to use if you're having trouble. When you have arrived at the bitrate you want to use, enter it into the box. I like to select all the other options (use VBR, High Quality, Use Trellis Quant and 2 Pass Encoding). These are all settings that will improve quality when enabled, but will slow down encoding quite a bit (so for fast, no nonsense encoding where quality isn't paramount, deselect all these settings).
Now, click on the "Advanced" button. Let's go through the settings that might need changing in this section.
The "Extreme & Slow" setting can be selected if you want maximum quality at the cost of encoding speed. "GOP" and "Max B-Frame" settings should remain at 12 and 2. "Forced Closed GOP" should not be used unless you are encoding the multi-angle part of the DVD. "Scene Detection" places an I-Frame at scene changes, which might be useful for placing chapter stops at these places.
Select "16:9 Aspect Ratio" if you decided to use anamorphic encoding in Step 5 (or if your source video was already anamorphic). Otherwise, select 4:3 Aspect Ratio. We'll leave the GUI settings alone since it has nothing to do with encoding.
Over on the other side, change the DC Precision setting to "10".
Change the "Max Bitrate" to a value that is 9800 kbps minus your audio bitrate. For example, if you have one audio file at 384 kbps, then the max bitrate should be 9800 - 384 = 9416 kbps. If you have two audio tracks, two at 448 and another at 192, then the max bitrate would be 9800 - 448 - 448 - 192 = 8712 kbps. If you are using QuEnc to encode the audio as well, you can enable "Auto Max Bitrate" to let QuEnc determine the max bitrate automatically.
The other options here can be left alone. Skip to the bottom, and the "Mux Profile" setting can be changed. If you want a single MPG file that includes audio (if using QuEnc to encode the audio), then choose the "DVD" profile or "Separate Passes" if you want individual video/audio files (good for authoring tools like DVD-Lab Pro). If you've followed this guide and already encoded your audio, then you will only have the "No Audio" profile. If you did decide to encode the audio using QuEnc, then you can select the output audio format: AC3 @ 192/256 kbps for stereo and 384/448 kbps for 5.1ch is recommended.
Press "Apply" to apply the advanced settings and return to the main QuEnc screen.
Press "Encode" to start the video (and audio) encoding). When QuEnc finishes, you will have a DVD compliant MPEG-2 video stream (M2V), an AC3 file or a MPEG-2 file that includes both streams.
The next steps provide instructions for performing 3:2 pulldown on 23.976/24 FPS video which is needed for making NTSC DVDs, and also instructions on how to multiplex your separate M2V/AC3 files into a MPEG-2 (MPG) file for certain DVD authoring tools that only accept this type of input.