PREVIOUS: Adjusting for Quality NEXT: Muxing It All Together

Video

If you completed the Quality stage, (not necessarily including the purple sections) scroll down to the orange sections.

If you skipped the Quality stage, ignore the orange sections.

Go to the Start menu and open (VirtualDubMod icon) VirtualDubMod.

Click the "OK" button if there is a warning.

From the "File" menu, select "Open video file... Ctrl-O".

Navigate to the ripping folder and open (.avs icon) script.avs.

Would you like to know more?AVS script errors
If you get an error at this point, make absolutely sure the script is correct and the .avsi/.dll files are all where they should be. Check the Software stage to see if you forgot anything.

If you get the error "unable to load masktools.dll" and you're sure it's in the proper folder, you may be experiencing an Intel Pentium bug. To fix it, turn off hyperthreading.

If you get an error regarding HybridFuPP, you may need to upgrade to the latest version of AviSynth. Such an error may be an indication that you did not uninstall an old version of Gordian Knot before installing the new one in the Software stage.

If VirtualDubMod immediately crashes, it's probably because your script.avs file contains left and right cropping values that aren't multiples of 4. Go back to the Script stage and adjust those values.

Drag the slider to different locations within the end credits. If they are plain text-only credits, open (.txt icon) video notes.txt and type in the line credits begin:________. Fill in the blank with the frame number where the credits begin.

If the credits are anything more complicated than regular scrolling text on a plain background, don't bother to make a note. If you are encoding a series of episodes, don't bother to make a note.

Would you like to know more?Isolating the credits
Use the right and left arrow keys on your keyboard for frame-by-frame advance. Hold down the Alt key and press the arrow keys to advance 50 frames at a time. Find the frame where the screen goes black just before the credits first appear.

Editing with VirtualDubMod
Using the slider and the "mark out" buttons you can select a small section to be encoded. This is very useful if you want to test your script/settings without encoding the whole movie.

You could use this function to cut out opening or closing credits, but then the audio/chapters/subtitles would be longer than the video. You would need to painstakingly edit them until they fit in the muxed file and were synchronous with the video.

IMPORTANT: At this point you must make sure the picture looks good.

Drag the slider to different locations in order to check the picture for brightness, saturation, and black borders. If it is too bright, edit (.avs icon) script.avs to decrease the YlevelsS brightness value. (The default is 1.2.) If the picture is not bright enough, increase that value.

If the picture looks washed-out, increase the Tweak saturation level. (The default value is 1.2.) If the picture is too colorful, with lots of loud reds/greens/blues, decrease the saturation.

If any black borders are visible, go back to the Script stage and increase the relevant cropping values. (Check the right side of the image carefully--Gordian Knot sometimes leaves a border there that is not apparent during the Script stage.) If the picture is squashed or stretched, that's fine--as long as you carefully followed the directions in the Script stage.

Always save (.avs icon) script.avs and re-open it in (VirtualDubMod icon) VirtualDubMod after editing, so you can see how your changes have affected the picture. When it looks good, continue below.

From the "Video" menu, select "Compression... Ctrl-P".

In the video compression menu, select "Xvid MPEG-4 Codec".

Click the "Configure" button.

Would you like to know more?Multiple XviD options
If you have more than one XviD option on this screen, or if you have one XviD option but it does not look the same as the one in the picture, you must uninstall all old versions of XviD and install only the very newest version. If any of the upcoming screenshots look differently, yours may be out of date. The newest version is always at Koepi's site. Look for the "Latest stable binary". Click now to visit Koepi's XviD page.

Click the "Load Defaults" button.

From the "Encoding type" menu, select "Twopass - 1st pass".

Click the more... button next to the "Profile @ Level" menu.

If you are using 1 CD or encoding a series of episodes, skip past the white section.

Would you like to know more?Twopass
Two-pass encoding allows for much higher quality video. During the first pass, statistical data is collected about the movie and stored in the video.pass file. This data is used to more optimally compress the file during the second pass. Two-pass encoding is always recommended where quality is a concern.

