= AVS2AVI GUIDE =

'''Avs2avi''' http://daveel.leffe.dnsalias.com is the fastest way to compress to Divx, XviD etc. from the Avisynth scripts.
It's a simple command line program, but GUI exist at http://jonny.leffe.dnsalias.com.

I'll use avs2avi from command line (.bat or .cmd in XP/2000). First, put avs2avi.exe (ver.1.29)
and '''divxauto.exe''' (for DivX 3.11) in your Windows directory (for example in C:\Windows). Generate Avisynth
script with Gordian Knot, and use his bitrate calculator for XviD or DivX 4-5.0.5.
Example:

In my testing WMV9Vfw vs. DivX 5 Pro I have used Avisynth 2.51 script (TIP: Verify it with VirtualDubmod before the encoding):

LoadPlugin("C:\PROGRA~1\GordKnot\MPEGDecoder.dll")
LoadPlugin("C:\PROGRA~1\GordKnot\BicublinResize.dll")
MPEGSource("F:\video_ts\matrix.d2v")
# CROPPING
crop(0,70,720,436)
# RESIZING
BicublinResize(704,304)
#LanczosResize(576,256) #Slower, but better
#Trim(0,100)

Let's make short two passes, just to generate and save codec settings for
two pass Xvid or Divx4-5.0.5 two pass encoding. Uncomment Trim line in the
avisynth script (remove # sign).

Run AVS2AVI.exe in .bat file or from Start->Run.

avs2avi F:\video_ts\movie.avs f:\movie.avi -p 1 -q -o a -s F:\codec1pass.param
"Video Compression" window will pop-up. Choose the codec settings for 1-st pass.

avs2avi will shortly run (100 frames), and again:

avs2avi F:\video_ts\movie.avs f:\movie.avi -p 1 -q -o a -s F:\codec2pass.param
"Video Compression" window will pop-up once more. Choose the codec settings
for 2-nd pass.

Remove Trim line from script, or put there a main movie frame count.

Run again for the final encoding:

avs2avi F:\video_ts\movie.avs f:\movie.avi -p 1 -q -o a -l F:\codec1pass.param
avs2avi F:\video_ts\movie.avs f:\movie.avi -p 1 -q -o a -l F:\codec2pass.param

This time, a switch -l tell avs2avi to load the previously saved codec settings.
(Switches are: -p for priority: 1-lower, 2-normal, 3-high; -q quiet mode;
-o a output to avi file; -s save codec setttings; -l load codec settings.)

WMV9 vfW scored 5.25 fps, and a total meltdown in the "Matrix" lobby chapter.

DivX Pro 5.0.5 (bi-, GMC, qpel) scored 12.4 fps, and great picture.
Bitrate was 560 000 bps.
Just for fun I have tried SBC, and finally, FM-LM 3.11 for MakefilmTNG.

start divxauto F 1 100 6000 "Video Compression"
avs2avi F:\video_ts\movie.avs f:\FM.avi -p 2 -o a
start divxauto L 1 85 2000 "Video Compression"
avs2avi F:\video_ts\movie.avs f:\LM.avi -p 2 -o a

I get 28.7 fps, and in the first moment I was thinking that something don't work!

You get two avi files, LM.avi and FM.avi. Use '''MakefilmTNG.exe''' and load
in it a following FM_LM.ini (put it in the MakefilmTNG folder):

[MakeFilmTNG]
FastMotionAvi=F:\FM.avi
LowMotionAvi=F:\LM.avi
FinalAvi=F:\FM_LM.avi
EndingAvi=0
StopAfter=0
Audio=0
FinalSize=550
HighBitrateLimit=150
SceneSwitchingSmoother=1

You'll get merged DivX 3.11 FM_LM.avi. Adjust the FinalSize (for 2-CD's)
or/and HighBitrateLimit. LM_FM.ini works "as is" in 90% cases-if FM.avi is
smaller then 500 MB, for movies to 2.10 h and 1 CD.
People: grab that avs2avi 1.29, that's the greatest program now.
No YV12 mediator--straight to compressor. I have 900 MHz Celeron,
but someone with 2.8 GHz could get 60 fps+ for sure.

