Log in

View Full Version : Avisynth+ 64bit two pass Deshaker script not working


Pages : 1 [2]

StainlessS
3rd December 2018, 04:10
Post #2 of 2.


IgnorePixelsOutside=Default(IgnorePixelsOutside,False)
IgnorePixelsOutsideLeft=Default(IgnorePixelsOutsideLeft,0)
IgnorePixelsOutsideRight=Default(IgnorePixelsOutsideRight,0)
IgnorePixelsOutsideTop=Default(IgnorePixelsOutsideTop,0)
IgnorePixelsOutsideBottom=Default(IgnorePixelsOutsideBottom,0)
IgnorePixelsInside=Default(IgnorePixelsInside,False)
IgnorePixelsInsideLeft=Default(IgnorePixelsInsideLeft,0)
IgnorePixelsInsideRight=Default(IgnorePixelsInsideRight,0)
IgnorePixelsInsideTop=Default(IgnorePixelsInsideTop,0)
IgnorePixelsInsideBottom=Default(IgnorePixelsInsideBottom,0)
VideoTypeInterlaced=Default(VideoTypeInterlaced,False)
VideoTypeUpperFieldFirst=Default(VideoTypeUpperFieldFirst,False)
ExtraZoomFactor=Float(Default(ExtraZoomFactor,1.0))
Assert(0.0<ExtraZoomFactor,RT_String("%s0.0 < ExtraZoomFactor(%f)",myName,ExtraZoomFactor))
MaxCorrectionLimitsHorizontalPanning=Float(Default(MaxCorrectionLimitsHorizontalPanning,15.0))
Assert(1.0<=MaxCorrectionLimitsHorizontalPanning,RT_String("%s1.0 <= MaxCorrectionLimitsHorizontalPanning(%f)",
\ myName,MaxCorrectionLimitsHorizontalPanning))
MaxCorrectionLimitsVerticalPanning=Float(Default(MaxCorrectionLimitsVerticalPanning,15.0))
Assert(1.0<=MaxCorrectionLimitsVerticalPanning,RT_String("%s1.0 <= MaxCorrectionLimitsVerticalPanning(%f)",
\ myName,MaxCorrectionLimitsVerticalPanning))
MaxCorrectionLimitsRotation=Float(Default(MaxCorrectionLimitsRotation,5.0))
Assert(1.0<=MaxCorrectionLimitsRotation,RT_String("%s1.0 <= MaxCorrectionLimitsRotation(%f)",myName,MaxCorrectionLimitsRotation))
MaxCorrectionLimitsZoom=Float(Default(MaxCorrectionLimitsZoom,15.0))
Assert(1.0<=MaxCorrectionLimitsZoom,RT_String("%s1.0 <= MaxCorrectionLimitsZoom(%f)",myName,MaxCorrectionLimitsZoom))
UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled=Default(UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled,False)
UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled=Default(UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled,False)
UsePreviousAndFutureFramesToFillInBordersPreviousFrames=Default(UsePreviousAndFutureFramesToFillInBordersPreviousFrames,30)
Assert(0<=UsePreviousAndFutureFramesToFillInBordersPreviousFrames,
\ RT_String("%s0 <= UsePreviousAndFutureFramesToFillInBordersPreviousFrames(%d)",
\ myName,UsePreviousAndFutureFramesToFillInBordersPreviousFrames))
UsePreviousAndFutureFramesToFillInBordersFutureFrames=Default(UsePreviousAndFutureFramesToFillInBordersFutureFrames,30)
Assert(0<=UsePreviousAndFutureFramesToFillInBordersFutureFrames,
\ RT_String("%s0 <= UsePreviousAndFutureFramesToFillInBordersFutureFrames(%d)",
\ myName,UsePreviousAndFutureFramesToFillInBordersFutureFrames))
IgnorePixelsOutside_LetAreaFollowMotion=Default(IgnorePixelsOutside_LetAreaFollowMotion,False)
DeepAnalysisIfLessThanXPercentOfVectorsAreOk=Default(DeepAnalysisIfLessThanXPercentOfVectorsAreOk,0)
Assert(0<=DeepAnalysisIfLessThanXPercentOfVectorsAreOk<=100,
\ RT_String("%s 0 <= DeepAnalysisIfLessThanXPercentOfVectorsAreOk <= 100(%d)",myName,DeepAnalysisIfLessThanXPercentOfVectorsAreOk))
CamcorderHasARollingShutter=Default(CamcorderHasARollingShutter,false)
GenerateInterlacedProgressiveVideo=Default(GenerateInterlacedProgressiveVideo,false)
SoftBorders=Default(SoftBorders,false)
ExtrapolateColorsIntoBorder=Default(ExtrapolateColorsIntoBorder,false)
SoftBorders_EdgeTransitionWidth=Default(SoftBorders_EdgeTransitionWidth,10)
Assert(0<=SoftBorders_EdgeTransitionWidth,RT_String("%s0 <= SoftBorders_EdgeTransitionWidth(%d)",myName,SoftBorders_EdgeTransitionWidth))
DiscardMotionOfBlocksThatMoveMoreThanXPixels=Float(Default(DiscardMotionOfBlocksThatMoveMoreThanXPixels,1000.0))
Assert(0.0<DiscardMotionOfBlocksThatMoveMoreThanXPixels, RT_String("%s0.0 < DiscardMotionOfBlocksThatMoveMoreThanXPixels(%f)",
\ myName,DiscardMotionOfBlocksThatMoveMoreThanXPixels))
RememberDiscardedAreasToNextFrame=Default(RememberDiscardedAreasToNextFrame,true)
RollingShutterAmount=Float(Default(RollingShutterAmount,88.0)) ##### Any Value ???
DetectRotation=Default(DetectRotation,true)
DetectZoom=Default(DetectZoom,true)
DetectScenes_Threshold=Float(Default(DetectScenes_Threshold,20.0))
Assert(0.0<=DetectScenes_Threshold<=1000.0, RT_String("%s0.0 <= DetectScenes_Threshold <= 1000.0(%f)",
\ myName,DetectScenes_Threshold))
AdaptiveZoomSmoothness=Float(Default(AdaptiveZoomSmoothness,5000.0))
Assert(0.0<AdaptiveZoomSmoothness,RT_String("%s0.0 < AdaptiveZoomSmoothness(%f)",myName,AdaptiveZoomSmoothness))
AdaptiveZoomAmount=Float(Default(AdaptiveZoomAmount,100.0)) ##### Any Value ???
DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX=Default(DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX,20)
Assert(0<=DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX<=255,
\ RT_String("%s0 <= DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX <= 255(%d)",
\ myName,DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX))
DetectScenes=Default(DetectScenes,true)
UseColorMask=Default(UseColorMask,false)
MaskColorInHexRRGGBB=BitAnd(Default(MaskColorInHexRRGGBB,$FF00FF),$FFFFFF)
#########
Auto=Default(Auto,Pass==1) # Default True if Pass==1 or False if Pass==2
Assert(Pass==1 || !Auto,RT_String("%sCannot use Auto=True if Pass==2",myName))
Debug=Default(Debug,True)
Plugin=Default(Plugin,"Deshaker.vdf")
Assert(Plugin!="",RT_string("%sRequires Plugin",myName))
Plugin=RT_GetFullPathName(Plugin)
(Debug) ? RT_DebugF("Plugin = '%s'",Plugin,name=myName) : NOP
PreRoll = Max(Default(PreRoll,0),0)
#########
Fmt1="%d|%d"
Fmt2="|%d|%d|%.*f|%d|%.*f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%.*f|%d|%d|%d|%.*f|%d|%.*f|%.*f|" +
\ "%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%.*f|%.*f|%.*f|%.*f|%.*f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%.*f|%d|%.*f|%d|%d|%.*f|%.*f|%.*f|%d|%d|%d|%x"
S1=RT_String(Fmt1,DSVersion,Pass)
S2=RT_String(Fmt2,
\ BlockSize,DifferentialSearchRange,
\ f2ip(SourcePixelAspectValue),SourcePixelAspectValue,SourcePixelAspectSelection,
\ f2ip(DestinationPixelAspectValue),DestinationPixelAspectValue,DestinationPixelAspectSelection,
\ DestinationWidth,DestinationHeight,Scale,UsePixels,
\ MotionSmoothnessHorizontalPanning,MotionSmoothnessVerticalPanning,MotionSmoothnessRotation,MotionSmoothnessZoom,
\ f2ip(DiscardMotionOfXBlocks),DiscardMotionOfXBlocks,VideoOutput,EdgeCompensation,Resampling,
\ f2ip(SkipFrameIfLessThanXPercentOfBlocksOk),SkipFrameIfLessThanXPercentOfBlocksOk,InitialSearchRange,
\ f2ip(DiscardMotionOfBlocksMatchingValueLessThanX),DiscardMotionOfBlocksMatchingValueLessThanX,
\ f2ip(DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX),DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,
\ LogFile,AppendToFile?1:0,
\ IgnorePixelsOutside?1:0,IgnorePixelsOutsideLeft,IgnorePixelsOutsideRight,IgnorePixelsOutsideTop,IgnorePixelsOutsideBottom,
\ IgnorePixelsInside?1:0,IgnorePixelsInsideLeft,IgnorePixelsInsideRight,IgnorePixelsInsideTop,IgnorePixelsInsideBottom,
\ VideoTypeInterlaced?1:0,VideoTypeUpperFieldFirst?1:0,
\ f2ip(ExtraZoomFactor),ExtraZoomFactor,
\ f2ip(MaxCorrectionLimitsHorizontalPanning),MaxCorrectionLimitsHorizontalPanning,
\ f2ip(MaxCorrectionLimitsVerticalPanning),MaxCorrectionLimitsVerticalPanning,
\ f2ip(MaxCorrectionLimitsRotation),MaxCorrectionLimitsRotation,
\ f2ip(MaxCorrectionLimitsZoom),MaxCorrectionLimitsZoom,
\ UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled?1:0,UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled?1:0,
\ UsePreviousAndFutureFramesToFillInBordersPreviousFrames,UsePreviousAndFutureFramesToFillInBordersFutureFrames,
\ IgnorePixelsOutside_LetAreaFollowMotion?1:0,DeepAnalysisIfLessThanXPercentOfVectorsAreOk,
\ CamcorderHasARollingShutter?1:0,GenerateInterlacedProgressiveVideo?1:0,SameDestinationPropertiesAsSource?1:0,
\ SoftBorders?1:0,ExtrapolateColorsIntoBorder?1:0,SoftBorders_EdgeTransitionWidth,
\ f2ip(DiscardMotionOfBlocksThatMoveMoreThanXPixels),DiscardMotionOfBlocksThatMoveMoreThanXPixels,
\ RememberDiscardedAreasToNextFrame?1:0,
\ f2ip(RollingShutterAmount),RollingShutterAmount,
\ DetectRotation?1:0,DetectZoom?1:0,f2ip(DetectScenes_Threshold),DetectScenes_Threshold,
\ f2ip(AdaptiveZoomSmoothness),AdaptiveZoomSmoothness,
\ f2ip(AdaptiveZoomAmount),AdaptiveZoomAmount,
\ DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX,
\ DetectScenes?1:0,UseColorMask?1:0,MaskColorInHexRRGGBB
\ )
DBUG = true # Used during debugging
S=S1+S2
Fn=RT_String("ShakeRattleAndRoll_Debug_%d.txt",Pass)
(Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Debug) ? RT_DebugF("Loading VDPlugin='%s' As '%s', PreRoll=%d",Plugin, "Deshaker",PreRoll,name=myName) : NOP
LoadVirtualDubPlugin (Plugin, "Deshaker", preroll=PreRoll)
(Debug) ? RT_DebugF("Calling Pass=%d Dehaker(S)",(Auto)?1:Pass,name=myName) : NOP
Tmp=Deshaker(S)
(Auto) ? RT_ForceProcess(Tmp) : NOP
(Auto) ? Tmp.RT_AverageLuma(n=0,w=1,h=1) : NOP # Rewind, Read Frame 0. Fixes Avs 2.60 Standard Black Clip, no idea why.
(Auto) ? Last : Tmp # If NOT Auto, then we return result of previous DeShaker(Pass=Whatever).
Fn=(Auto) ? "ShakeRattleAndRoll_Debug_2.txt" : Fn
S =(Auto) ? RT_String(Fmt1,DSVersion,2)+S2 : S
(Auto&&Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Auto&&Debug) ? RT_DebugF("Calling Pass=2 Dehaker(S)",name=myName) : NOP
(Auto) ? Deshaker(S) : NOP
Return Last
}


