Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th November 2018, 00:35   #41  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
Hi, give me a little time, I'm busy trying to set up x64 Avs, got gazillions of plugins to sort out.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 26th November 2018, 01:09   #42  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
Not a problem.
Thanks for all your great work on progressing Avisynth further
goorawin is offline   Reply With Quote
Old 1st December 2018, 12:31   #43  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
With this
Code:
LoadVirtualDubPlugin ("D:\ShakeRattleAndRoll\Deshaker.vdf", "deshaker", preroll=0)
FN="D:\G.avi"
AviSource(FN).ConvertToRGB32.Trim(10000,-500)
ShakeRattleAndRoll(MotionSmoothnessHorizontalPanning=-1,MotionSmoothnessVerticalPanning=-1,MotionSmoothnessRotation=-1,MotionSmoothnessZoom=-1)
return Last
I'm also getting this

No idea to the cause.
Probably not around till tomorrow (unless mobile).

Current Avs+, and also current VD2.

EDIT: I dont seem to be able to find any reference to VD2 in registry, and so am wondering how Deshaker plugin is supposed to find it.

EDIT: Arg to deshaker =
Code:
19|1|30|4|1|0|1|0|854|480|1|2|-1|-1|-1|-1|4|1|0|2|8|30|300|4|D:\\ShakeRattleAndRoll
\\ShakeRattleAndRoll.Log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|0|0|0|1|
0|0|10|1000|1|88|1|1|20|5000|100|20|1|0|ff00ff
EDIT: OK, there is HKEY_CLASSES_ROOT\Applications\VirtualDub.Exe\
and VirtualDub64.Exe
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st December 2018 at 12:41.
StainlessS is offline   Reply With Quote
Old 1st December 2018, 12:41   #44  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,036
To use a vd/vd2 plugin in AviSynth you don't need to have a real VirtualDub.
And as for the 'no filterdefinition structure' - it's LoadVirtualDubPlugin filter in vdubfilter.dll who is unable to load Deshaker.vdf for some reason and displays the message.
pinterf is online now   Reply With Quote
Old 1st December 2018, 13:23   #45  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,036
The plugin instances are reference counted. When the reference count becomes zero, the resource is freed up.
The script is killing the clip variable by an explicite Tmp=0 which unloads the deshaker plugin:
end of ShakeRattleAndRoll.avsi:
Code:
    Tmp=Deshaker(S)
[...]
    Tmp = 0 #closure of tmp, allow reopen of log file for pass=2.
For the next usage, some lines later (2nd pass) the filter is not available anymore, we get a no Filterdefinition structure message.

For an instant solution I recommend that you

1.) make a copy of Deshaker.VFD to a different file name.
2.) Modify your script to load both plugins under different avisynth name
e.g.
Code:
LoadVirtualDubPlugin ("C:\virtualdub\plugins64\Deshaker_64.vdf", "Deshaker", preroll=0)
LoadVirtualDubPlugin ("C:\virtualdub\plugins64\Deshaker_64_b.vdf", "Deshaker2", preroll=0)
3.) Change ShakeRattleAndRoll.avsi to use the new name "Deshaker2" for the 2nd pass.
Code:
(Auto) ? Deshaker2(S) : NOP
Return Last
pinterf is online now   Reply With Quote
Old 1st December 2018, 23:13   #46  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
Quote:
Originally Posted by pinterf View Post
The plugin instances are reference counted. When the reference count becomes zero, the resource is freed up.
The script is killing the clip variable by an explicite Tmp=0 which unloads the deshaker plugin:
end of ShakeRattleAndRoll.avsi:
Code:
    Tmp=Deshaker(S)
[...]
    Tmp = 0 #closure of tmp, allow reopen of log file for pass=2.
For the next usage, some lines later (2nd pass) the filter is not available anymore, we get a no Filterdefinition structure message.

For an instant solution I recommend that you

