-h
28th January 2002, 11:47
This is a preliminary guide, mainly a merger of the myriad posts here, on how to use XviD to perform 2-pass encoding. It's very bare-bones - you should already know how to rip, how to crop and resize, how to encode and mux audio, etc. All these things are explained in Doom9's guides.
There are a couple of ways to encode using XviD and VirtualDub, and they happen to be very similar to Nandub with GKnot. While you can use XviD's internal 2-pass support, it doesn't allow any of the extra features found in GKnot like credits. If you prefer the options GKnot gives you, the only difference between XviD and Nandub .stats editing is to disable "Luma correction" and "Motion correction".
Step by step:
1) Basic codec setup
The Configuration dialog consists of three tabs:
- Main - All you should have to configure here is the "Quantization type". This tells the codec how to go about removing information from the picture during compression - the MPEG quantizer is sharper and slightly slower, whereas H.263 smooths the picture more. DivX 4.x and DivX 3.11 use H.263, and don't let you choose this option. The "Motion search precision" option governs how accurately the codec will match similarities between frames - the slower the choice, the better the compression. It is set to 5 by default, because 6 is much slower, but less than 1% better.
- Advanced - The CBR options are only used in "1 Pass - CBR" mode, so you can leave them alone. The minimum and maximum quantizers should be left to 1 and 31, as they shouldn't need to be constrained in 2-pass mode. The "Luminance masking" option makes the codec use more compression in areas that are dark or light, as these are harder for the eye to perceive comrpession artifacts in. This allows, in theory, the same perceived quality in a smaller file. The "Discard encoded bitstream on first pass" option should be left enabled, unless you want the huge resulting file from the first pass.
- CPU - XviD's CPU detection will automatically detect what instructions your CPU supports - if the codec crashes, you should definitely contact the developers with a report so it can be fixed.
2) First pass
You should have already performed cropping, resizing and/or filters on your video source by now. It is assumed you're frameserving with Avisynth.
Open the .avs script in VirtualDub. From the "Video" menu, choose "Fast Recompress" to avoid unnecessary color conversions. In the codec's "Main" tab, set the Mode to "2 Pass - 1st Pass", and specify the .stats file you wish to save to. In the "Advanced" tab, make sure that "Luminance Masking" is unchecked - it should never be enabled for the first pass.
If you are creating a 1-CD rip, you should set the "Motion Search Precision" to 6, to squeeze everything you can out of the codec. The "Quantization type" should be set to H.263, as it generally has fewer blocking artifacts with the high quantizers a 1-CD rip generates.
For a 2-CD rip, it is recommended that you keep the Search Precision at 5. Quantization type should be set to MPEG for sharper images.
3) Calculating the .stats file for 2nd pass
If you do not wish to use Gordian Knot to edit your .stats file, you can depend on XviD's internal curve mod and skip this step.
In Gordian Knot, open your .stats file from the 1st pass (its location and name are specified in the 1st pass stats file text box in the main tab of the codec's configuration dialogue). The basic things to do here are to enter the size you want your final encoded AVI to have (it doesn't matter which codec you choose - GKnot calculates the bitrate-curve based on framesizes, not on bitrate), to enter a size or bitrate for the corresponding audio-file/stream, and to uncheck the "Luminance correction" and "Motion correction" options in the stats-editor tab. You should also encode your credits at a lower bitrate. Then click on "Calculate". If you don't want to make any manual corrections, click on "Save", and you have your .stats file for your customised second pass.
If you want to do anything else with GKnot, you should consult Doom9's guides, or GKnot's integrated help.
4) Second pass
If you're aiming for a 1-CD rip, it's advised to enable Luminance Masking from the advanced tab for the second pass - for such low target bitrates, it will do more good than harm.
If you performed a .stats mod in GKnot, set XviD's mode to "2 Pass - 2nd Pass Ext." The 2nd pass stats file text box will now be enabled, and you can select the .stats file you saved from GKnot. That's all you have to do!
If you did not use GKnot for the .stats mod, set XviD's mode to "2 Pass - 2nd Pass Int." Enter the desired size of the video stream in the "Desired file size" text box - remember, this excludes the size of the audio stream(s), and is measured in Kilobytes. Entering 573440 will give an output avi of 560 MB.
Now save your avi.
If you have suggestions for this guide, contact -h or Teegedeck.
There are a couple of ways to encode using XviD and VirtualDub, and they happen to be very similar to Nandub with GKnot. While you can use XviD's internal 2-pass support, it doesn't allow any of the extra features found in GKnot like credits. If you prefer the options GKnot gives you, the only difference between XviD and Nandub .stats editing is to disable "Luma correction" and "Motion correction".
Step by step:
1) Basic codec setup
The Configuration dialog consists of three tabs:
- Main - All you should have to configure here is the "Quantization type". This tells the codec how to go about removing information from the picture during compression - the MPEG quantizer is sharper and slightly slower, whereas H.263 smooths the picture more. DivX 4.x and DivX 3.11 use H.263, and don't let you choose this option. The "Motion search precision" option governs how accurately the codec will match similarities between frames - the slower the choice, the better the compression. It is set to 5 by default, because 6 is much slower, but less than 1% better.
- Advanced - The CBR options are only used in "1 Pass - CBR" mode, so you can leave them alone. The minimum and maximum quantizers should be left to 1 and 31, as they shouldn't need to be constrained in 2-pass mode. The "Luminance masking" option makes the codec use more compression in areas that are dark or light, as these are harder for the eye to perceive comrpession artifacts in. This allows, in theory, the same perceived quality in a smaller file. The "Discard encoded bitstream on first pass" option should be left enabled, unless you want the huge resulting file from the first pass.
- CPU - XviD's CPU detection will automatically detect what instructions your CPU supports - if the codec crashes, you should definitely contact the developers with a report so it can be fixed.
2) First pass
You should have already performed cropping, resizing and/or filters on your video source by now. It is assumed you're frameserving with Avisynth.
Open the .avs script in VirtualDub. From the "Video" menu, choose "Fast Recompress" to avoid unnecessary color conversions. In the codec's "Main" tab, set the Mode to "2 Pass - 1st Pass", and specify the .stats file you wish to save to. In the "Advanced" tab, make sure that "Luminance Masking" is unchecked - it should never be enabled for the first pass.
If you are creating a 1-CD rip, you should set the "Motion Search Precision" to 6, to squeeze everything you can out of the codec. The "Quantization type" should be set to H.263, as it generally has fewer blocking artifacts with the high quantizers a 1-CD rip generates.
For a 2-CD rip, it is recommended that you keep the Search Precision at 5. Quantization type should be set to MPEG for sharper images.
3) Calculating the .stats file for 2nd pass
If you do not wish to use Gordian Knot to edit your .stats file, you can depend on XviD's internal curve mod and skip this step.
In Gordian Knot, open your .stats file from the 1st pass (its location and name are specified in the 1st pass stats file text box in the main tab of the codec's configuration dialogue). The basic things to do here are to enter the size you want your final encoded AVI to have (it doesn't matter which codec you choose - GKnot calculates the bitrate-curve based on framesizes, not on bitrate), to enter a size or bitrate for the corresponding audio-file/stream, and to uncheck the "Luminance correction" and "Motion correction" options in the stats-editor tab. You should also encode your credits at a lower bitrate. Then click on "Calculate". If you don't want to make any manual corrections, click on "Save", and you have your .stats file for your customised second pass.
If you want to do anything else with GKnot, you should consult Doom9's guides, or GKnot's integrated help.
4) Second pass
If you're aiming for a 1-CD rip, it's advised to enable Luminance Masking from the advanced tab for the second pass - for such low target bitrates, it will do more good than harm.
If you performed a .stats mod in GKnot, set XviD's mode to "2 Pass - 2nd Pass Ext." The 2nd pass stats file text box will now be enabled, and you can select the .stats file you saved from GKnot. That's all you have to do!
If you did not use GKnot for the .stats mod, set XviD's mode to "2 Pass - 2nd Pass Int." Enter the desired size of the video stream in the "Desired file size" text box - remember, this excludes the size of the audio stream(s), and is measured in Kilobytes. Entering 573440 will give an output avi of 560 MB.
Now save your avi.
If you have suggestions for this guide, contact -h or Teegedeck.