Example Mod for eg previously given GoorawinStub, mods Added in Blue. (Do similar for the preset demo stub)

Function GoorawinStub(clip c,Int "Pass",String "LogFile",Bool "Auto",Bool "Debug",String "Plugin",Int "PreRoll") { # Specific fixed settings.
ShakeRattleAndRoll(c,Pass,
\ EdgeCompensation=4,MaxCorrectionLimitsHorizontalPanning=8.0,MaxCorrectionLimitsVerticalPanning=8.0,
\ MaxCorrectionLimitsRotation=3.0,MaxCorrectionLimitsZoom=8.0,CamcorderHasARollingShutter=True,RollingShutterAmount=90.0,
\ LogFile=LogFile,Auto=Auto,Debug=Debug,
\ Plugin=Plugin,PreRoll=PreRoll
\)
}


EDIT: Line In RED near end of script, Fixes v2.60 standard black clip, ALL working OK now. (also, flash "Deshaker" window no longer appears)

goorawin
3rd December 2018, 22:42
Hi StainlessS
Thanks for your efforts.
Your first script with the following settings, works the same as the original script once did. However it will still come up with Access Violation most of the time when using AVSPmod but is OK when rendering.
\ )
DBUG = true # Used during debugging
S=S1+S2
Fn=RT_String("ShakeRattleAndRoll_Debug_%d.txt",Pass)
(Debug) ? RT_DebugF("%s",S,name=myName) : NOP
(Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Debug) ? RT_DebugF("Loading VDPlug='%s' As '%s', PreRoll=%d",DeShakerPlugName, "Deshaker_1",PreRoll) : NOP
LoadVirtualDubPlugin ("C:\Virtual Dub 2\plugins64\Deshaker_1.vdf","deshaker_1", preroll=PreRoll)
Tmp=Deshaker_1(S)
(Auto) ? RT_ForceProcess(Tmp) : NOP
(Auto) ? Last : Tmp # If NOT Auto, then we return result of previous DeShaker(Pass=Whatever).
Tmp = 0 # If Auto, Force closure of tmp, allow reopen of log file for pass=2.
Fn=(Auto) ? "ShakeRattleAndRoll_Debug_2.txt" : Fn
S =(Auto) ? RT_String(Fmt1,DSVersion,2)+S2 : S
(Auto&&Debug) ? RT_DebugF("%s",S,name=myName) : NOP
(Auto&&Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Auto) ? RT_Sleep(1.0) : NOP
DeShakerPlugName2=RT_FilenameSplit(DeShakerPlugName,7) + "2" + RT_FilenameSplit(DeShakerPlugName,8)
(Debug&&Auto) ? RT_DebugF("Loading VDPlug='%s' As '%s', PreRoll=%d",DeShakerPlugName2, "Deshaker_2",PreRoll) : NOP
(Auto) ? LoadVirtualDubPlugin ("C:\Virtual Dub 2\plugins64\Deshaker_2.vdf","deshaker_2", preroll=0) : NOP
(Debug&&Auto) ? RT_DebugF("Calling Dehaker_2(S)") : NOP
(Auto) ? Deshaker_2(S) : NOP
Return Last
}