1.) make a copy of Deshaker.VFD to a different file name.
2.) Modify your script to load both plugins under different avisynth name
e.g.
Code:
LoadVirtualDubPlugin ("C:\virtualdub\plugins64\Deshaker_64.vdf", "Deshaker", preroll=0)
LoadVirtualDubPlugin ("C:\virtualdub\plugins64\Deshaker_64_b.vdf", "Deshaker2", preroll=0)
3.) Change ShakeRattleAndRoll.avsi to use the new name "Deshaker2" for the 2nd pass.
Code:
(Auto) ? Deshaker2(S) : NOP
Return Last
Thanks Pinterf
That certainly works, but why did the previous script stop working?
I have used it countless times with no problems. But probably have not done so on this new computer. or on an older computer for the last 12 months. Both have Windows 10 pro (current version). Very strange!!!!!
goorawin is offline   Reply With Quote
Old 1st December 2018, 23:50   #47  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
I must be going crazy Pinterf.
Your method work three times with no problems, after that it comes up with the same error as before. Even if I change pass1 in the deshaker script (after it has created a log file and then the error) to pass2, it now has the same error for pass2 using your suggestions.
I haven't as yet rebooted the computer to see if it reverts back to working but I very much doubt it.
goorawin is offline   Reply With Quote
Old 2nd December 2018, 21:10   #48  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
Post 1 of 2.

Using current temp script,

Code:
#return Version
FN="D:\G.avi"
AviSource(FN).ConvertToRGB32.Trim(0,-500) # 500 frames only
#ShakeRattleAndRoll(MotionSmoothnessHorizontalPanning=-1,MotionSmoothnessVerticalPanning=-1,MotionSmoothnessRotation=-1,MotionSmoothnessZoom=-1)
ShakeRattleAndRoll()
return Last