Alternate matrices
The white section shows you how to load custom quantization matrices. If you want to use a matrix other than the default H.263 matrix for 1CD, try HVS Good Picture.cqm. It cuts down on macroblocking during scenes with billowing clouds, smoke, and slow fades. Still images may not look as good as H.263, though.

From the "Quantization type" menu, select "MPEG-Custom".

Click the "Edit Matrix..." button.

Click the "Load matrix..." button.

Navigate to C:\Program Files\GordianKnot\qmatrix.

If you are using 2 CDs, select (file icon) HVS Best Picture.cqm.

If you are using 3 CDs, select (file icon) Didees SixOfNine-HVS.cqm.

Click the "OK" button.

Would you like to know more?Quantization Matrices
The quantization matrix is the 8 by 8 matrix of step sizes (sometimes called quantums)--one element for each DCT coefficient. It is usually symmetric. Step sizes will be small in the upper left (low frequencies), and large in the upper right (high frequencies); a step size of 1 is the most precise. The quantizer divides the DCT coefficient by its corresponding quantum, then rounds to the nearest integer. Large quantums drive small coefficients down to zero. The result: many high frequency coefficients become zero, and therefore easier to code.

Click for a more intelligible explanation.

The most compressing of the HVS matrices is hvs-good, and the least compressing is hvs-best. Very few people use hvs-better. If you're trying to squeeze a long movie into a small space, use hvs-good. If you have plenty of space to work with, try hvs-best or Didees SixOfNine-HVS.

Check the "Global Motion Compensation" box.

Uncheck the "Packed bitstream" box.

Click the "OK" button.

Would you like to know more?Quarter Pixel
Normally XviD uses half-pixel motion search precision. This means that it can 'see' movement in a sub-pixel precision; if a MB moves from a width,height-position of 200,300 to 201, 300 in the next two frames, it can detect that movement correctly and can give the MB a motion vector that says "move me half a pixel to the right this frame please" in those next two frames. Motion will be captured correctly and no texture bits get altered. With Qpel you can capture motion that is only a quarter of a pixel per frame, effectively doubling precision.

Because of the increased precision, Qpel significantly increases encoding time, and requires more processing power to decode. Encoding time can be almost doubled and decoding can require as much as 30-60% more processing power. Since a higher quality picture is not always guaranteed, Qpel is optional.

Global Motion Compensation
GMC looks at the whole frame to see if there is an amount of motion that all the parts of the frame have in common. It will then take this amount of motion and put it in a single value. The parts of the frame are the macroblocks, and the amount of motion is called a 'motion vector' which has both a direction and a value. The possible benefit is that you can remove many or all the motion vectors of the macroblocks (or even the blocks themselves if there is no altered texture information) in a frame by a single value, thereby making it much smaller.

Packed bitstream
Packed Bitstream is meant to solve frame-order issues when encoding to container formats like avi that can't cope with out-of-order frames. And while it's meant to solve playback issues that occur without it, lots of people have reported playback issues with it. That goes for playing back with ffdshow, DivX 5 decoder, and several standalone (hardware) players. Unless you know precisely what you're doing, it's best to keep it turned off until further notice.

From the "Quality preset" menu select "(User defined)".

Click the "more..." button next to the "Quality preset" menu.

From the "VHQ Mode" menu, select "4 - Wide Search".

Maximum I-frame interval: 240 if the DVD is telecined NTSC.
Maximum I-frame interval: 250 if the DVD is PAL.
Maximum I-frame interval: 300 if the DVD is regular or interlaced NTSC.

Click the "OK" button.

Would you like to know more?VHQ Mode
VHQ is more intensive search and takes a wider approach. Using higher values will give you better quality at the cost of encoding speed. If you have a slow computer, use a lower value. Even going as low as VHQ 1 won't have too bad an impact on quality.