With your second script, I have not been able to get that to work, as have not yet figured out what needs to be changed to make it work!!!
Its very different.

StainlessS
3rd December 2018, 23:20
You could have easily just copy/paste the two posts, but here as 7z:- http://www.mediafire.com/file/5g2um9o20t5ecqn/ShakeRattleAndRoll.7z/file

goorawin
4th December 2018, 00:01
I did that, but it can not locate the VD deshaker plugin.
Even if I try and add its location it still has an error, but then I'm not sure where I should be adding that location in this new script. So I probably have not be using the right spot.

StainlessS
4th December 2018, 00:16
With VD plugins in current dir, Deshaker_x86.vdf, and Deshaker_x64.vdf.

or mod this (line 10), eg

Plugin=(x64) ? "D:\SomeDirectory\Deshaker_x64.vdf" : "D:\SomeOtherDirectory\Deshaker_x86.vdf"
or
Plugin="D:\Goorawin\DeshakerStuff\DS.vdf" # or whatever, but must be the correct plug for x86 or x64, whatever you are using.

EDIT: If Plugin arg not supplied to function, then default is Deshaker.vdf in current directory.
If you want, you could change the default in this line
Plugin=Default(Plugin,"Deshaker.vdf")
The x64 selection code in client was so I could test x86 and x64 without any messing about,
it selects the correct plugin when using Vdub2(x86 or x64 vdub).