Function ShakeRattleAndRoll(clip c,Int "Pass",Int "BlockSize",Int "DifferentialSearchRange",
    \ Float  "SourcePixelAspectValue",Int "SourcePixelAspectSelection",
    \ Float  "DestinationPixelAspectValue",Int "DestinationPixelAspectSelection",
    \ Int    "DestinationWidth",Int "DestinationHeight",Int "Scale",Int "UsePixels",
    \ Int    "MotionSmoothnessHorizontalPanning",Int "MotionSmoothnessVerticalPanning",Int "MotionSmoothnessRotation",
    \ Int    "MotionSmoothnessZoom",Float "DiscardMotionOfXBlocks",Int "VideoOutput",Int "EdgeCompensation",Int "Resampling",
    \ Float  "SkipFrameIfLessThanXPercentOfBlocksOk",Int "InitialSearchRange",
    \ Float  "DiscardMotionOfBlocksMatchingValueLessThanX",Float "DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX",
    \ String "LogFile",Bool "AppendToFile",
    \ Bool   "IgnorePixelsOutside",Int "IgnorePixelsOutsideLeft",Int "IgnorePixelsOutsideRight",Int "IgnorePixelsOutsideTop",
    \ Int    "IgnorePixelsOutsideBottom",
    \ Bool   "IgnorePixelsInside",Int "IgnorePixelsInsideLeft",Int "IgnorePixelsInsideRight",Int "IgnorePixelsInsideTop",
    \ Int    "IgnorePixelsInsideBottom",Bool "VideoTypeInterlaced",Bool "VideoTypeUpperFieldFirst",
    \ Float  "ExtraZoomFactor",Float "MaxCorrectionLimitsHorizontalPanning",Float "MaxCorrectionLimitsVerticalPanning",
    \ Float  "MaxCorrectionLimitsRotation",Float "MaxCorrectionLimitsZoom",
    \ Bool   "UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled",Bool "UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled",
    \ Int    "UsePreviousAndFutureFramesToFillInBordersPreviousFrames",Int "UsePreviousAndFutureFramesToFillInBordersFutureFrames",
    \ Bool   "IgnorePixelsOutside_LetAreaFollowMotion",Int "DeepAnalysisIfLessThanXPercentOfVectorsAreOk",
    \ Bool   "CamcorderHasARollingShutter",Bool "GenerateInterlacedProgressiveVideo",Bool "SameDestinationPropertiesAsSource",
    \ Bool   "SoftBorders",Bool "ExtrapolateColorsIntoBorder",Int "SoftBorders_EdgeTransitionWidth",
    \ Float  "DiscardMotionOfBlocksThatMoveMoreThanXPixels",Bool "RememberDiscardedAreasToNextFrame",
    \ Float  "RollingShutterAmount",Bool "DetectRotation",Bool "DetectZoom",Float "DetectScenes_Threshold",
    \ Float  "AdaptiveZoomSmoothness",Float "AdaptiveZoomAmount",Int "DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX",
    \ Bool   "DetectScenes",Bool "UseColorMask",Int "MaskColorInHexRRGGBB",
    \ Bool   "Auto", Bool "Debug",
    \ String "DeShakerPlugName",Int "PreRoll") {
    /*
        Can set Aspect Ratios directly using eg SourcePixelAspectValue=1.333 or by GUI index SourcePixelAspectSelection[0->7]
    */
    Function f2ip(Float f) {return (int(f)==f) ? 0 : 6}
    myName="ShakeRattleAndRoll: "
    c
    Assert(IsRGB32,RT_string("%sClip Must be RGB32",myName))  # Client MUST convert to RGB32 using whatever matrix and also Interlacing.
    DSVersion = 19                                            # Fixed by DeShaker.vdf, Need modify if new version of dll
    Pass=Default(Pass,1)
    Assert(1<=Pass<=2, RT_String("%sPass 1 or 2 Only(%d)",myName,Pass))
    BlockSize=Default(BlockSize,30)
    Assert(1<=BlockSize<=100, RT_String("%s1 <= BlockSize <= 100 Only(%d)",myName,BlockSize))
    DifferentialSearchRange=Default(DifferentialSearchRange,4)
    Assert(1<=DifferentialSearchRange, RT_String("%s1 <= DifferentialSearchRange(%d)",myName,DifferentialSearchRange))
    ### GUI ### SourcePixelAspectValue OverRides GUI selection if given as arg, Otherwise uses GUI SourcePixelAspectSelection[0->7] default 0=1:1.
    DefV=Defined(SourcePixelAspectValue)
    SourcePixelAspectSelection = (DefV) ? -1 : Max(Default(SourcePixelAspectSelection,0),0)
    Assert(-1<=SourcePixelAspectSelection<=7, RT_String("%s-1 <= SourcePixelAspectSelection <= 7(%d)", myName,SourcePixelAspectSelection))
    SourcePixelAspectValue = (DefV) ? Float(SourcePixelAspectValue)
        \ : Select(SourcePixelAspectSelection,1.0,1.09259,0.909091,1.45679,1.21212,1.63889,1.36364,1.33333)
    Assert(0.0<SourcePixelAspectValue,RT_String("%s0.0 < SourcePixelAspectValue(%f)",myName,SourcePixelAspectValue))
    ### Param 52, MUST Process out-of-param-sequence
    SameDestinationPropertiesAsSource=Default(SameDestinationPropertiesAsSource,true)
    ### GUI SameDestinationPropertiesAsSource OVERRIDES ALL, otherwise DestinationPixelAspectValue OverRides GUI selection if given as arg
    DefV=Defined(DestinationPixelAspectValue)
    DestinationPixelAspectSelection=(SameDestinationPropertiesAsSource)?SourcePixelAspectSelection:(DefV)?-1:Max(Default(DestinationPixelAspectSelection,0),0)
    Assert(-1<=DestinationPixelAspectSelection<=7,
        \ RT_String("%s-1 <= DestinationPixelAspectSelection <= 7(%d)",myName,DestinationPixelAspectSelection))
    DestinationPixelAspectValue = (SameDestinationPropertiesAsSource) ? SourcePixelAspectValue : (DefV) ? Float(DestinationPixelAspectValue)
        \ : Select(DestinationPixelAspectSelection,1.0,1.09259,0.909091,1.45679,1.21212,1.63889,1.36364,1.33333)
    Assert(0.0<DestinationPixelAspectValue, RT_String("%s0.0 < DestinationPixelAspectValue(%f)",myName,DestinationPixelAspectValue))
    ###
    DestinationWidth  = (SameDestinationPropertiesAsSource) ? Width  : Default(DestinationWidth, 640)
    DestinationHeight = (SameDestinationPropertiesAsSource) ? Height : Default(DestinationHeight,480)
    Assert(1<=DestinationWidth, RT_String("%s1 <= DestinationWidth(%d)",myName,DestinationWidth))
    Assert(1<=DestinationHeight,RT_String("%s1 <= DestinationHeight(%d)",myName,DestinationHeight))
    ### End of Source/Dest Same as stuff
    Scale=Default(Scale,1)
    Assert(0<=Scale<=2, RT_String("%s0 <= Scale <=2(%d)",myName,Scale))
    UsePixels=Default(UsePixels,2)
    Assert(1<=UsePixels<=4, RT_String("%s1 <= UsePixels <= 4(%d)",myName,UsePixels))

    MotionSmoothnessHorizontalPanning=Default(MotionSmoothnessHorizontalPanning,1000)
    Assert(-1<=MotionSmoothnessHorizontalPanning, RT_String("%s-1 <= MotionSmoothnessHorizontalPanning(%d)",myName,MotionSmoothnessHorizontalPanning))
    MotionSmoothnessVerticalPanning=Default(MotionSmoothnessVerticalPanning,1000)
    Assert(-1<=MotionSmoothnessVerticalPanning, RT_String("%s-1 <= MotionSmoothnessVerticalPanning(%d)",myName,MotionSmoothnessVerticalPanning))
    MotionSmoothnessRotation=Default(MotionSmoothnessRotation,1000)
    Assert(-1<=MotionSmoothnessRotation,RT_String("%s-1 <= MotionSmoothnessRotation(%d)",myName,MotionSmoothnessRotation))
    MotionSmoothnessZoom=Default(MotionSmoothnessZoom,1000)
    Assert(-1<=MotionSmoothnessZoom, RT_String("%s-1 <= MotionSmoothnessZoom(%d)",myName,MotionSmoothnessZoom))

    DiscardMotionOfXBlocks=Float(Default(DiscardMotionOfXBlocks,4.0))
    Assert(0.0<DiscardMotionOfXBlocks,RT_String("%s0.0 < DiscardMotionOfXBlocks(%f)",myName,DiscardMotionOfXBlocks))
    VideoOutput=Default(VideoOutput,1)
    Assert(0<=VideoOutput<=3, RT_String("%s0 <= VideoOutput <= 3(%d)",myName,VideoOutput))
    EdgeCompensation=Default(EdgeCompensation,0)
    Assert(EdgeCompensation==0||EdgeCompensation==1||EdgeCompensation==3||EdgeCompensation==4||EdgeCompensation==6,
        \ RT_String("%sEdgeCompensation 0,1,3,4 or 6 only(%d)",myName,EdgeCompensation))
    Resampling=Default(Resampling,2)
    Assert(0<=Resampling<=2,RT_String("%s0 <= Resampling <= 2(%d)",myName,Resampling))
    SkipFrameIfLessThanXPercentOfBlocksOk=Float(Default(SkipFrameIfLessThanXPercentOfBlocksOk,8.0))
    Assert(0.0<=SkipFrameIfLessThanXPercentOfBlocksOk<=100.0,RT_String("%s0.0 <= SkipFrameIfLessThanXPercentOfBlocksOk <= 100.0(%f)",
        \ myName,SkipFrameIfLessThanXPercentOfBlocksOk))
    InitialSearchRange=Default(InitialSearchRange,30)
    Assert(1<=InitialSearchRange<=99, RT_String("%s1 <= InitialSearchRange <= 99(%d)",myName,InitialSearchRange))
    DiscardMotionOfBlocksMatchingValueLessThanX=Float(Default(DiscardMotionOfBlocksMatchingValueLessThanX,300.0))
    Assert(-1000.0<=DiscardMotionOfBlocksMatchingValueLessThanX<=1000.0,
        \ RT_String("%s-1000.0 <= DiscardMotionOfBlocksMatchingValueLessThanX <= 1000.0(%f)",
        \ myName,DiscardMotionOfBlocksMatchingValueLessThanX))
    DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX=Float(Default(DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,4.0))
    Assert(0.0<=DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,
        \ RT_String("%s0.0 <= DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX(%f)",
        \ myName,DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX))
    LogFile=Default(LogFile,"ShakeRattleAndRoll.Log")
    Assert(LogFile!="",RT_String("%sLogfile Cannot be Empty string",myName))
    LogFile=RT_GetFullPathName(LogFile)
    Assert(Pass==1||Exist(LogFile),RT_String("%sPass 2 Logfile Does NOT Exist(%s)",myName,LogFile))
    LogFile=RT_StrReplace(LogFile,"\","\\")
    AppendToFile=Default(AppendToFile,False)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 2nd December 2018, 21:11   #49  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
Post 2 of 2.

Code:
    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)
    DeShakerPlugName=Default(DeShakerPlugName,"Deshaker.vdf")
    Assert(DeshakerPlugName!="",RT_string("%sRequires DeShakerPlugName",myName))
    DeShakerPlugName=RT_GetFullPathName(DeShakerPlugName)
    (Debug) ? RT_DebugF("DeShakerPlugName = '%s'",DeShakerPlugName,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)             ? 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 (DeShakerPlugName, "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 (DeShakerPlugName2, "Deshaker_2", preroll=PreRoll) : NOP
    (Debug&&Auto) ? RT_DebugF("Calling Dehaker_2(S)") : NOP
    (Auto)  ? Deshaker_2(S) : NOP
    Return Last
}
With Deshaker.vdf and identical Deshaker2.vdf in current directory,

x86, Avs v2.60 standard, Works ok as expected. [EDIT: No it dont, sometimes also has Access Violation, but seems not as often as below]

x86, Avs+ v2.60, Sometimes works ok, sometimes Access Violation, at line
Code:
(Auto) ? LoadVirtualDubPlugin (DeShakerPlugName2, "Deshaker_2", preroll=PreRoll) : NOP
x64, Avs+ v2.60, (x64 Deshaker.vdf and identical Deshaker2.vdf in current directory) Sometimes Access Violation, at line
Code:
(Auto) ? LoadVirtualDubPlugin (DeShakerPlugName2, "Deshaker_2", preroll=PreRoll) : NOP
Sometimes "There is no function named Deshaker_2" at line
Code:
(Auto)  ? Deshaker_2(S) : NOP
EDIT: Output for x64 avs+ where "There is no function named Deshaker_2" (Loading avs script into Vdub2 x64)
Code:
00000001    0.00000000  ShakeRattleAndRoll: DeShakerPlugName = 'D:\ShakeRattleAndRoll\Deshaker.vdf'
00000002    0.00067426  ShakeRattleAndRoll: 19|1|30|4|1|0|1|0|854|480|1|2|1000|1000|1000|1000|4|1|0|2|8|30|300|4|
    D:\\ShakeRattleAndRoll\\ShakeRattleAndRoll.Log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|0|0|0|1|0|0|10|1000|1|88|
    1|1|20|5000|100|20|1|0|ff00ff
00000003    0.00112824  RT_DebugF: Loading VDPlug='D:\ShakeRattleAndRoll\Deshaker.vdf' As 'Deshaker_1', PreRoll=0
00000004    0.01150922  RT_ForceProcess: Commencing Forced process
00000005    0.75406694  RT_ForceProcess:     24]   5.00%  nFrms=25  T=0.749sec  :  33.38FpS  0.029960SpF