Maximum I-frame interval
This setting tells the codec to insert a Keyframe (I-frame) every {value} frames. If a Keyframe is needed before that number is reached, the codec starts counting again. So while you can have Keyframes with lower intervals than the number you defined, you can't have higher intervals. Standard recommended settings are 10x the framerate, i.e. 250 for 25 fps PAL clips, 300 for 29.979 NTSC clips etc. When in doubt, use 300.

Turbo
This setting skips some search techniques when using Qpel or B-frames. Without those options on it has no effect at all. The impact on quality is negligible. If you have a slow PC, feel free to select it.

If the end credits were composed of simple text on a plain background, follow the instructions in the gray section.

If the end credits were more complicated, or if you are encoding a series of episodes rather than a feature length movie, ignore the gray section.

Click the "Add" button.

Highlight the newly created zone and click the "Zone Options" button.

Copy the "credits begin" frame number from (.txt icon) video notes.txt and paste it in:

the "Start frame #:" field.

Select  the "Quantizer" radio button   and enter a value of  20.

Click the "OK" button.

Would you like to know more?Zones
Defining zones and setting their Quantizer values allows for different areas of the movie to be encoded with different compression parameters. Since credits are long and don't contain much detail, they can afford to be encoded with fewer bits. This saves space for higher quality video during the rest of the movie.

You can also set a zone to have more bits. For instance, you might want to set the Weight option to 1.30 for a particularly hard-to-compress scene. The H.263 quantizer has a hard time dealing with images of billowing smoke and/or clouds, so sometimes you will see blocky compression artifacts on these scenes. If you define a zone with a Weight of 1.30, it will likely fix the macroblocking problem. At the beginning of the next scene, set another zone with a Weight of 1.00 (the default) to return to normally weighted encoding. The Weight option may not work correctly, so try it at your own risk.

Cartoon Mode
Cartoon Mode is best for sources like The Simpsons, with its bold lines and large patches of plain color. It is not recommended for animated sources that are highly detailed and visually "busy" like some anime films, or for CGI sources like Finding Nemo.

Click the "OK" button on the configuration screen.
Click the "OK" button on the compression screen.

Go to the "File" menu and select "Save As... F7".

Check the "Don't run this job now; add it to job control so I can run it in batch mode." box.

Navigate to the ripping folder, and name the file firstpass.avi.

Click the "Save" button.

Skip past the orange sections.

If you completed the Quality stage, begin here.

Go to the Start menu and open (VirtualDubMod icon) VirtualDubMod.

From the "File" menu, select "Open video file... Ctrl-O".

Navigate to the ripping folder and open (.avs icon) script.avs.

From the "Video" menu, select "Compression... Ctrl-P".

In the video compression menu, select "Xvid MPEG-4 Codec".

Click the "Configure" button.

From the "Encoding type" menu, select "Twopass - 2nd pass".

If you are encoding a series of episodes, follow the instructions in the brown sections.

If you are encoding a feature length movie, ignore the brown sections.

If you completed the Quality stage,

Click the more... button next to "Twopass - 2nd pass".

Rename video.pass to correspond to the episode number:

Stats filename: "s01e01.pass"

Click the "OK" button on the 2nd Pass screen.

Open (notepad icon) video notes.txt.

Copy and paste the file size value into the "Target size" field:

(The example target size is "??????".)

Click the "OK" button on the configuration screen.
Click the "OK" button on the compression screen.

Go to the "File" menu and select "Save As... F7".

Name the file video.avi.

Check the "Don't run this job now; add it to job control so I can run it in batch mode." box.

Click the "Save" button

If you completed the Quality stage,

go to the "File" menu and select "Open video file... Ctrl-O".

Navigate to the ripping folder for the second episode and open (.avs icon) script.avs.

From the "Video" menu, select "Compression... Ctrl-P".

Click the "Configure" button.

Bring up (notepad icon) video notes.txt.

Copy and paste the file size value for the second episode into the "Target size" field:

(The example target size is "??????".)