EDIT:
Dont know if there is an AvsPMod x64 version (nor what its process name would be) but something like below could be
kludged to make it work with it, ie choose x86 or x64 plugin based on ProcessName


x64=
\ (ProcessName=="Virtualdub.Exe" || ProcessName=="AvsPMod.Exe" ) ? False
\ : (ProcessName=="Virtualdub64.Exe" || ProcessName=="AvsPMod64.Exe") ? True
\ : x64


The ProcessName is shown in DebugView before the call to the function.

Or to select x64 plugin if ProcessName contains "64" somewhere, otherwise selects x86 plugin.
x64 = (FindStr(ProcessName,"64")>0)

EDIT:
If you look at DebugView (Google), you would see what plugin it is trying to load, eg when loading into VDub2 x64


00000021 3145.53759766 RT_DebugF: ProcessName=VirtualDub64.exe
00000022 3145.53857422 ShakeRattleAndRoll: Plugin = 'D:\ShakeRattleAndRoll\Deshaker_x64.vdf'
00000023 3145.53979492 ShakeRattleAndRoll: Loading VDPlugin='D:\ShakeRattleAndRoll\Deshaker_x64.vdf' As 'Deshaker', PreRoll=0
00000024 3145.54467773 ShakeRattleAndRoll: Calling Pass=1 Dehaker(S)
00000025 3145.55688477 RT_ForceProcess: Commencing Forced process
00000026 3151.55493164 RT_ForceProcess: 187] 4.98% nFrms=188 T=5.990sec : 31.39FpS 0.031862SpF
00000027 3157.74829102 RT_ForceProcess: 376] 9.99% nFrms=189 T=6.193sec : 30.52FpS 0.032767SpF
00000028 3163.69702148 RT_ForceProcess: 565] 14.99% nFrms=189 T=5.960sec : 31.71FpS 0.031534SpF
00000029 3169.94189453 RT_ForceProcess: 754] 20.00% nFrms=189 T=6.240sec : 30.29FpS 0.033016SpF
00000030 3176.06616211 RT_ForceProcess: 942] 24.98% nFrms=188 T=6.130sec : 30.67FpS 0.032606SpF
00000031 3182.25244141 RT_ForceProcess: 1131] 29.99% nFrms=189 T=6.178sec : 30.59FpS 0.032688SpF
00000032 3188.34228516 RT_ForceProcess: 1320] 34.99% nFrms=189 T=6.100sec : 30.98FpS 0.032275SpF
00000033 3194.32495117 RT_ForceProcess: 1509] 40.00% nFrms=189 T=5.974sec : 31.64FpS 0.031608SpF
00000034 3200.35009766 RT_ForceProcess: 1697] 44.98% nFrms=188 T=6.022sec : 31.22FpS 0.032032SpF
00000035 3206.65405273 RT_ForceProcess: 1886] 49.99% nFrms=189 T=6.302sec : 29.99FpS 0.033344SpF
00000036 3212.80615234 RT_ForceProcess: 2075] 54.99% nFrms=189 T=6.162sec : 30.67FpS 0.032603SpF
00000037 3219.07690430 RT_ForceProcess: 2264] 60.00% nFrms=189 T=6.272sec : 30.13FpS 0.033185SpF
00000038 3225.24340820 RT_ForceProcess: 2452] 64.98% nFrms=188 T=6.162sec : 30.51FpS 0.032777SpF
00000039 3231.24902344 RT_ForceProcess: 2641] 69.99% nFrms=189 T=6.006sec : 31.47FpS 0.031778SpF
00000040 3237.10986328 RT_ForceProcess: 2830] 74.99% nFrms=189 T=5.865sec : 32.23FpS 0.031032SpF
00000041 3243.17749023 RT_ForceProcess: 3019] 80.00% nFrms=189 T=6.069sec : 31.14FpS 0.032111SpF
00000042 3249.07373047 RT_ForceProcess: 3207] 84.98% nFrms=188 T=5.896sec : 31.89FpS 0.031362SpF
00000043 3255.14160156 RT_ForceProcess: 3396] 89.99% nFrms=189 T=6.069sec : 31.14FpS 0.032111SpF
00000044 3261.34228516 RT_ForceProcess: 3585] 94.99% nFrms=189 T=6.193sec : 30.52FpS 0.032767SpF
00000045 3267.47680664 RT_ForceProcess: 3774] 100.00% nFrms=189 T=6.131sec : 30.83FpS 0.032439SpF
00000046 3267.47680664 RT_ForceProcess: Time=121.914secs (2.032mins) : Avg 30.964FpS 0.032295SpF
00000047 3267.49877930 ShakeRattleAndRoll: Calling Pass=2 Dehaker(S)