...

00000024    16.02638054 RT_ForceProcess:    499] 100.00%  nFrms=25  T=0.842sec  :  29.69FpS  0.033680SpF
00000025    16.02643585 RT_ForceProcess: Time=16.021secs (0.267mins) : Avg 31.209FpS 0.032042SpF
00000026    16.02957344 ShakeRattleAndRoll: 19|2|30|4|1|0|1|0|854|480|1|2|1000|1000|1000|1000|4|1|0|2|8|30|300|4|
    D:\\ShakeRattleAndRoll\\ShakeRattleAndRoll.Log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|0|0|0|1|0|0|10|1000|1|88|
    1|1|20|5000|100|20|1|0|ff00ff
00000027    17.03472900 RT_DebugF: Loading VDPlug='D:\ShakeRattleAndRoll\Deshaker2.vdf' As 'Deshaker_2', PreRoll=0
00000028    17.03999710 RT_DebugF: Calling Dehaker_2(S)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd December 2018 at 01:10.
StainlessS is offline   Reply With Quote
Old 3rd December 2018, 04:08   #50  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
Post #1 of 2

OK, this works with Avs+, x86 and x64, but produces black clip for avs 2.60 standard.
(On 2nd pass of auto, avs+ shows 1st frame black, but flashes up a "Deshaking" window for 1 frame, and then clip is displayed,
avs 2.60 standard shows no "Deshaking" window, only black clip). [EDIT: See EDIT in red at end of next post]