June 12. 2003.

 = AVS2AVI FASTEST WAY =

'''Avs2avi 1.29''' http://daveel.leffe.dnsalias.com

Avs2avi 1.29 (later versions have Matroska support)
is the fastest, ultimate video compression utility for DivX Pro.
First, create a working Avisynth script with Gordian Knot and
save them as movie.avs. Important: USE 576 x something resolution.
Adjust all paths in .avs script and later in .bat files. Use Nic's
MPEGDecoder.dll instead mpeg2dec3.dll. Use DVD2AVI 1.76 CLI.

For example:
---------------------------------------------------
LoadPlugin("C:\PROGRA~1\GordKnot\MPEGDecoder.dll")
MPEGSource("F:\video_ts\movie.d2v")
LanczosResize(576,312)
---------------------------------------------------
Verify it with VirtualDubmod. Start regedit, find DivXNetworks key and export it somewhere on safe.
Then with Notepad write three new files and save them in Windows directory.

Divx.reg:
------------------CUT and PASTE from here-----------------
REGEDIT4

[HKEY_CURRENT_USER\Software\DivXNetworks\DivX4Windows]
"Bitrate"=dword:000be6e0
"RC Period"=dword:000007d0
"RC Reaction Period"=dword:0000000a
"RC Reaction Ratio"=dword:00000014
"Max Keyframe Interval"=dword:000000fa
"Max Quantizer"=dword:00000006
"Min Quantizer"=dword:00000002
"Quality"=dword:00000005
"VBR Mode"=dword:00000000
"VBR Quality v5"=dword:00000028
"Frame Dropping"=dword:00000000
"Deinterlace"=dword:00000000
"Postprocessing"=dword:0000001e
"CPU Limit"=dword:00000064
"Use CPU Limit"=dword:00000000
"OBMC"=dword:00000000
"New Format"=dword:00000000
"Data Partitioning"=dword:00000000
"Bidirectional Encoding"=dword:00000001
"MPEG-2 Quantization"=dword:00000000
"Bidir quant multiplier"=dword:00002000
"Scene change threshold"=dword:0000004b
"do_add"=dword:00000001
"do_mc"=dword:00000001
"do_mc_b"=dword:00000001
"show_gmc"=dword:00000000
"no_vbr_rc"=dword:00000000
"write_mvfile"=dword:00000001
"do_writeyuv"=dword:00000000
"do_writeyuvmul"=dword:00000000
"Psychovisual Enhancement"=dword:00000000
"Psychovisual Strength - Frame Level"="0.200000"
"Psychovisual Strength - Macroblock level"="0.200000"
"Testing Parameter"=dword:00000040
"Write MP4 file"=dword:00000000
"Use GMC"=dword:00000001
"GMC Sensitivity"=dword:00000080
"Quarter-pel"=dword:00000000
"Crop"=dword:00000000
"Resize"=dword:00000000
"Crop left"=dword:00000000
"Crop right"=dword:00000000
"Crop top"=dword:00000000
"Crop bottom"=dword:00000000
"Resize width"=dword:00000280
"Resize height"=dword:000001e0
"Resize mode"=dword:00000000
"Bicubic spline B"="0.000000"
"Bicubic spline C"="0.500000"
"Temporal enable"=dword:00000000
"Spatial passes"=dword:00000000
"Temporal level"="0.000000"
"Spatial level"="0.000000"
"Interlace mode"=dword:00000000
"Protect log & mv"=dword:00000000
"5.0 Psychovisual Mode"=dword:00000001
"5.0 Preprocessing Mode"=dword:ffffffff
"5.0 Resize Mode"=dword:00000001
"Log File Name"="C:\\divx.log"
"MP4 File Name"="c:\\test.divx"
"YUV Dir Name"="c:\\yuv"
"MV File Name"="C:\\mvinfo.bin"
"VBV Channel Bitrate"=dword:00895440
"VBV Buffer Size"=dword:00300000
"VBV Occupancy"=dword:00240000
"Complexity Modulation"="0.000000"
"use_mvfile"=dword:00000001
"Use dialogs"=dword:00000000
"Write log file"=dword:00000001
"Write nth pass logfile"=dword:00000000
"Disable Profile Page"=dword:00000001
"Active Profile"=dword:00000002
"Nth Pass debug file name"="c:\\newrc.txt"
"Have CPU limit"=dword:00000000
"VBR Quality"=dword:00000064
"Optimizations"=dword:ffffffff
"Brightness"=dword:00000000
"Contrast"=dword:00000000
"Saturation"=dword:00000000
"MaxDelayAllowed"=dword:00989680
"AspectRatio_X"=dword:00000000
"AspectRatio_Y"=dword:00000000
"Smooth Playback"=dword:00000001
"Extended Yuv Mode"=dword:00000001
"Double Buffering"=dword:00000000
"Extended Overlay Mode"=dword:00000001
"Disable Logo"=dword:00000000
"ATI Disable"=dword:00000000
"Warmth Strength"=dword:00000000
"Warmth Filter"=dword:00000000
"Force Color Mode"=dword:00000002
"Top field first"=dword:00000000
"Load count"=dword:00000000