EDIT:
You can use whatever client script you were using before, but instead of loading Deshaker plugin yourself, must supply Plugin filename arg to ShakeRattleAndRoll, (default Deshaker.vdf in current script directory), must also supply Preroll arg (default 0) if
non default value needed. Other than that, you can use whatever script you were already using.
[If using previously given or modified stubs, then must also add Plugin and Preroll args and call ShakeRattleAndRoll with those args
as outlined already].

EDIT:
And here a mod of your very first post in this thread (back in 2016), the Rewind line is the important one (fixes the probs we had).

SetMemoryMax(1024)
SetFilterMTMode("DEFAULT_MT_MODE", 1)
LoadVirtualDubPlugin ("C:\Virtual Dub\plugins32\Deshaker.vdf", "deshaker", preroll=0)
Clip=("E:\Resolve Editing\09 Beechy\MTS\00162.MTS")
V1=LWLibavVideoSource(Clip,format ="YUV420P8")
A=LWLibavAudioSource(Clip)
V2=Stabalizer01(V1)
AudioDub(V2,A)
Assumefps(50.00)
Prefetch(2)
Return Last

function Stabalizer01(clip Clip) {
ConvertToRGB32(clip, matrix="rec709")
PASS1=Deshaker("19|1|30|4|1|0|1|0|640|480|1|2|1000|1000|1000|1000|4|1|4|2|8|30|300|4|"
\ + "D:\\Deshaker logs\\00232.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|8|8|3|8|0|0|30|30|0|0|"
\ + "1|0|1|1|0|10|1000|1|90|1|1|20|5000|100|20|1|0|ff00ff")
PASS1.RT_ForceProcess
PASS1.RT_AverageLuma(n=0,w=1,h=1) # Rewind, Read Frame 0.
PASS2=Deshaker("19|2|30|4|1|0|1|0|640|480|1|2|1000|1000|1000|1000|4|1|4|2|8|30|300|4|"
\ + "D:\\Deshaker logs\\00232.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|8|8|3|8|0|0|30|30|0|0|"
\ + "1|0|1|1|0|10|1000|1|90|1|1|20|5000|100|20|1|0|ff00ff")
PASS2.ConvertToYV12(matrix="rec709")
FZ1000HDFinal05()
}

