I'm starting a new thread for AVISynth and vDub Templates and code snippets. These templates are used in the "Farnsworth" 3:2 pulldown system and can also be used with SSzudziks excellent "HV20Pulldown.exe" tool. (They can also of course be used stand-alone in many cases as well)
I politely request everyone to keep the chatter down and try to save the thread for posting functional code only.
I'll start with a few of my personal favorites:
My basic IVTC script, adapted from the stock script that comes with HV20pulldown.exe My version fixes a subtle bug in the original (interlaced 4:2:0 treated as a progressive frame before IVTC) This script promotes the 4:2:0 to 4:2:2 on decode to solve the problem. All of my scripts have this fix, since the 4:2:0 vs "interlace in a progressive frame" is a well documented bug that can seriously screw up many filters in AVISynth. It's safest to just promote the video to 4:2:2 right at the decoder to avoid the problem. (Slight hit in speed but it is VERY slight. Well worth the extra safety.) It also does a bit of chroma post processing to smooth the chroma.
Code:### Lordtangents HV20 Uber Inverse Telecine Template ### v0.1 June 16 2007 ### ### Requires: DGDecode.dll, TIVTC.dll ### http://neuron2.net/dgmpgdec/dgmpgdec.html ### http://web.missouri.edu/~kes25c/ ##### MAIN -- Do not edit unless you really know what you are doing! v=MPEG2Source("__vid__", upConv=1, idct=3, iCC=true, iPP=true, cpu2="ooxxox") a=MPASource("__aud__") audiodub(v,a) tfm(d2v="__vid__") tdecimate()
Here is what I call my "UberScript" It slices! It DICES! It's got everything but the kitchen sink! ... But seriously, what it CAN do is: Noise Reduction, Image Scaling (to several handy preset sizes) and full range YCbCr to RGB conversion. You can disable the YCbCr to RGB conversion, but for best result with the scaling it's better to leave it in. You need a couple of extra plug-ins for the noise reduction. They are named at the op of the script. It's disabled by default so if you don't use the noise reduction you don't need the plug-ins.
In case it isn't painfully obvious enough, the options of the script are configured in the section under the block labled "### Configuration section"
This next one is kind of cool, IMHO. Slow-Mo from 60i to 24p. What it does is smart delace 60i to 60p then make the frame rate 24p (well, 23.976 to be precise). You need a plug-in for AVISynth called Yadif, but it's easy to find. You can also make "slow mo" from 30p to 24p with this by commenting out the line "Yadif(VID, mode=1 )" and uncommenting Yadif(VID, mode=0 ). That will give you a more mild effect. Kind of a "dreamy" slow mo rather than a real obvious slow-mo. And... if you additionally comment out "AssumeFPS(24000,1001)" after that, you'll get 30p (actually 29.97). Good for making progressive movies at 30p for the web. You can see how with these three little blocks of code you can make 60p. 30p, and "slow mo" from 30p or 60p. Very handy.Code:### Lordtangents HV20 Uber Inverse Telecine Template + Full_Range_YCbCr2RGB ### v0.3 October 10 2007 ### ### Requires: DGDecode.dll, TIVTC.dll ### Optional: TTempSmooth.dll and/or TNLMeans.dll for noise reduction ### http://neuron2.net/dgmpgdec/dgmpgdec.html ### http://web.missouri.edu/~kes25c/ ### Configuration section # Scale final output? ( 1 for true 0 for false ) Resize = 0 # # Uncomment your desired final resolution # pixel aspect 1, 16:9 sizes ... #================================================== #final_xres = 1920 final_yres = 1080 # "1080p" final_xres = 1280 final_yres = 720 # "720p" #final_xres = 1024 final_yres = 576 # "1k" #final_xres = 960 final_yres = 540 # "half res" #final_xres = 864 final_yres = 486 # "486 high" #final_xres = 720 final_yres = 406 # "720 wide" #final_xres = 640 final_yres = 360 # "medium" #final_xres = 320 final_yres = 180 # "Small" #final_xres = 160 final_yres = 90 # Micro # Set optional Noise/Grain Reduction level (requires TTempSmooth.dll & TNLMeans.dll ) # int 0-4 "0" means no noise reduction. Runs BEFORE resize for maximum effect. # 1 is fast temporal smoothing only. Not too blury. Pretty fast. # 2 is temporal smoothing plus some light 3D (spacial&temporal) means based smoothing. Still not to blury. Not too slow. # 3 is heavier temporal smoothing plus heavier 3D means based smoothing. Softer. More grain killing power. Slow. # 4 is even heavier temporal smoothing plus even heavier 3D means based smoothing. Soft. Huge grain killing power. Really Slow. # 11-13 are special neat visualize modes ReduceNoise = 0 ##### MAIN -- Do not edit unless you really know what you are doing! v=MPEG2Source("__vid__", upConv=1, idct=3, iCC=true, iPP=true, cpu2="ooxxox") a=MPASource("__aud__") audiodub(v,a) tfm(d2v="__vid__") tdecimate() # Apply Noise reductioin...or not. Poormans switch function (ReduceNoise==0) ? nop() : nop() (ReduceNoise==1) ? TTempSmoothF(maxr=4, vis_blur=0) : nop() (ReduceNoise==2) ? TTempSmoothF(maxr=4, vis_blur=0).TNLMeans(Ax=1, Ay=1, Az=1, sse=true) : nop() (ReduceNoise==3) ? TTempSmoothF(maxr=5, vis_blur=0).TNLMeans(Ax=2, Ay=2, Az=2, sse=true) : nop() (ReduceNoise==4) ? TTempSmoothF(maxr=6, vis_blur=0).TNLMeans(Ax=2, Ay=2, Az=3, sse=true) : nop() (ReduceNoise==11) ? TTempSmoothF(maxr=4, vis_blur=1).invert() : nop() (ReduceNoise==12) ? TTempSmoothF(maxr=4, vis_blur=2).invert() : nop() (ReduceNoise==13) ? TTempSmoothF(maxr=4, vis_blur=3).invert() : nop() clip=AssumeFPS(24000,1001) # Full scale YCbCr --> RGB conversion before resize ConvertToRGB(clip, matrix="PC.709") # Resize ... or not ... not really anyway (Resize==1) ? LanczosResize(final_xres,final_yres) : PointResize(Width(),Height())
Very special scripts:Code:### Lordtangents HV20 New Slow-Mo Template ### v0.1 October 1 2007 ### ### Requires: yadif.dll LoadCplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll") v=MPEG2Source("__vid__", upConv=1, idct=3, iCC=true, iPP=true, cpu2="ooxxox") a=MPASource("__aud__") VID=audiodub(v,a) # Delace to 60p with yadif Yadif(VID, mode=1 ) # Delace to 30p with yadif # Yadif(VID, mode=0 ) # Now make frame rate 23.976 AssumeFPS(24000,1001)
I developed a set of scripts for "fake under-crank effect" specifically for use with the HV20s "long shutter speeds" of 1/6th and 1/12th sec. (In 24p mode) One of the cool things about the long shutter is since it's open so long even with frames basically deleted (what this script does) the motion blur looks natural for the supposed frame rate. It's as if the shots were actually done as "time laps" (or rather, "under-cranked", since we are still talking about frames-per-second and not seconds per frame... )
And the 1/12th sec version:Code:### Lordtangents HV20 "1/6th undercrank" Template ### v0.3 October 22 2007 ### ### Requires: DGDecode.dll, TIVTC.dll, FDecimate.dll ### http://neuron2.net/dgmpgdec/dgmpgdec.html ### http://neuron2.net/fdecimate/fdecimate.html ### http://web.missouri.edu/~kes25c/ ##### MAIN -- Do not edit unless you really know what you are doing! v=MPEG2Source("__vid__", upConv=1, idct=3, iCC=true, iPP=true, cpu2="ooxxox") a=MPASource("__aud__") audiodub(v,a) # For "6fps from 1/6th sec shutter" Like 360deg shutter at 6fps FDecimate(rate=5.994) # For "3fps from 1/6th sec shutter" Like 180deg shutter at 3fps # FDecimate(rate=2.997) AssumeFPS(24000,1001)
Here are a couple of little snippets you might find handy:Code:### Lordtangents HV20 "1/12th undercrank" Template ### v0.3 October 22 2007 ### ### Requires: DGDecode.dll, TIVTC.dll, FDecimate.dll ### http://neuron2.net/dgmpgdec/dgmpgdec.html ### http://neuron2.net/fdecimate/fdecimate.html ### http://web.missouri.edu/~kes25c/ ##### MAIN -- Do not edit unless you really know what you are doing! v=MPEG2Source("__vid__", upConv=1, idct=3, iCC=true, iPP=true, cpu2="ooxxox") a=MPASource("__aud__") audiodub(v,a) # For "12fps from 1/12th sec shutter" Like 360deg shutter at 12 fps FDecimate(rate=11.988) # For "6fps from 1/12th sec shutter" Like 180deg shutter at 6fps # FDecimate(rate=5.994) AssumeFPS(24000,1001)
You can force "full range" YCbCr to RGB conversion by putting this at the end of any of your scripts.
There you have it everyone: Most of my bag of tricks. I'm interested to see any tricks others have come up with.Code:# Full scale YCbCr --> RGB conversion before resize ConvertToRGB(clip, matrix="PC.709")


Reply With Quote