----------------------to here-----------------------------------

This are the settings for ONE PASS encoding.

For TWO PASS encoding, two reg files are needed.

1pass800kbpsDivx.reg
------------------CUT and PASTE from here-----------------
REGEDIT4

[HKEY_CURRENT_USER\Software\DivXNetworks\DivX4Windows]
"Bitrate"=dword:000be6e0
"RC Period"=dword:000007d0
"RC Reaction Period"=dword:0000000a
"RC Reaction Ratio"=dword:00000014
"Max Keyframe Interval"=dword:000000fa
"Max Quantizer"=dword:00000008
"Min Quantizer"=dword:00000002
"Quality"=dword:00000005
"VBR Mode"=dword:00000002
"VBR Quality v5"=dword:00000028
"Frame Dropping"=dword:00000000
"Deinterlace"=dword:00000000
"Postprocessing"=dword:0000001e
"CPU Limit"=dword:00000064
"Use CPU Limit"=dword:00000000
"OBMC"=dword:00000000
"New Format"=dword:00000000
"Data Partitioning"=dword:00000000
"Bidirectional Encoding"=dword:00000001
"MPEG-2 Quantization"=dword:00000000
"Bidir quant multiplier"=dword:00002000
"Scene change threshold"=dword:0000004b
"do_add"=dword:00000001
"do_mc"=dword:00000001
"do_mc_b"=dword:00000001
"show_gmc"=dword:00000000
"no_vbr_rc"=dword:00000000
"write_mvfile"=dword:00000001
"do_writeyuv"=dword:00000000
"do_writeyuvmul"=dword:00000000
"Psychovisual Enhancement"=dword:00000000
"Psychovisual Strength - Frame Level"="0.200000"
"Psychovisual Strength - Macroblock level"="0.200000"
"Testing Parameter"=dword:00000040
"Write MP4 file"=dword:00000000
"Use GMC"=dword:00000001
"GMC Sensitivity"=dword:00000080
"Quarter-pel"=dword:00000000
"Crop"=dword:00000000
"Resize"=dword:00000000
"Crop left"=dword:00000000
"Crop right"=dword:00000000
"Crop top"=dword:00000000
"Crop bottom"=dword:00000000
"Resize width"=dword:00000280
"Resize height"=dword:000001e0
"Resize mode"=dword:00000000
"Bicubic spline B"="0.000000"
"Bicubic spline C"="0.500000"
"Temporal enable"=dword:00000000
"Spatial passes"=dword:00000000
"Temporal level"="0.000000"
"Spatial level"="0.000000"
"Interlace mode"=dword:00000000
"Protect log & mv"=dword:00000000
"5.0 Psychovisual Mode"=dword:00000001
"5.0 Preprocessing Mode"=dword:ffffffff
"5.0 Resize Mode"=dword:00000001
"Log File Name"="C:\\divx.log"
"MP4 File Name"="c:\\test.divx"
"YUV Dir Name"="c:\\yuv"
"MV File Name"="C:\\mvinfo.bin"
"VBV Channel Bitrate"=dword:00895440
"VBV Buffer Size"=dword:00300000
"VBV Occupancy"=dword:00240000
"Complexity Modulation"="0.000000"
"use_mvfile"=dword:00000001
"Use dialogs"=dword:00000000
"Write log file"=dword:00000001
"Write nth pass logfile"=dword:00000000
"Disable Profile Page"=dword:00000001
"Active Profile"=dword:00000002
"Nth Pass debug file name"="c:\\newrc.txt"
"Have CPU limit"=dword:00000000
"VBR Quality"=dword:00000064
"Optimizations"=dword:ffffffff
"Brightness"=dword:00000000
"Contrast"=dword:00000000
"Saturation"=dword:00000000
"MaxDelayAllowed"=dword:00989680
"AspectRatio_X"=dword:00000000
"AspectRatio_Y"=dword:00000000
"Smooth Playback"=dword:00000001
"Extended Yuv Mode"=dword:00000001
"Double Buffering"=dword:00000000
"Extended Overlay Mode"=dword:00000001
"Disable Logo"=dword:00000000
"ATI Disable"=dword:00000000
"Warmth Strength"=dword:00000000
"Warmth Filter"=dword:00000000
"Force Color Mode"=dword:00000002
"Top field first"=dword:00000000
"Load count"=dword:00000000