goorawin
5th December 2018, 00:25
Thank you StainlessS
I did try changing that location and AVSPmod crashed on me so thought it was wrong. Since then I have noted that AVSPmod does crash from time to time with these new script. Maybe it is something to do with the access violation that also happens, but then that was happening before. Anyway it does not happen when rendering which is all good.
As I do not use 32bit anymore and the location of Virtual Dub should remain the same I have decided to just use the following in my scripts, and its working really well:
\ )
DBUG = true # Used during debugging
x64=True
PreRoll=0
Plugin=(x64) ? "Deshaker_64.vdf" : "Deshaker_x86.vdf"
S=S1+S2
Fn=RT_String("DeshakerStabilizing01_Debug_%d.txt",Pass)
(Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Debug) ? RT_DebugF("Loading VDPlugin='%s' As '%s', PreRoll=%d",Plugin, "Deshaker",PreRoll,name=myName) : NOP
LoadVirtualDubPlugin ("C:\Virtual Dub 2\plugins64\Deshaker_64.vdf","Deshaker", preroll=preroll)
(Debug) ? RT_DebugF("Calling Pass=%d Dehaker(S)",(Auto)?1:Pass,name=myName) : NOP
Tmp=Deshaker(S)
(Auto) ? RT_ForceProcess(Tmp) : NOP
(Auto) ? Tmp.RT_AverageLuma(n=0,w=1,h=1) : NOP # Rewind, Read Frame 0. Fixes Avs 2.60 Standard Black Clip, no idea why.
(Auto) ? Last : Tmp # If NOT Auto, then we return result of previous DeShaker(Pass=Whatever).
Fn=(Auto) ? "DeshakerStabilizing01_Debug_2.txt" : Fn
S =(Auto) ? RT_String(Fmt1,DSVersion,2)+S2 : S
(Auto&&Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Auto&&Debug) ? RT_DebugF("Calling Pass=2 Dehaker(S)",name=myName) : NOP
(Auto) ? Deshaker(S) : NOP
Return Last
}