Click the more... button next to "Twopass - 2nd pass".

Rename video.pass to correspond to the episode number:

Stats filename: "s01e02.pass"

Click the "OK" button on the 2nd Pass screen.
Click the "OK" button on the configuration screen.
Click the "OK" button on the compression screen.

Go to the "File" menu and select "Save As... F7".

Navigate to the ripping folder for the second episode and name the file video.avi.

Click the "Save" button

Repeat for the third episode, fourth, etc., until all have been processed.

If you did not complete the Quality stage,

go to the "File" menu and select "Open video file... Ctrl-O".

Navigate to the ripping folder for the second episode and open (.avs icon) script.avs.

From the "Video" menu, select "Compression... Ctrl-P".

Click the "Configure" button.

From the "Encoding type" menu, select "Twopass - 1st pass".

Click the "OK" button on the configuration screen.
Click the "OK" button on the compression screen.

Go to the "File" menu and select "Save As... F7".

Navigate to the ripping folder for the second episode, and name the file firstpass.avi.

Click the "Save" button.

From the "Video" menu, select "Compression... Ctrl-P".

Click the "Configure" button.

From the "Encoding type" menu, select Twopass - 2nd pass

The target size should still be the same from before.

Click the "OK" button on the configuration screen.
Click the "OK" button on the compression screen.

Go to the "File" menu and select "Save As... F7".

Navigate to the ripping folder for the second episode and name the file video.avi.

Click the "Save" button.

Repeat for the third episode, fourth, etc., until all have been processed.

From the "File" menu, select "Job control... F4".

When you're ready to begin encoding, click the "Start" button.

Would you like to know more?Checking the job(s)
Before encoding, the job control screen will show one or more "script.avs" files waiting to be turned into "firstpass.avi" and/or "video.avi" files, with no additional information. If you want to make sure you added all the jobs and used the right folders, you can create a more detailed job list and examine it. Just go to the "File" menu and select "Save job list...", then open the resulting .jobs file in Notepad. It probably isn't a good idea to edit and load this file if it turns out you made a mistake, however. Just delete and re-add the job(s) in question.

If you're encoding a feature length movie, VirtualDubMod will create or access the (file icon) video.pass file located in the root directory. Do not delete this file!

The first encoding pass can take up to 8 hours for a feature length movie, and the second pass can take up to 24 hours, depending on the speed of your CPU and the length of the movie.

Would you like to know more?CPU usage priority
If you would like to change the priority of the encoding process so that it doesn't slow down your computer while you're trying to do other things, go to the "Options" menu and select "Show status window". Then select a lower processing thread priority.

Excessive encoding time
If the VirtualDubMod status window shows a projected encoding time of more than 10 hours for a feature length movie, it might be due to a bug in HybridFuPP. Try the other script and see if there's a difference.

If doing so significantly decreases the projected encoding time, either stick with the other script or go back to the Script stage and change the resolution slightly. HybridFuPP is still in the beta stage, and has had problems with certain resolutions before.

If you completed the Quality stage, you will have a number of  (file icon) s__e__.pass files in the root directory. Do not delete them!

If you did not complete the Quality stage, you will have a single (file icon) video.pass file in the root directory. Do not delete it!

After the first (.avi icon) video.avi file has been encoded, check it to make sure the size is correct. Open it in (Media Player Classic icon) Media Player Classic to make sure there are no problems. If there are, cancel the other jobs in the queue and try again.

When encoding finishes, check the job control screen for warnings. Double-click the job for specifics. Disregard any "possible livelock" warnings.

Click the "OK" button.

The resulting (.avi icon) video.avi file(s) should be within a few hundred KB of the specified size. If you skipped the Quality stage and there is a small firstpass.avi file, you can delete it.

The example ripping folder now contains a "video.avi" file.

Close VirtualDubMod and proceed to the next stage.

PREVIOUS: Adjusting for Quality NEXT: Muxing It All Together .
Validate the XHTML.
Validate the CSS.