----------------------to here-----------------------------------

2pass800kbpsDivx.reg

------------------CUT and PASTE from here-----------------
REGEDIT4

[HKEY_CURRENT_USER\Software\DivXNetworks\DivX4Windows]
"Bitrate"=dword:000be6e0
"RC Period"=dword:000007d0
"RC Reaction Period"=dword:0000000a
"RC Reaction Ratio"=dword:00000014
"Max Keyframe Interval"=dword:000000fa
"Max Quantizer"=dword:00000008
"Min Quantizer"=dword:00000002
"Quality"=dword:00000005
"VBR Mode"=dword:00000003
"VBR Quality v5"=dword:00000028
"Frame Dropping"=dword:00000000
"Deinterlace"=dword:00000000
"Postprocessing"=dword:0000001e
"CPU Limit"=dword:00000064
"Use CPU Limit"=dword:00000000
"OBMC"=dword:00000000
"New Format"=dword:00000000
"Data Partitioning"=dword:00000000
"Bidirectional Encoding"=dword:00000001
"MPEG-2 Quantization"=dword:00000000
"Bidir quant multiplier"=dword:00002000
"Scene change threshold"=dword:0000004b
"do_add"=dword:00000001
"do_mc"=dword:00000001
"do_mc_b"=dword:00000001
"show_gmc"=dword:00000000
"no_vbr_rc"=dword:00000000
"write_mvfile"=dword:00000001
"do_writeyuv"=dword:00000000
"do_writeyuvmul"=dword:00000000
"Psychovisual Enhancement"=dword:00000000
"Psychovisual Strength - Frame Level"="0.200000"
"Psychovisual Strength - Macroblock level"="0.200000"
"Testing Parameter"=dword:00000040
"Write MP4 file"=dword:00000000
"Use GMC"=dword:00000001
"GMC Sensitivity"=dword:00000080
"Quarter-pel"=dword:00000000
"Crop"=dword:00000000
"Resize"=dword:00000000
"Crop left"=dword:00000000
"Crop right"=dword:00000000
"Crop top"=dword:00000000
"Crop bottom"=dword:00000000
"Resize width"=dword:00000280
"Resize height"=dword:000001e0
"Resize mode"=dword:00000000
"Bicubic spline B"="0.000000"
"Bicubic spline C"="0.500000"
"Temporal enable"=dword:00000000
"Spatial passes"=dword:00000000
"Temporal level"="0.000000"
"Spatial level"="0.000000"
"Interlace mode"=dword:00000000
"Protect log & mv"=dword:00000000
"5.0 Psychovisual Mode"=dword:00000001
"5.0 Preprocessing Mode"=dword:ffffffff
"5.0 Resize Mode"=dword:00000001
"Log File Name"="C:\\divx.log"
"MP4 File Name"="c:\\test.divx"
"YUV Dir Name"="c:\\yuv"
"MV File Name"="C:\\mvinfo.bin"
"VBV Channel Bitrate"=dword:00895440
"VBV Buffer Size"=dword:00300000
"VBV Occupancy"=dword:00240000
"Complexity Modulation"="0.000000"
"use_mvfile"=dword:00000001
"Use dialogs"=dword:00000000
"Write log file"=dword:00000001
"Write nth pass logfile"=dword:00000000
"Disable Profile Page"=dword:00000001
"Active Profile"=dword:00000002
"Nth Pass debug file name"="c:\\newrc.txt"
"Have CPU limit"=dword:00000000
"VBR Quality"=dword:00000064
"Optimizations"=dword:ffffffff
"Brightness"=dword:00000000
"Contrast"=dword:00000000
"Saturation"=dword:00000000
"MaxDelayAllowed"=dword:00989680
"AspectRatio_X"=dword:00000000
"AspectRatio_Y"=dword:00000000
"Smooth Playback"=dword:00000001
"Extended Yuv Mode"=dword:00000001
"Double Buffering"=dword:00000000
"Extended Overlay Mode"=dword:00000001
"Disable Logo"=dword:00000000
"ATI Disable"=dword:00000000
"Warmth Strength"=dword:00000000
"Warmth Filter"=dword:00000000
"Force Color Mode"=dword:00000002
"Top field first"=dword:00000000
"Load count"=dword:00000000