Thanks again for all your efforts.

StainlessS
5th December 2018, 00:46
This is the end of Shake...etc,

DBUG = true # Used during debugging
S=S1+S2
Fn=RT_String("ShakeRattleAndRoll_Debug_%d.txt",Pass)
(Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Debug) ? RT_DebugF("Loading VDPlugin='%s' As '%s', PreRoll=%d",Plugin, "Deshaker",PreRoll,name=myName) : NOP
LoadVirtualDubPlugin (Plugin, "Deshaker", preroll=PreRoll)
(Debug) ? RT_DebugF("Calling Pass=%d Dehaker(S)",(Auto)?1:Pass,name=myName) : NOP
Tmp=Deshaker(S)
(Auto) ? RT_ForceProcess(Tmp) : NOP
(Auto) ? Tmp.RT_AverageLuma(n=0,w=1,h=1) : NOP # Rewind, Read Frame 0. Fixes Avs 2.60 Standard Black Clip, no idea why.
(Auto) ? Last : Tmp # If NOT Auto, then we return result of previous DeShaker(Pass=Whatever).
Fn=(Auto) ? "ShakeRattleAndRoll_Debug_2.txt" : Fn
S =(Auto) ? RT_String(Fmt1,DSVersion,2)+S2 : S
(Auto&&Debug&&DBUG) ? RT_WriteFile(Fn,"%s",S) : NOP
(Auto&&Debug) ? RT_DebugF("Calling Pass=2 Dehaker(S)",name=myName) : NOP
(Auto) ? Deshaker(S) : NOP
Return Last