With VD plugins in current dir, Deshaker_x86.vdf, and Deshaker_x64.vdf.
Code:
FN="D:\G.avi"
AviSource(FN).ConvertToRGB32
trim(0,-500)    # 500 frames Only
x64=False       # False = x86, True=x64, Default if NOT loading into VDub
PreRoll=0
###
ProcessName = RT_GetProcessName()       # Process loading avs script
RT_DebugF("ProcessName=%s",ProcessName)
x64=(ProcessName=="Virtualdub.Exe")?False:(ProcessName=="Virtualdub64.Exe")?True:x64   # Override Plugin if loading into VDub, x86 or x64
Plugin=(x64) ? "Deshaker_x64.vdf" : "Deshaker_x86.vdf"                                 # Plugin name in current directory
ShakeRattleAndRoll(plugin=Plugin,preroll=PreRoll)
return Last

Function ShakeRattleAndRoll(clip c,Int "Pass",Int "BlockSize",Int "DifferentialSearchRange",
    \ Float  "SourcePixelAspectValue",Int "SourcePixelAspectSelection",
    \ Float  "DestinationPixelAspectValue",Int "DestinationPixelAspectSelection",
    \ Int    "DestinationWidth",Int "DestinationHeight",Int "Scale",Int "UsePixels",
    \ Int    "MotionSmoothnessHorizontalPanning",Int "MotionSmoothnessVerticalPanning",Int "MotionSmoothnessRotation",
    \ Int    "MotionSmoothnessZoom",Float "DiscardMotionOfXBlocks",Int "VideoOutput",Int "EdgeCompensation",Int "Resampling",
    \ Float  "SkipFrameIfLessThanXPercentOfBlocksOk",Int "InitialSearchRange",
    \ Float  "DiscardMotionOfBlocksMatchingValueLessThanX",Float "DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX",
    \ String "LogFile",Bool "AppendToFile",
    \ Bool   "IgnorePixelsOutside",Int "IgnorePixelsOutsideLeft",Int "IgnorePixelsOutsideRight",Int "IgnorePixelsOutsideTop",
    \ Int    "IgnorePixelsOutsideBottom",
    \ Bool   "IgnorePixelsInside",Int "IgnorePixelsInsideLeft",Int "IgnorePixelsInsideRight",Int "IgnorePixelsInsideTop",
    \ Int    "IgnorePixelsInsideBottom",Bool "VideoTypeInterlaced",Bool "VideoTypeUpperFieldFirst",
    \ Float  "ExtraZoomFactor",Float "MaxCorrectionLimitsHorizontalPanning",Float "MaxCorrectionLimitsVerticalPanning",
    \ Float  "MaxCorrectionLimitsRotation",Float "MaxCorrectionLimitsZoom",
    \ Bool   "UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled",Bool "UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled",
    \ Int    "UsePreviousAndFutureFramesToFillInBordersPreviousFrames",Int "UsePreviousAndFutureFramesToFillInBordersFutureFrames",
    \ Bool   "IgnorePixelsOutside_LetAreaFollowMotion",Int "DeepAnalysisIfLessThanXPercentOfVectorsAreOk",
    \ Bool   "CamcorderHasARollingShutter",Bool "GenerateInterlacedProgressiveVideo",Bool "SameDestinationPropertiesAsSource",
    \ Bool   "SoftBorders",Bool "ExtrapolateColorsIntoBorder",Int "SoftBorders_EdgeTransitionWidth",
    \ Float  "DiscardMotionOfBlocksThatMoveMoreThanXPixels",Bool "RememberDiscardedAreasToNextFrame",
    \ Float  "RollingShutterAmount",Bool "DetectRotation",Bool "DetectZoom",Float "DetectScenes_Threshold",
    \ Float  "AdaptiveZoomSmoothness",Float "AdaptiveZoomAmount",Int "DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX",
    \ Bool   "DetectScenes",Bool "UseColorMask",Int "MaskColorInHexRRGGBB",
    \ Bool   "Auto", Bool "Debug",
    \ String "Plugin",Int "PreRoll") {
    /*
        Can set Aspect Ratios directly using eg SourcePixelAspectValue=1.333 or by GUI index SourcePixelAspectSelection[0->7]
    */
    Function f2ip(Float f) {return (int(f)==f) ? 0 : 6}
    myName="ShakeRattleAndRoll: "
    c
    Assert(IsRGB32,RT_string("%sClip Must be RGB32",myName))  # Client MUST convert to RGB32 using whatever matrix and also Interlacing.
    DSVersion = 19                                            # Fixed by DeShaker.vdf, Need modify if new version of dll
    Pass=Default(Pass,1)
    Assert(1<=Pass<=2, RT_String("%sPass 1 or 2 Only(%d)",myName,Pass))
    BlockSize=Default(BlockSize,30)
    Assert(1<=BlockSize<=100, RT_String("%s1 <= BlockSize <= 100 Only(%d)",myName,BlockSize))
    DifferentialSearchRange=Default(DifferentialSearchRange,4)
    Assert(1<=DifferentialSearchRange, RT_String("%s1 <= DifferentialSearchRange(%d)",myName,DifferentialSearchRange))
    ### GUI ### SourcePixelAspectValue OverRides GUI selection if given as arg, Otherwise uses GUI SourcePixelAspectSelection[0->7] default 0=1:1.
    DefV=Defined(SourcePixelAspectValue)
    SourcePixelAspectSelection = (DefV) ? -1 : Max(Default(SourcePixelAspectSelection,0),0)
    Assert(-1<=SourcePixelAspectSelection<=7, RT_String("%s-1 <= SourcePixelAspectSelection <= 7(%d)", myName,SourcePixelAspectSelection))
    SourcePixelAspectValue = (DefV) ? Float(SourcePixelAspectValue)
        \ : Select(SourcePixelAspectSelection,1.0,1.09259,0.909091,1.45679,1.21212,1.63889,1.36364,1.33333)
    Assert(0.0<SourcePixelAspectValue,RT_String("%s0.0 < SourcePixelAspectValue(%f)",myName,SourcePixelAspectValue))
    ### Param 52, MUST Process out-of-param-sequence
    SameDestinationPropertiesAsSource=Default(SameDestinationPropertiesAsSource,true)
    ### GUI SameDestinationPropertiesAsSource OVERRIDES ALL, otherwise DestinationPixelAspectValue OverRides GUI selection if given as arg
    DefV=Defined(DestinationPixelAspectValue)
    DestinationPixelAspectSelection=(SameDestinationPropertiesAsSource)?SourcePixelAspectSelection:(DefV)?-1:Max(Default(DestinationPixelAspectSelection,0),0)
    Assert(-1<=DestinationPixelAspectSelection<=7,
        \ RT_String("%s-1 <= DestinationPixelAspectSelection <= 7(%d)",myName,DestinationPixelAspectSelection))
    DestinationPixelAspectValue = (SameDestinationPropertiesAsSource) ? SourcePixelAspectValue : (DefV) ? Float(DestinationPixelAspectValue)
        \ : Select(DestinationPixelAspectSelection,1.0,1.09259,0.909091,1.45679,1.21212,1.63889,1.36364,1.33333)
    Assert(0.0<DestinationPixelAspectValue, RT_String("%s0.0 < DestinationPixelAspectValue(%f)",myName,DestinationPixelAspectValue))
    ###
    DestinationWidth  = (SameDestinationPropertiesAsSource) ? Width  : Default(DestinationWidth, 640)
    DestinationHeight = (SameDestinationPropertiesAsSource) ? Height : Default(DestinationHeight,480)
    Assert(1<=DestinationWidth, RT_String("%s1 <= DestinationWidth(%d)",myName,DestinationWidth))
    Assert(1<=DestinationHeight,RT_String("%s1 <= DestinationHeight(%d)",myName,DestinationHeight))
    ### End of Source/Dest Same as stuff
    Scale=Default(Scale,1)
    Assert(0<=Scale<=2, RT_String("%s0 <= Scale <=2(%d)",myName,Scale))
    UsePixels=Default(UsePixels,2)
    Assert(1<=UsePixels<=4, RT_String("%s1 <= UsePixels <= 4(%d)",myName,UsePixels))

    MotionSmoothnessHorizontalPanning=Default(MotionSmoothnessHorizontalPanning,1000)
    Assert(-1<=MotionSmoothnessHorizontalPanning, RT_String("%s-1 <= MotionSmoothnessHorizontalPanning(%d)",myName,MotionSmoothnessHorizontalPanning))
    MotionSmoothnessVerticalPanning=Default(MotionSmoothnessVerticalPanning,1000)
    Assert(-1<=MotionSmoothnessVerticalPanning, RT_String("%s-1 <= MotionSmoothnessVerticalPanning(%d)",myName,MotionSmoothnessVerticalPanning))
    MotionSmoothnessRotation=Default(MotionSmoothnessRotation,1000)
    Assert(-1<=MotionSmoothnessRotation,RT_String("%s-1 <= MotionSmoothnessRotation(%d)",myName,MotionSmoothnessRotation))
    MotionSmoothnessZoom=Default(MotionSmoothnessZoom,1000)
    Assert(-1<=MotionSmoothnessZoom, RT_String("%s-1 <= MotionSmoothnessZoom(%d)",myName,MotionSmoothnessZoom))

    DiscardMotionOfXBlocks=Float(Default(DiscardMotionOfXBlocks,4.0))
    Assert(0.0<DiscardMotionOfXBlocks,RT_String("%s0.0 < DiscardMotionOfXBlocks(%f)",myName,DiscardMotionOfXBlocks))
    VideoOutput=Default(VideoOutput,1)
    Assert(0<=VideoOutput<=3, RT_String("%s0 <= VideoOutput <= 3(%d)",myName,VideoOutput))
    EdgeCompensation=Default(EdgeCompensation,0)
    Assert(EdgeCompensation==0||EdgeCompensation==1||EdgeCompensation==3||EdgeCompensation==4||EdgeCompensation==6,
        \ RT_String("%sEdgeCompensation 0,1,3,4 or 6 only(%d)",myName,EdgeCompensation))
    Resampling=Default(Resampling,2)
    Assert(0<=Resampling<=2,RT_String("%s0 <= Resampling <= 2(%d)",myName,Resampling))
    SkipFrameIfLessThanXPercentOfBlocksOk=Float(Default(SkipFrameIfLessThanXPercentOfBlocksOk,8.0))
    Assert(0.0<=SkipFrameIfLessThanXPercentOfBlocksOk<=100.0,RT_String("%s0.0 <= SkipFrameIfLessThanXPercentOfBlocksOk <= 100.0(%f)",
        \ myName,SkipFrameIfLessThanXPercentOfBlocksOk))
    InitialSearchRange=Default(InitialSearchRange,30)
    Assert(1<=InitialSearchRange<=99, RT_String("%s1 <= InitialSearchRange <= 99(%d)",myName,InitialSearchRange))
    DiscardMotionOfBlocksMatchingValueLessThanX=Float(Default(DiscardMotionOfBlocksMatchingValueLessThanX,300.0))
    Assert(-1000.0<=DiscardMotionOfBlocksMatchingValueLessThanX<=1000.0,
        \ RT_String("%s-1000.0 <= DiscardMotionOfBlocksMatchingValueLessThanX <= 1000.0(%f)",
        \ myName,DiscardMotionOfBlocksMatchingValueLessThanX))
    DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX=Float(Default(DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,4.0))
    Assert(0.0<=DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,
        \ RT_String("%s0.0 <= DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX(%f)",
        \ myName,DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX))
    LogFile=Default(LogFile,"ShakeRattleAndRoll.Log")
    Assert(LogFile!="",RT_String("%sLogfile Cannot be Empty string",myName))
    LogFile=RT_GetFullPathName(LogFile)
    Assert(Pass==1||Exist(LogFile),RT_String("%sPass 2 Logfile Does NOT Exist(%s)",myName,LogFile))
    LogFile=RT_StrReplace(LogFile,"\","\\")
    AppendToFile=Default(AppendToFile,False)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd December 2018 at 05:56.
StainlessS is offline   Reply With Quote
Old 3rd December 2018, 04:10   #51  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
Post #2 of 2.

Code:
    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)
Code:
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)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd December 2018 at 15:39.
StainlessS is offline   Reply With Quote
Old 3rd December 2018, 22:42   #52  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
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.
goorawin is offline   Reply With Quote
Old 3rd December 2018, 23:20   #53  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
You could have easily just copy/paste the two posts, but here as 7z:- http://www.mediafire.com/file/5g2um9...ndRoll.7z/file
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 4th December 2018, 00:01   #54  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
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.
goorawin is offline   Reply With Quote
Old 4th December 2018, 00:16   #55  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
Quote:
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
Code:
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

Code:
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.
Code:
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

Code:
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).
Code:
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()
}
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th December 2018 at 04:44.
StainlessS is offline   Reply With Quote
Old 5th December 2018, 00:25   #56  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
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.
goorawin is offline   Reply With Quote
Old 5th December 2018, 00:46   #57  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,053
This is the end of Shake...etc,
Code:
    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).
Code:
    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)
Code:
#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)
Code:
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
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 5th December 2018 at 01:34.
StainlessS is offline   Reply With Quote
Old 5th December 2018, 06:16   #58  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 62
I take your point, so have updated the script accordingly
Thanks again
goorawin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 17:46.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.