----------------------to here-----------------------------------

Copy Avs2avi.exe (1.29), Divx.reg, 1pass800kbpsDivx.reg, 2pass800kbpsDivx.reg
in your Windows directory. Reg. files are used for DivX Pro 5.0, because this
is latest and best BUGFREE DivX ( never use 5.0.2 Pro-5.0.5 Pro ), but this
will work for them too. If you want, just obtain dll from friend or earlier
backup and copy divx.dll 5.0 Pro version over newer one. Expl: DivX decided
to push some industrial standards, and have introduced "Profiles", but you
can't edit min and max quantizier (MOST important thing in DivX).

Write OnePassAVS2AVI.bat:

----------------------------------------------------
regedit /i /s Divx.reg
avs2avi F:\movie.avs f:\movie.avi -p 1 -o a -c dx50
----------------------------------------------------

Write Two passesAVS2AVI.bat:

----------------------------------------------------
regedit /i /s 1pass800kbpsDivx.reg
avs2avi F:\movie.avs f:\movie.avi -p 1 -o a -c dx50
regedit /i /s 2pass800kbpsDivx.reg
avs2avi F:\movie.avs f:\movie.avi -p 1 -o a -c dx50
----------------------------------------------------

Important settings in registry are:
"Bitrate", "Max Quantizer" and "Min Quantizer". If you need, change the dword
for bitrate ONLY (in HEX) or with Regedit (import key, edit bitrate, then export).
One pass IS SO GOOD, then you never use TwoPass for movies under 2 hours again.

Save .bat files on your desktop. Again, adjust your paths (where movie.avs is and
where you want final movie.avi).

Expect 18 fps/GHz (DivX works with B-frames and GMC).

June, 27. 2003. Drazen

 

1