You seem to be hacking stuff for no real reason, If you are using the function, then PreRoll default is already zero, you dont not have to hack it to 0.
The Default for Plugin is Deshaker.vdf in current directory, you dont need hack in the x64 stuff, as you dont even use it afterwards.
Just call the function with the path to your chosen plug name ie Plugin="C:\Virtual Dub 2\plugins64\Deshaker_64.vdf",
or Hack Only the in blue below (and leave everything else alone).

Auto=Default(Auto,Pass==1) # Default True if Pass==1 or False if Pass==2
Assert(Pass==1 || !Auto,RT_String("%sCannot use Auto=True if Pass==2",myName))
Debug=Default(Debug,True)
# Plugin=Default(Plugin,"Deshaker.vdf")
Plugin=Default(Plugin,"C:\Virtual Dub 2\plugins64\Deshaker_64.vdf")
Assert(Plugin!="",RT_string("%sRequires Plugin",myName))
Plugin=RT_GetFullPathName(Plugin)
(Debug) ? RT_DebugF("Plugin = '%s'",Plugin,name=myName) : NOP
PreRoll = Max(Default(PreRoll,0),0)



#If Not hacking plugin
Plugin = "C:\Virtual Dub 2\plugins64\Deshaker_64.vdf"
ShakeRattleAndRoll(plugin=Plugin, ... etc)

# or with Hacked Plugin and just
ShakeRattleAndRoll( ... etc)


Or with GoorawinStub (Added stuff since original in blue)

Function GoorawinStub(clip c,Int "Pass",String "LogFile",Bool "Auto",Bool "Debug",String "Plugin",Int "PreRoll") { # Specific fixed settings.
Plugin=Default(Plugin, "C:\Virtual Dub 2\plugins64\Deshaker_64.vdf")
Preroll=Default(Preroll,0) # or hack to whatever if you dont like zero
ShakeRattleAndRoll(c,Pass,
\ EdgeCompensation=4,MaxCorrectionLimitsHorizontalPanning=8.0,MaxCorrectionLimitsVerticalPanning=8.0,
\ MaxCorrectionLimitsRotation=3.0,MaxCorrectionLimitsZoom=8.0,CamcorderHasARollingShutter=True,RollingShutterAmount=90.0,
\ LogFile=LogFile,Auto=Auto,Debug=Debug,Plugin=Plugin,PreRoll=PreRoll
\)
}

# Call with eg
GoorawinStub( ... etc) # already Defaults to Goorawin vd path, even for non hacked ShakeRattleAndRoll

goorawin
5th December 2018, 06:16
I take your point, so have updated the script accordingly
Thanks again

BiOSsCZ
13th April 2021, 19:20
Hello. I'm using Deshaker for stabilization before migration on to the new DePan x64 dll and fully avisynth solution.

Here are the files that (.bat) will run and get (the "log" folder) for all .log files with analysis, for Deshaker.

I need advice (maybe stupid):
What is the syntax for calling the VD filter at the end of my avisynth script and application by setting "Adaptive (no borders)" + "Bicubic resize (best)" for the second pass?

Wouldn't the code have to be complicated? Thanks in advance for any answer.