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 14th October 2016, 11:27   #1  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
Avisynth+ 64bit two pass Deshaker script not working

I have just started trying the latest Avisynth+ 64bit
and the following script which (thanks to StainlessS and his great RT_stats script) I have been using very well for sometime on Avisynth+ 32 bit:-

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)
function Stabalizer01(clip Clip) {
ConvertToRGB32(clip, matrix="rec709")
SCRIPT1=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")
ForceProcess(SCRIPT1)
SCRIPT1 = 0
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")
ConvertToYV12(matrix="rec709")
FZ1000HDFinal05()
}
AudioDub(V2,A)
Assumefps(50.00)
Prefetch(2)

But it no longer works. I can get everything else to work including noise reduction, clip enhancement and other filters (included in the FZ1000HDFinal05 function) but not the two pass (Forceprocess). I'm sure this is because it is only written for 32bit.
Is there other any other way to force avisynth to process one part of a script before its starts the next process?

I do not want to have to use two separate scripts to do this process, as I would like to now use Avisynth+ 64bit, if possible.

Hope there is another solution to this.
goorawin is offline   Reply With Quote
Old 15th October 2016, 05:22   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Would that be RT_ForceProcess ?
(Yep only compiled for 32 bit, but you also have to use the correct name ie RT_.)
__________________
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 15th October 2016, 23:59   #3  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
Solved

Thank you StainlessS for your feedback.
Yes I also tried RT_ForceProcess with the same outcome (32Bit).
Because of the difference (64Bit v 32Bit) in processing speed, see below, I decided it was worth while in trying to get Deshaker to work in the 64Bit script as well.
Anyway after some playing around I have been able to do that with the following function.

Function MultiProcess(clip c) {
startFrame=0
endFrame=-1
if (endFrame < startFrame)
{temp = endFrame
endFrame = startFrame
startFrame = temp}
}
This is used in place of the ForceProcess /RT_ForceProcess function.

I don't know if it is the right way to do it or not, but it works very well. However I'm still to do some speed tests using all this in the one script.

The speed tests so far, on a 10 second clip (1920x1080x50P) using the following plugins:
KNLMeansCL
aWarpSharp
Autoadjust
Smoothlevels
SmoothTweak
AddGrainC

Results were : 64Bit = 109 seconds v 32Bit = 168 seconds

I think you would have to agree, that is a big difference and probably worth while chasing.
goorawin is offline   Reply With Quote
Old 16th October 2016, 21:59   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
goorawin,
Code:
Function MultiProcess(clip c) {
    startFrame=0
    endFrame=-1
    if (endFrame < startFrame) {
        temp = endFrame
        endFrame = startFrame
        startFrame = temp
    }
}
Dont know what you think above is doing, clip c is never accessed at all, and all you do is swap over startFrame and endFrame Int's once.

I'de actually forgotten that I'de done a script version of ForceProcess, it would have to be a lot slower than above function that basically dont do
anything useful, dont know why you say "it works very well",

EDIT: Oops, hit the post button instead of Advanced.

Goorawin, can I ask you to in future wrap your code in code tags (Select code, go to Advanced and click the # button).
It's horrible to read unformatted like that.

Anyways, been trying to get a 64bit function working for you, dont know if this will work or not, produces error
Code:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
in dependency walker, but then that might well be expected on a 32 bit XP with 64 bit dll (just guessing).

Here is the dll (~32KB, with full project files for VS2010):- LINK REMOVED

Test script
Code:
Colorbars.Trim(0,-100)

S="""
    RT_DebugF("G_ForceProcess: %d Forcing",current_frame)
    Return Last
"""

ScriptClip(S)

G_ForceProcess(debug=False)     # Can instead remove scriptclip call and set debug=true

return Last
EDIT: Shows results in DebugView
__________________
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; 18th October 2016 at 07:37.
StainlessS is offline   Reply With Quote
Old 17th October 2016, 10:29   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post 1 of 2, (too big, glue them back together)

Goorawin, something I've been playing with a little.

Probably could do with a bit more work and checking for errors.
Is slightly disappointing that DeShaker does not return the vector clips to Avisynth, only seems to work in GUI.
Also, VDub latest and also Shekh's VirtualDub deep color modification / VdFilterMod crash on using Deshaker, and VDMod plays it but then crashes on pause.
Little problem with Deshakeer on AVS in that we get Black video after Force Process, I think it may be doing something which prevents clip closure, so I've
added the same solution as in earlier script versions, ie kill the returned clip by setting it to 0.

Here tis.
EDIT: All args are as per Gunnar Thalin defaults.
Code:
LoadVirtualDubPlugin ("Deshaker.vdf", "deshaker", preroll=0)

FN="F:\V\CabaretUnCropped.avi"
AviSource(FN).ConvertToRGB32.Trim(10000,-500)
DUMMY=ShakeRattleAndRoll()
G_ForceProcess(DUMMY)   ### As Compiled for Goorawin, 64 bit (But I'm using 32 bit version)
#RT_ForceProcess(DUMMY) ### 32 bit (Or ForceProcessAVI from TWriteAVI v2)
DUMMY=0                 ### KILL Clip (Call Destructor, Deshaker seems to hold clip open for a time or something, black video unless kill DUMMY)
ShakeRattleAndRoll(Pass=2)
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 "Debug") {
    myName="ShakeRattleAndRoll: "
    c
    DSVersion = 19    # Fixed by DeShaker.vdf, Need modify if new version of dll
    Pass=Default(Pass,1)
    Assert(Pass==1 || Pass==2, RT_String("%s Pass 1 or 2 Only(%d)",myName,Pass))
    BlockSize=Default(BlockSize,30)
    Assert(BlockSize>=1 && BlockSize<=100, RT_String("%s BlockSize 1 -> 100 Only(%d)",myName,BlockSize))
    DifferentialSearchRange=Default(DifferentialSearchRange,4)
    Assert(DifferentialSearchRange>=1, RT_String("%s 1 < DifferentialSearchRange(%d)",myName,DifferentialSearchRange))
    SourcePixelAspectValue=Float(Default(SourcePixelAspectValue,1.0))
    Assert(0.0 < SourcePixelAspectValue, RT_String("%s 0.0 < SourcePixelAspectValue(%f)",myName,SourcePixelAspectValue))
    SourcePixelAspectSelection=Default(SourcePixelAspectSelection,0)  ### GUI
    Assert(-1 <= SourcePixelAspectSelection && SourcePixelAspectSelection <= 7, RT_String("%s -1 <= SourcePixelAspectSelection <= 7(%d)",
        \ myName,SourcePixelAspectSelection))
    DestinationPixelAspectValue=Float(Default(DestinationPixelAspectValue,1.0))   ### GUI
    Assert(0.0 <= DestinationPixelAspectValue, RT_String("%s 0.0 <= DestinationPixelAspectValue(%f)",myName,DestinationPixelAspectValue))
    DestinationPixelAspectSelection=Default(DestinationPixelAspectSelection,0)
    Assert(-1 <= DestinationPixelAspectSelection && DestinationPixelAspectSelection <= 7,
        \ RT_String("%s -1 <= DestinationPixelAspectSelection <= 7(%d)",myName,DestinationPixelAspectSelection))
    DestinationWidth=Default(DestinationWidth,640)
    Assert(DestinationWidth>=1, RT_String("%s 1 <= DestinationWidth(%d)",myName,DestinationWidth))
    DestinationHeight=Default(DestinationHeight,480)
    Assert(DestinationHeight>=1, RT_String("%s 1 <= DestinationHeight(%d)",myName,DestinationHeight))
    Scale=Default(Scale,1)
    Assert(0 <= Scale, RT_String("%s 0 <= Scale(%d)",myName,Scale))
    UsePixels=Default(UsePixels,2)
    Assert(1 <= UsePixels <=4, RT_String("%s 1 <= 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("%s 0.0 <= DiscardMotionOfXBlocks(%f)",myName,DiscardMotionOfXBlocks))
    VideoOutput=Default(VideoOutput,1)
    Assert(0 <= VideoOutput <=3, RT_String("%s 0 <= VideoOutput <= 3(%d)",myName,VideoOutput))
    EdgeCompensation=Default(EdgeCompensation,0)
    Assert(EdgeCompensation==0||EdgeCompensation==1||EdgeCompensation==3||EdgeCompensation==4||EdgeCompensation==6,
        \ RT_String("%s EdgeCompensation 0,1,3,4 or 6 only(%d)",myName,EdgeCompensation))
    Resampling=Default(Resampling,2)
    Assert(0 <= Resampling <= 2, RT_String("%s 0 <= Resampling <= 2(%d)",myName,Resampling))
    SkipFrameIfLessThanXPercentOfBlocksOk=Float(Default(SkipFrameIfLessThanXPercentOfBlocksOk,8.0))
    Assert(0.0 <= SkipFrameIfLessThanXPercentOfBlocksOk <= 100.0, RT_String("%s 0.0 <= SkipFrameIfLessThanXPercentOfBlocksOk <= 100.0(%f)",
        \ myName,SkipFrameIfLessThanXPercentOfBlocksOk))
    InitialSearchRange=Default(InitialSearchRange,30)
    Assert(1 <= InitialSearchRange <= 99, RT_String("%s 1 <= 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("%s 0.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; 17th October 2016 at 23:57.
StainlessS is offline   Reply With Quote
Old 17th October 2016, 10:30   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
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,0)
    Assert(0 <= IgnorePixelsInside && IgnorePixelsInside <= 1, RT_String("%s 0 <= IgnorePixelsInside <= 1(%d)",myName,IgnorePixelsInside))
    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("%s 0.0 < ExtraZoomFactor(%f)",myName,ExtraZoomFactor))
    MaxCorrectionLimitsHorizontalPanning=Float(Default(MaxCorrectionLimitsHorizontalPanning,15.0))
    Assert(1.0 <= MaxCorrectionLimitsHorizontalPanning, RT_String("%s 1.0 <= MaxCorrectionLimitsHorizontalPanning(%f)",
        \ myName,MaxCorrectionLimitsHorizontalPanning))
    MaxCorrectionLimitsVerticalPanning=Float(Default(MaxCorrectionLimitsVerticalPanning,15.0))
    Assert(1.0 <= MaxCorrectionLimitsVerticalPanning, RT_String("%s 1.0 <= MaxCorrectionLimitsVerticalPanning(%f)",
        \ myName,MaxCorrectionLimitsVerticalPanning))
    MaxCorrectionLimitsRotation=Float(Default(MaxCorrectionLimitsRotation,5.0))
    Assert(1.0 <= MaxCorrectionLimitsRotation, RT_String("%s 1.0 <= MaxCorrectionLimitsRotation(%f)",myName,MaxCorrectionLimitsRotation))
    MaxCorrectionLimitsZoom=Float(Default(MaxCorrectionLimitsZoom,15.0))
    Assert(1.0 <= MaxCorrectionLimitsZoom, RT_String("%s 1.0 <= MaxCorrectionLimitsZoom(%f)",myName,MaxCorrectionLimitsZoom))
    UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled=Default(UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled,False)
    UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled=Default(UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled,False)
    UsePreviousAndFutureFramesToFillInBordersPreviousFrames=Default(UsePreviousAndFutureFramesToFillInBordersPreviousFrames,30)
    Assert(0 <= UsePreviousAndFutureFramesToFillInBordersPreviousFrames,
        \ RT_String("%s 0 <= UsePreviousAndFutureFramesToFillInBordersPreviousFrames(%d)",
        \ myName,UsePreviousAndFutureFramesToFillInBordersPreviousFrames))
    UsePreviousAndFutureFramesToFillInBordersFutureFrames=Default(UsePreviousAndFutureFramesToFillInBordersFutureFrames,30)
    Assert(0 <= UsePreviousAndFutureFramesToFillInBordersFutureFrames,
        \ RT_String("%s 0 <= UsePreviousAndFutureFramesToFillInBordersFutureFrames(%d)",
        \ myName,UsePreviousAndFutureFramesToFillInBordersFutureFrames))
    IgnorePixelsOutside_LetAreaFollowMotion=Default(IgnorePixelsOutside_LetAreaFollowMotion,False)
    DeepAnalysisIfLessThanXPercentOfVectorsAreOk=Default(DeepAnalysisIfLessThanXPercentOfVectorsAreOk,0)
    Assert(0<=DeepAnalysisIfLessThanXPercentOfVectorsAreOk && DeepAnalysisIfLessThanXPercentOfVectorsAreOk<=100,
        \ RT_String("%s 0 <= DeepAnalysisIfLessThanXPercentOfVectorsAreOk <= 100(%d)",myName,DeepAnalysisIfLessThanXPercentOfVectorsAreOk))
    CamcorderHasARollingShutter=Default(CamcorderHasARollingShutter,false)
    GenerateInterlacedProgressiveVideo=Default(GenerateInterlacedProgressiveVideo,false)
    SameDestinationPropertiesAsSource=Default(SameDestinationPropertiesAsSource,true)
    SoftBorders=Default(SoftBorders,false)
    ExtrapolateColorsIntoBorder=Default(ExtrapolateColorsIntoBorder,false)
    SoftBorders_EdgeTransitionWidth=Default(SoftBorders_EdgeTransitionWidth,10)
    Assert(0<=SoftBorders_EdgeTransitionWidth, RT_String("%s 0 <= SoftBorders_EdgeTransitionWidth(%d)",myName,SoftBorders_EdgeTransitionWidth))
    DiscardMotionOfBlocksThatMoveMoreThanXPixels=Float(Default(DiscardMotionOfBlocksThatMoveMoreThanXPixels,1000.0))
    Assert(0.0<SoftBorders_EdgeTransitionWidth, RT_String("%s 0.0 < DiscardMotionOfBlocksThatMoveMoreThanXPixels(%f)",
        \ myName,DiscardMotionOfBlocksThatMoveMoreThanXPixels))
    RememberDiscardedAreasToNextFrame=Default(RememberDiscardedAreasToNextFrame,true)
    RollingShutterAmount=Float(Default(RollingShutterAmount,99.0))  ##### Any Value ???
    DetectRotation=Default(DetectRotation,true)
    DetectZoom=Default(DetectZoom,true)
    DetectScenes_Threshold=Float(Default(DetectScenes_Threshold,20.0))
    Assert(0.0<=DetectScenes_Threshold && DetectScenes_Threshold <= 1000.0, RT_String("%s 0.0 <= DetectScenes_Threshold <= 1000.0(%f)",
        \ myName,DetectScenes_Threshold))
    AdaptiveZoomSmoothness=Float(Default(AdaptiveZoomSmoothness,5000.0))
    Assert(0.0<AdaptiveZoomSmoothness, RT_String("%s 0.0 < DetectScenes_Threshold(%f)",myName,AdaptiveZoomSmoothness))
    AdaptiveZoomAmount=Float(Default(AdaptiveZoomAmount,100.0))     ##### Any Value ???
    DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX=Default(DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX,20)
    Assert(0<=DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX&&DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX<=255,
        \ RT_String("%s0 <= DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX <= 255(%d)",
        \ myName,DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX))
    DetectScenes=Default(DetectScenes,true)
    UseColorMask=Default(UseColorMask,false)
    MaskColorInHexRRGGBB=RT_BitAnd(Default(MaskColorInHexRRGGBB,$FF00FF),$FFFFFF)
    Debug=Default(Debug,True)
    Fmt="%d|%d|%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"
    S=RT_String(Fmt,
        \ DSVersion,Pass,BlockSize,DifferentialSearchRange,
        \ SourcePixelAspectValue,SourcePixelAspectSelection,
        \ DestinationPixelAspectValue,DestinationPixelAspectSelection,
        \ DestinationWidth,DestinationHeight,Scale,UsePixels,
        \ MotionSmoothnessHorizontalPanning,MotionSmoothnessVerticalPanning,MotionSmoothnessRotation,MotionSmoothnessZoom,
        \ DiscardMotionOfXBlocks,VideoOutput,EdgeCompensation,Resampling,
        \ SkipFrameIfLessThanXPercentOfBlocksOk,InitialSearchRange,
        \ DiscardMotionOfBlocksMatchingValueLessThanX,DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,
        \ LogFile,AppendToFile?1:0,
        \ IgnorePixelsOutside?1:0,IgnorePixelsOutsideLeft,IgnorePixelsOutsideRight,IgnorePixelsOutsideTop,IgnorePixelsOutsideBottom,
        \ IgnorePixelsInside,IgnorePixelsInsideLeft,IgnorePixelsInsideRight,IgnorePixelsInsideTop,IgnorePixelsInsideBottom,
        \ VideoTypeInterlaced?1:0,VideoTypeUpperFieldFirst?1:0,
        \ ExtraZoomFactor,MaxCorrectionLimitsHorizontalPanning,MaxCorrectionLimitsVerticalPanning,
        \ MaxCorrectionLimitsRotation,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,
        \ DiscardMotionOfBlocksThatMoveMoreThanXPixels,RememberDiscardedAreasToNextFrame?1:0,
        \ RollingShutterAmount,DetectRotation?1:0,DetectZoom?1:0,DetectScenes_Threshold,
        \ AdaptiveZoomSmoothness,AdaptiveZoomAmount,DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX,
        \ DetectScenes?1:0,UseColorMask?1:0,MaskColorInHexRRGGBB
    \ )

    (Debug) ? RT_DebugF("%s",S,name=myName) : NOP
    (Debug) ? RT_WriteFile("ShakeRattleAndRollDebug.txt","%s",S) : NOP
    Deshaker(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; 17th October 2016 at 10:52.
StainlessS is offline   Reply With Quote
Old 17th October 2016, 12:09   #7  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Stainless, your scripts make me dizzy.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 17th October 2016, 22:48   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Groucho2004 View Post
Stainless, your scripts make me dizzy.
Me Too.

I thought you were gonna say that the 'Black clip' was due to log file not being closed until later (as constructor would not have been called until later). I forgot that I specifically close output AVI in TWriteAVI [EDIT: at end of clip and prior to destructor call] , else similar problem on trying lo load resultant Lossless. I guess I have to make a point of pointing that out in RT_ForceProcess and ForceProcessAVI docs, except when using it with TWriteAVI v2.0. (Also I was very tired when posting above).

I used almost exactly the titles of the various parameters used in Gunnar Thalin Docs for DeShaker ( http://www.guthspot.se/video/deshaker.htm ), near end of web page, named "Script Parameters". I thought it would be easier to figure out what the args were from nearly full description, Also, I hate having to think up names for args ('Fred' and 'Test' being two favorites).
If someone wanted to think up shorter names then copy/paste would achieve it quite quickly, but I dont wanna think up 65 names myself.

Anyway, it would not be the first time that someone said that Deshaker was tricky to use from AviSynth, perhaps posted script would make it easier, not too much trouble I hope to copy/paste arg names from function header and not have to remember or count positions in a weird format string where everything looks nearly the same.

EDIT: VideoOutput, is the arg that should select vector clips, but does not.
Of course, same method could be used to create 'ease of use' stubs for other VDub filters.
__________________
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; 17th October 2016 at 23:59.
StainlessS is offline   Reply With Quote
Old 17th October 2016, 23:29   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Reply to PM by InGoldie, also posted here:

Quote:
Is it possible to stabilize shaky video automatically?
Hi StainlessS,

Also very important to me.

Do you have any idea about the thread in the following link?

http://forum.doom9.org/showthread.ph...53#post1782953

And do you think the following script is an automatic image stabilizer?


function Stabalizer01(clip Clip) {
ConvertToRGB32(clip, matrix="rec709")
SCRIPT1=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")
ForceProcess(SCRIPT1)
SCRIPT1 = 0
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")
ConvertToYV12(matrix="rec709")
FZ1000HDFinal05()
}
Quote:
Everything necessary is in that same thread where you found that script, but only to automate the 2 passes in same script.
You would however have to provide all arguments specific to the clip in question.
I am no expert at deshaking, I just made it possible with provided script, something a little easier to use so that others
that are more expert in using deshaker, could provide additional scripts with maybe some named presets, so that
problems of specific 'types' could be auto fixed. (Leastwise, that was the purpose of my script function).

I have no idea what 'FZ1000HDFinal05()' is or what it does.

I'll also post this reply in that thread, perhaps may prompt someone to have a go.
__________________
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; 17th October 2016 at 23:50.
StainlessS is offline   Reply With Quote
Old 17th October 2016, 23:58   #10  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
Thank you for all the updates and going to so much trouble.
I did send the wrong script, sorry, and the one that I thought worked well was in fact was using the logs from previous test renders I had done, so of no use.

The ShakeRattleAndRoll script loads in the 32Bit version without problems.
However it is using the output from the first pass as the input for the second pass, which means the final output has low contrast and levels and it has the first pass black band at the bottom. The output is stabalized.
Code:
LoadVirtualDubPlugin ("C:\Virtual Dub\plugins32\Deshaker.vdf", "deshaker", preroll=0)

Clip=("E:\Resolve Editing\Tasmania 2016\Raw Video\P2420153.MP4")
V1=FFMS2(Clip)
#V1=LWLibavVideoSource(Clip,format ="YUV420P8")
A=FFAudioSource(Clip)
#A=LWLibavAudioSource(Clip)
AudioDub(V1,A).Trim(0,100).ConvertToRGB32()
#FN="F:\V\CabaretUnCropped.avi"
#AviSource(FN).ConvertToRGB32.Trim(10000,-500)
DUMMY=ShakeRattleAndRoll()
deshaker("19|1|30|4|1|0|1|0|640|480|1|2|-1|-1|-1|-1|4|1|3|2|8|30|300|4|D:\\Deshaker logs\\00157.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|1|1|1|1|0|0|30|30|0|0|1|0|1|1|0|10|1000|1|70|1|1|20|5000|100|20|1|0|ff00ff")
#G_ForceProcess(DUMMY)   ### As Compiled for Goorawin, 64 bit (But I'm using 32 bit version)
RT_ForceProcess(DUMMY) ### 32 bit (Or ForceProcessAVI from TWriteAVI v2)
DUMMY=0                 ### KILL Clip (Call Destructor, Deshaker seems to hold clip open for a time or something, black video unless kill DUMMY)
ShakeRattleAndRoll(Pass=2)
deshaker("19|2|30|4|1|0|1|0|640|480|1|2|-1|-1|-1|-1|4|1|3|2|8|30|300|4|D:\\Deshaker logs\\00157.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|1|1|1|1|0|0|30|30|0|0|1|0|1|1|0|10|1000|1|70|1|1|20|5000|100|20|1|0|ff00ff")
Return Last

In the 64Bit version it will not load RT_String (There is no function named 'RT_String'). Its probably because it still 32Bit.
The other ones that might be an issue are RT_BitAnd, RT_GetFullPathName, RT_StrReplace, RT_DebugF and RT_WriteFile.
Anyway thank you so much for your efforts

In answer to 'is it an automated script' Yes it is.
I have various profiles for deshaker that are applied to clips based on what is required. The FZ1000HDFinal05() contains the plugin I mentioned earlier in the speed test.

I batch encode maybe 200 to 300 clips at a time. It just save me a lot of time and give a very impressive output in the final production.

Because this number of clips does take time and now that Avisynth+ 64Bit seems to be stable and working well, it make sense to use 64Bit to cut rendering time by 30 to 40%.

Last edited by goorawin; 18th October 2016 at 00:00.
goorawin is offline   Reply With Quote
Old 17th October 2016, 23:36   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Here, my notes gleaned from Gunnar Thalin docs, and used in creating script.
It's a bit wide I'm afraid, but have decided not to try to split, so will mess up post a bit.
Code:
Shaky="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"

########################
    ###
    DSVersion                         = 19    # Parm 1, Int, 1 -> 19 (As for dll version) [Both pass 1 and 2 have to be correct version]
    Pass                              = 1     # Parm 2, Int, 1 -> 2  [select Pass number 1 or 2]
    ###
    BlockSize                         = 30    # Parm 3, Int, 1 - 100  [Pass 1]
    DifferentialSearchRange           = 4     # Parm 4, Int, 1 -> ??? [Pass 1]
    SourcePixelAspectValue            = 1.0   # Parm 5, Float, 0.0 < SourcePixelAspectValue [Pass 1 & 2] (1.0 IF SourcePixelAspectSelection == default 0)
    SourcePixelAspectSelection        = 0     # Parm 6, Int, GUI ONLY, Specified via SourcePixelAspectValue. [Pass Not Used, GUI ONLY]
                                              #   -1: A free source pixel aspect value
                                              #   0: Square pixels / HD (1:1) = Value 1.0
                                              #   1: Standard PAL (59:54)     = Value 1.09259
                                              #   2: Standard NTSC (10:11)    = Value 0.909091
                                              #   3: Anamorphic PAL (118:81)  = Value 1.45679
                                              #   4: Anamorphic NTSC (40:33)  = Value 1.21212
                                              #   5: SVCD PAL (59:36)         = Value 1.63889
                                              #   6: SVCD NTSC (15:11)        = Value 1.36364
                                              #   7: HDV 1440x1080 (4:3)      = Value 1.33333
    DestinationPixelAspectValue       = 1.0   # Parm 7, Float, 0.0 < DestinationPixelAspectValue.  [Pass 2] (Only used if SameDestinationPropertiesAsSource is set to 0.)
    DestinationPixelAspectSelection   = 0     # Parm 8, Int, GUI ONLY. Same as Source pixel aspect selection
    DestinationWidth                  = 640   # Parm 9,  Int, 1 -> ???.  [Pass 2] (Only active if parameter SameDestinationPropertiesAsSource = 0.)
    DestinationHeight                 = 480   # Parm 10, Int, 1 -> ???.  [Pass 2] (Only active if parameter SameDestinationPropertiesAsSource = 0.)
    Scale                             = 1     # Parm 11, Int, 0 -> 2. [Pass 1]
                                              #   0: Full
                                              #   1: Half
                                              #   2: Quarter
    UsePixels                         = 2     # Parm 12,int 1 -> 4. [Pass 1]
                                              #   1: All
                                              #   2: Every 4th
                                              #   3: Every 9th
                                              #   4: Every 16th
    MotionSmoothnessHorizontalPanning = 1000  # Parm 13, Int -1 -> ??? [Pass 2]
    MotionSmoothnessVerticalPanning   = 1000  # Parm 14, Int -1 -> ??? [Pass 2]
    MotionSmoothnessRotation          = 1000  # Parm 15, Int -1 -> ??? [Pass 2]
    MotionSmoothnessZoom              = 1000  # Parm 16, Int -1 -> ??? [Pass 2]
    DiscardMotionOfXBlocks            = 4.0   # Parm 17, Float, 0.0 < DiscardMotionOfXBlocks.  [Pass 1] (Discard motion of blocks that move more than X pixels in wrong direction)
    VideoOutput                       = 1     # Parm 18, Int, 0 -> 3 [Pass 1]
                                              #   0: None
                                              #   1: Motion vectors
                                              #   2: Motion vectors, extended 2x
                                              #   3: Motion vectors, extended 5x
    EdgeCompensation                  = 0     # Parm 19, Int, 0, 1, 3, 4, 6.   [Pass 2]
                                              #  0: None
                                              #  1: Adaptive zoom average
                                              #  3: Fixed zoom
                                              #  4: Adaptive zoom average + fixed zoom
                                              #  6: Adaptive zoom full
    Resampling                        = 2     # Parm 20, Int, 0 -> 2. [Pass 2]
                                              #   0: Nearest neighbor
                                              #   1: Bilinear
                                              #   2: Bicubic
    SkipFrameIfLessThanXPercentOfBlocksOk=8.0 # Parm 21, Float,  0.0 -> 100.0. [Pass 1]
    InitialSearchRange                =  30   # Parm 22, Int, 1 -> 99. [Pass 1]
    DiscardMotionOfBlocksMatchingValueLessThanX = 300.0                 # Parm 23, Float, -1000.0 -> 1000.0. [Pass 1]
    DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX = 4.0 # Parm 24, Float, 0.0 -> ???   [Pass 1]
    LogFile                   = depends       # Parm 25, String FilePath. [Pass 1 & 2]
    AppendToFile                      = 0     # Parm 26, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1 & 2]
    IgnorePixelsOutside.              = 0     # Parm 27, Int,  0 -> 1  [Pass 1] (0=No, 1=Yes, Activates the following four parameters if set to 1.)
    IgnorePixelsOutsideLeft           = 0     # Parm 28, Int, Any Value  [Pass 1]
    IgnorePixelsOutsideRight          = 0     # Parm 29, Int, Any Value  [Pass 1]
    IgnorePixelsOutsideTop            = 0     # Parm 30, Int, Any Value  [Pass 1]
    IgnorePixelsOutsideBottom         = 0     # Parm 31, Int, Any Value  [Pass 1]
    IgnorePixelsInside                = 0     # Parm 32, Int,  0 -> 1    [Pass 1] (0=No, 1=Yes, Activates the following four parameters if set to 1.)
    IgnorePixelsInsideLeft            = 0     # Parm 33, Int, Any Value  [Pass 1]
    IgnorePixelsInsideRight           = 0     # Parm 34, Int, Any Value  [Pass 1]
    IgnorePixelsInsideTop             = 0     # Parm 35, Int, Any Value  [Pass 1]
    IgnorePixelsInsideBottom          = 0     # Parm 36, Int, Any Value  [Pass 1]
    VideoTypeInterlaced               = 0     # Parm 37, Int,  0 -> 1 (0=No, 1=Yes) [Pass 1 & 2]
    VideoTypeUpperFieldFirst          = 0     # Parm 38, Int,  0 -> 1 (0=No, 1=Yes), [Pass 1 & 2] (Only used if VideoTypeInterlaced is set to 1)
    ExtraZoomFactor                   = 1.0   # Parm 39, Float,  0.0 < ExtraZoomFactor  [Pass 2]
    MaxCorrectionLimitsHorizontalPanning=15.0 # Parm 40, Float, 1.0 -> ??? [Pass 2]
    MaxCorrectionLimitsVerticalPanning  =15.0 # Parm 41, Float, 1.0 -> ??? [Pass 2]
    MaxCorrectionLimitsRotation         =5.0  # Parm 42, Float, 1.0 -> ??? [Pass 2]
    MaxCorrectionLimitsZoom             =15.0 # Parm 43, Float, 1.0 -> ??? [Pass 2]
    UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled = 0 # Parm 44, Int, 0 -> 1 (0=No, 1=Yes) [Pass 2]
    UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled   = 0 # Parm 45, Int, 0 -> 1 (0=No, 1=Yes) [Pass 2]
    UsePreviousAndFutureFramesToFillInBordersPreviousFrames = 30     # Parm 46, Int, 0 -> ??? [Pass 2]
    UsePreviousAndFutureFramesToFillInBordersFutureFrames   = 30     # Parm 47, Int, 0 -> ??? [Pass 2]
    IgnorePixelsOutside_LetAreaFollowMotion                 = 0      # Parm 48, Int, 0 -> 1 (0=No, 1=Yes)   [Pass 1]
    DeepAnalysisIfLessThanXPercentOfVectorsAreOk            = 0      # Parm 49, Int, 0 -> 100.  [Pass 1] (Only used if Camcorder has a rolling shutter is set to 0.)
    CamcorderHasARollingShutter                             = 0      # Parm 50, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1 & 2]
    GenerateInterlacedProgressiveVideo                      = 0      # Parm 51, Int, 0 -> 1 (0=No, 1=Yes), [Pass=2] (Only valid for interlaced video)
    SameDestinationPropertiesAsSource                       = 1      # Parm 52, Int, 0 -> 1 (0=No, 1=Yes)  [Pass 2]
    SoftBorders                                             = 0      # Parm 53, Int, 0 -> 1 (0=No, 1=Yes)  [Pass 2] (Only valid if using previous and future frames to fill in border.)
    ExtrapolateColorsIntoBorder                             = 0      # Parm 54, Int, 0 -> 1 (0=No, 1=Yes)  [Pass 2]
    SoftBorders_EdgeTransitionWidth                         = 10     # Parm 55, Int, 0 -> ??? (Only valid if using Soft borders.) [Pass 2]
    DiscardMotionOfBlocksThatMoveMoreThanXPixels            = 1000.0 # Parm 56, Float, 0.0 < DiscardMotionOfBlocksThatMoveMoreThanXPixels.  [Pass 1] (absolute motion)
    RememberDiscardedAreasToNextFrame                       = 1      # Parm 57, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1]
    RollingShutterAmount                                    = 88.0   # Parm 58, Float, Any Value. [Pass 1 & 2] (Only used if Camcorder has a rolling shutter is set to 1.)
    DetectRotation                                          = 1      # Parm 59, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1]
    DetectZoom                                              = 1      # Parm 60, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1]
    DetectScenes_Threshold                                  = 20.0   # Parm 61, Float, 0.0 -> 1000.0. [Pass 1] (Only used if Detect scenes is set to 1.)
    AdaptiveZoomSmoothness                                  = 5000.0 # Parm 62, Float, 0.0 < AdaptiveZoomSmoothness. [Pass 2] (Only used if Edge compensation is set to 1, 4 or 6.)
    AdaptiveZoomAmount                                      = 100.0  # Parm 63, Float, Any Value.  [Pass 2] (Only used if Edge compensation is set to 1, 4 or 6.)
    DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX=20 # Parm 64, Int, 0 -> 255. [Pass 1]
    DetectScenes                                            = 1      # Parm 65, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1]
    UseColorMask                                            = 0      # Parm 66, Int, 0 -> 1 (0=No, 1=Yes) [Pass 1 & 2]
    MaskColorInHexRRGGBB                                    = FF00FF # Parm 67, Int, 000000 -> FFFFFF. [Pass 1 & 2] (e.g. black is 0, blue is ff, red is ff0000, grey is 808080)
EDIT: 'Parm' Parameters are 1 relative.
__________________
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; 19th October 2016 at 08:37. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2016, 00:18   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
G, can you confirm whether or not the G_ForceProcess worked ok on 64 bit.
If so I'll try to incorporate the other [EDIT: used] RT_ functions (forgot about 64 bit, was still doing it at about 09:00 this morinng (up all night)).
I will not bother with RT_BitAnd, and shall use v2.6 BitAnd instead.

Here mod of your failing script untested. [EDIT: you used deshaker(...), as well as ShakeRattleAndRoll(), which calls deshaker]
Code:
LoadVirtualDubPlugin ("C:\Virtual Dub\plugins32\Deshaker.vdf", "deshaker", preroll=0)

FN="E:\Resolve Editing\Tasmania 2016\Raw Video\P2420153.MP4"   # FN is a filename, not a clip :)
FFMS2(FN)
A=FFAudioSource(FN)
DUMMY=ShakeRattleAndRoll()  # Using Last as source (easier than assigning to V1)
G_ForceProcess(DUMMY)       # As Compiled for Goorawin, 64 bit (But I'm using 32 bit version)
DUMMY=0                     # KILL Clip (Call Destructor, Deshaker seems to hold clip open for a time or something, black video unless kill DUMMY)
ShakeRattleAndRoll(Pass=2)  # Source is still original Last
AudioDub(A).Trim(0,100).ConvertToRGB32() # Video is result Last from ShakeRattleAndRoll(Pass=2)
Return Last
EDIT: Note, ShakeRattleAndRoll(), uses Deshaker defaults, you would need to supply named arg mods directly to it (ive just used SR&R defaults).
At this point I just want to know if it works, not too bothered about whether default SR&R() args work well for the clip.
__________________
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; 18th October 2016 at 00:34.
StainlessS is offline   Reply With Quote
Old 18th October 2016, 02:15   #13  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
Sorry
Yes, G_ForceProcess loads and seems to work on 64 bit.

Your updated script works correctly on 32Bit. However I had to change G_ForceProcess to RT_ForceProcess for 32Bit

Code:
LoadVirtualDubPlugin ("C:\Virtual Dub\plugins32\Deshaker.vdf", "deshaker", preroll=0)

FN="E:\Resolve Editing\Tasmania 2016\Raw Video\P2420153.MP4"   # FN is a filename, not a clip :)
FFMS2(FN).ConvertToRGB32()
A=FFAudioSource(FN)
DUMMY=ShakeRattleAndRoll()  # Using Last as source (easier than assigning to V1)
RT_ForceProcess(DUMMY)      # As Compiled for Goorawin, 64 bit (But I'm using 32 bit version)
DUMMY=0                     # KILL Clip (Call Destructor, Deshaker seems to hold clip open for a time or something, black video unless kill DUMMY)
ShakeRattleAndRoll(Pass=2)  # Source is still original Last
AudioDub(A).Trim(0,100).ConvertToRGB32() # Video is result Last from ShakeRattleAndRoll(Pass=2)
Return Last
I haven't looked for the deshaker log with your script but it seems to be analyzing the whole clip in the first pass, not just the trimmed part.

I'm sorry to hear that you had no sleep over this. I'm getting to old for that now.
Thanks again
goorawin is offline   Reply With Quote
Old 18th October 2016, 02:31   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Your updated script works correctly on 32Bit. However I had to change G_ForceProcess to RT_ForceProcess for 32Bit
Sorry, keep forgetting I'm using 32bit version of G_ForceProcess.

Quote:
I haven't looked for the deshaker log with your script but it seems to be analyzing the whole clip in the first pass, not just the trimmed part.
Yes of course, you should trim at beginning of script (prior to deshake, and after audiodub, so both are same), I just copied your logic, was untested.

So like so, again untested
Code:
LoadVirtualDubPlugin ("C:\Virtual Dub\plugins32\Deshaker.vdf", "deshaker", preroll=0)

FN="E:\Resolve Editing\Tasmania 2016\Raw Video\P2420153.MP4"   # FN is a filename, not a clip :)
FFMS2(FN).ConvertToRGB32()
A=FFAudioSource(FN)
AudioDub(A).Trim(0,100)

DUMMY=ShakeRattleAndRoll()  # Using Last as source
RT_ForceProcess(DUMMY)      # 
DUMMY=0                     # KILL Clip, allow reopen of log file for pass=2
ShakeRattleAndRoll(Pass=2)  # Source is still original Last
Return Last
I'll update your plug with both 32 and 64 bit versions, + additional RT_ functions but maybe with G_ prefix..

EDIT:
Quote:
I'm getting to old for that now.
Yeh, me too.
__________________
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; 18th October 2016 at 04:53.
StainlessS is offline   Reply With Quote
Old 18th October 2016, 03:57   #15  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
That works really well in 32Bit
goorawin is offline   Reply With Quote
Old 18th October 2016, 03:59   #16  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
By the way I found the log file and its the correct length now
goorawin is offline   Reply With Quote
Old 18th October 2016, 07:41   #17  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post 1 of 3
OK, try this out, DS_Tools (DeShaker Tools) AVS v2.6 only, 32 & 64 bit (~70KB incl full VS10 source + project files):-
http://www.mediafire.com/file/01ui4m...1_20101027.zip
EDIT: Req VS2010 Runtimes.
EDIT: Link updated to v0.01 DS_Tools.

Code:
DS_Tools, 32 and 64 bit, by StainlessS @ Doom9.org. Originally prompted by this thread:- http://forum.doom9.org/showthread.php?t=173953

***
***
***

DS_ForceProcess(clip, Bool "Debug"=True)
  Useful where a clip outputs some kind of file for use in a second filter, this function would in such a case
  forcibly read the clip, and therefore write the file, so that it may be available to other filters or to a second pass of the filter that
  initially wrote the file.
  Debug, default true. Write Progress to DebugView (Google).
  Returns only after completed force reading of video frames (and audio samples if any).
  Returns 0.
  Example, Auto 2 Pass script:-
    LoadVirtualDubPlugin ("Deshaker.vdf", "deshaker", preroll=0)
    FN="F:\Shaky.avi"
    AviSource(FN).ConvertToRGB32.Trim(10000,-500)
    DUMMY=Some2PassFunc(Pass=1)   # A script function that calls Deshaker to produce log file.
    DS_ForceProcess(DUMMY)        # Forcibly read all frames in clip and output deshaker.log.
    DUMMY=0                       # KILL DUMMY clip (Call Deshaker Destructor and close deshaker.log, so that can be reopened for pass 2)
    Some2PassFunc(Pass=2)         # Pass 2 deshaker function.
    Return Last

***
***
***

DS_TimerHP()
    Returns a high precision timer (If available on your system, otherwise uses lower rez timer).
    DS_TimerHP is not defined to return anything in particular, the only thing that is meaningful
    is the difference between returns from 2 calls to DS_TimerHP.
    Usage:
       s=DS_TimerHP()      Test()       e=DS_TimerHP()
       Str=DS_String("Test Start=%.3f End=%.3f Time=%.6f secs",s,e,e-s)
       SubTitle(str)
***
***
***

DS_FilenameSplit(string filename,int "get"=15)
 Splits the un-named filename string into component parts selected by 'get' bit flags arg and returns the
 parts joined together.
 'Get' (default 15, 1 -> 15), If set, Bit 0=DRIVE, 1=Dir, 2=Name, 4=Extension.
 Add 1 for Drive (bit 0), add 2 for Dir (bit 1), add 4 for Name (bit 2), add 8 for Extension (bit 3).
 Some combinations do not make sense, eg Drive + Extension (1+8=9). Below sensible options.
   1  = Drive (includes trailing ':')
   2  = Dir (includes trailing '\')
   3  = Drive + Dir
   4  = Name
   6  = Dir + Name
   7  = Drive + Dir + Name
   8  = Extension (includes leading '.')
   12 = Name + Extension
   14 = Dir + Name + Extension
   15 = Drive + Dir + Name + Extension
 Assuming a current working directory of eg "D:\avs\avi\", 'filename'="test.avi" and 'get'=15, returns "D:\avs\avi\test.avi",
 so given a relative filename and default 'get'=15, is equivalent to DS_GetFullPathName(filename).

***
***
***

DS_GetFullPathName(string "name")
 Creates an absolute or full path name for the specified relative path 'name'.
  eg 'DS_GetFullPathName("test.avs")' might return "D:\avs\test.avs".
 Throws and error if cannot return path.

***
***
***

DS_GetFileExtension(string s)
 Returns filename extension from the supplied filename, including '.' prefix.

***
***
***

DS_StrReplace(string source,string find,string replace,bool "sig"=True) # Based on Algorithm by Vampiredom, Gavino, IanB, & Martin53.
 String args 'source', 'find' and 'replace' unnamed and compulsory.
 Takes a source string, searches for all occurences of find string and replaces the found strings with the replace string.
 Can use "" in replace string (only in replace) to delete the found substrings from the source string.
 Newlines are treated no differently to other characters, and could be replaced/deleted.
 sig arg, default true is Case Significant. Set false for case insignificant find string.

***
***
***

DS_String(String format, dat1,...,datn,int "Esc"=1)

 Returns a formatted string. The unnamed 'format' string and optional unnamed 'dat' args are used to construct the text string that is
 returned, uses C/CPP printf() style formatting.
 Format: compulsory string controlling format and describing the datn type args that are expected.
 datn: Variable number of data args of any type (excluding clip).
 Esc: Default 1, converts embedded escape sequences in format string, 2 convert escape sequences in both format and datn strings,
   0 no escape sequence conversion done.
   It is necessary to specify the "Esc" name if you wish to alter default, as Avisynth cannot tell when the variable number of data datn
   args ends.
   You might wish to turn off escape conversion if you want to send a multi-line string to Subtitle() without conversion of '\n' to Chr(10).

 printf Format spec here:- http://msdn.microsoft.com/en-us/library/56e442dc%28v=vs.71%29.aspx
  NOTE, the only support for printing Bool variables is %s as string, ie prints "True" or "False".
 Formatting supported %[flags] [width] [.precision] type
  flags, one of  "-,+,0, ,#"
  width, integer, "*" supported (width supplied via dat arg).
  Precision, integer, "*" supported (precision supplied via dat arg).
  type,
    "c,C,d,i,o,u,x,X",  Integer type, c,C=character, d,i=signed, o,u,x,X=unsigned (o=octal, x=Hex).
    "e,E,f,g,G",        Floating point type
    "s,S",              String type (also Bool).

  Formatting Insertion point is marked with '%' character in the format string (as in Avisynth String function), if you wish to use
  a percent character within the returned string, it should be inserted twice in the format string ie '%%' will produce a single '%'.
  The data datn arg strings do not require a double '%' character.

  A Backslash character '\' introduces escape sequences, to insert a backslash character itself, you must supply a double
  backslash sequence ie '\\'.
  When 'Esc' is non zero, converts embedded escape character sequences (Case Significant):-
    '\\' Converted to '\'       Single Backslash
    '\n' Converted to Chr(10)   NewLine
    '\r' Converted to Chr(13)   Carriage Return
    '\t' Converted to Chr(9)    Horizontal TAB
    '\v' Converted to Chr(11)   Vertical TAB
    '\f' Converted to Chr(12)   FormFeed
    '\b' Converted to Chr(8)    BackSpace
    '\a' Converted to Chr(7)    Bell
    '\x', where x is ANY OTHER CHARACTER not included above, will be copied verbatim, ie '\x'.

  eg
   DS_String("Hello there %s and %s.\nGoodbye %d.","Fred","Ted",2013)
   would return same as:-   "Hello there Fred and Ted." + Chr(10) + "Goodbye 2013."

  Be aware that when 'Esc'=2, the string is constructed via two passes, the 1st pass inserts the data args into the format string,
  2nd pass converts escape sequences, so the escape sequences could also exist in the datn args. Also, beware of constructing strings
   which when joined together, form an escape sequence.
  Take care when handling filenames with path backslash, suggest using default 'Esc'=1 when data datn strings contain eg Filenames.

***
***
***

DS_DebugF(string format,dat1,...,datn,string "name"="DS_DebugF:",int "TabSz"=4)
 Sends  a formatted string to DebugView Window. The unnamed 'format' string and optional unnamed 'dat' args are used to construct the
 text string that is sent to DebugView, uses C/CPP printf() style formatting.
 Format: compulsory string controlling format and describing the datn type args that are expected.
 datn: Variable number of data args of any type (excluding clip).
 Name, Default "DS_DebugF:". Allows you to change the default name prepended to each line of text output to DebugView Window.
 TabSz, Default 4 (1 ->32). TAB step setting used for Chr(9) tab ('\t')  character.
 To set either Name or TabSz, you must use the named form eg Name="NewName:" or TabSz=8 as Avisynth does not know where the data args
 end.

 printf Format spec here:- http://msdn.microsoft.com/en-us/library/56e442dc%28v=vs.71%29.aspx
  NOTE, the only support for printing Bool variables is %s as string, ie prints "True" or "False".
 Formatting supported %[flags] [width] [.precision] type
  flags, one of  "-,+,0, ,#"
  width, integer, "*" supported (width supplied via dat arg).
  Precision, integer, "*" supported (precision supplied via dat arg).
  type,
    "c,C,d,i,o,u,x,X",  Integer type, c,C=character, d,i=signed, o,u,x,X=unsigned (o=octal, x=Hex).
    "e,E,f,g,G",        Floating point type
    "s,S",              String type (also Bool).

  Formatting Insertion point is marked with '%' character in the format string (as in Avisynth String function), if you wish to use
  a percent character within the output string, it should be inserted twice in the format string ie '%%' will produce a single '%'.
  The data datn arg strings do not require a double '%' character.

  A Backslash character '\' introduces escape sequences, to insert a backslash character itself, you must supply a double
  backslash sequence ie '\\'.
  Converts embedded escape character sequences (Case Significant):-
    '\\' Converted to '\'       Single Backslash
    '\n' Converted to Chr(10)   NewLine
    '\r' [and Chr(13)] Converted to Chr(10)   NewLine
    '\t' [and Chr(9)] Converted to multiple SPACE's. Horizontal TAB (Tab positions relative to name + SPACE [if not ending in SPACE])
    '\x', where x is ANY OTHER CHARACTER not included above, will be copied verbatim, ie '\x'.

  Escape sequences are replaced only when occurring in the format string, if you need escapes in data string then use both DS_String and
  DS_DebugF functions.

  Example:
   DS_DebugF("Hello there %s and %s.\nGoodbye %d.","Fred","Ted",2013)
   would output same as:-   "Hello there Fred and Ted." + Chr(10) + "Goodbye 2013."

***
***
***

DS_WriteFile(String FileName, string format,dat1,...,datn,bool "Append"=False)
 Writes  a formatted string to FileName file. The unnamed 'format' string and optional unnamed 'dat' args are used to construct the
 text string that is written, uses C/CPP printf() style formatting.
 Format: compulsory string controlling format and describing the datn type args that are expected.
 datn: Variable number of data args of any type (excluding clip).
 Append, Default False, optional and MUST be supplied with name (eg Append=True) as we do not know where optional data args end,
 Appends to file if already exists, else opens new FileName.

 printf Format spec here:- http://msdn.microsoft.com/en-us/library/56e442dc%28v=vs.71%29.aspx
  NOTE, the only support for printing Bool variables is %s as string, ie prints "True" or "False".
 Formatting supported %[flags] [width] [.precision] type
  flags, one of  "-,+,0, ,#"
  width, integer, "*" supported (width supplied via dat arg).
  Precision, integer, "*" supported (precision supplied via dat arg).
  type,
    "c,C,d,i,o,u,x,X",  Integer type, c,C=character, d,i=signed, o,u,x,X=unsigned (o=octal, x=Hex).
    "e,E,f,g,G",        Floating point type
    "s,S",              String type (also Bool).

  Formatting Insertion point is marked with '%' character in the format string (as in Avisynth String function), if you wish to use
  a percent character within the output string, it should be inserted twice in the format string ie '%%' will produce a single '%'.
  The data datn arg strings do not require a double '%' character.

  A Backslash character '\' introduces escape sequences, to insert a backslash character itself, you must supply a double
  backslash sequence ie '\\'.
  Converts embedded escape character sequences (Case Significant):-
    '\\' Converted to '\'       Single Backslash
    '\a' Converted to Chr(7)
    '\b' Converted to Chr(8)
    '\t' Converted to Chr(9)
    '\n' Converted to Chr(10)   NewLine
    '\r' [and Chr(13)] Converted to Chr(10)   NewLine
    '\v' Converted to Chr(11)
    '\f' Converted to Chr(12)
    '\x', where x is ANY OTHER CHARACTER not included above, will be copied verbatim, ie '\x'.

  Escape sequences are replaced only when occurring in the format string, if you need escapes in data string then use DS_String.

  Example:
   DS_WriteFile(FileName,"Hello there %s and %s.\nGoodbye %d.","Fred","Ted",2013,Append=False)
EDIT: Added
Code:
DS_Sleep(Float time)
    time in seconds, 0.0 -> 60.0. Silently limited to that range. Accurate to about 0.001 seconds.
    DS_Sleep(0.0) would not sleep for any specific time, it would just give opportunity to any waiting
    tasks to do a bit of processing, before returning to the current task.
__________________
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; 27th October 2016 at 22:08. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2016, 07:45   #18  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post 2 of 3

Req DS_Tools as posted in previous post (no other requirement [EDIT: Except of course VDub DeShaker.vdf by Gunnar Thalin]).

Updated script [EDIT: Stub, As per your original Deshaker string]
Code:
LoadVirtualDubPlugin ("Deshaker.vdf", "deshaker", preroll=0)

FN="F:\V\CabaretUnCropped.avi"
AviSource(FN).ConvertToRGB32.Trim(10000,-500)
#LogFile=DS_FilenameSplit(FN,get=12)+".log"     # 12 = Name.Ext.log (No Dir/Path, In Current script directory)
#LogFile=DS_FilenameSplit(FN,get=4)+".Log"      # 4  = Name.log  (No Dir/Path/Ext, In Current script directory)
LogFile=FN+".Log"                               # FullFilename+.log (in original clip directory if DIR/Path supplied)
GoorawinStub(LogFile=LogFile)                   # By default, Auto two pass
Return Last

###########

Function GoorawinStub(clip c,Int "Pass",String "LogFile",Bool "Auto",Bool "Debug") {
    /*
        EdgeCompensation                    =4     (p19, default 0,    Pass 2, Adaptive zoom average + fixed zoom)
        MaxCorrectionLimitsHorizontalPanning=8.0   (p40, default 15.0, Pass=2,
        MaxCorrectionLimitsVerticalPanning  =8.0   (p41, default 15.0, Pass=2,
        MaxCorrectionLimitsRotation         =3.0   (p42, default 5.0,  Pass=2,
        MaxCorrectionLimitsZoom             =8.0   (p43, default 15.0, Pass=2,
        CamcorderHasARollingShutter         =True  (p50, Default 0,    Pass=1&2 (Func arg Bool)
        RollingShutterAmount                =90.0  (p58, Default 88.0  Pass 1&2
    */
    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)
}


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") {
    /*
        Can set Aspect Ratios directly using eg SourcePixelAspectValue=1.333 or by GUI index SourcePixelAspectSelection[0->7]
    */
    myName="ShakeRattleAndRoll: "
    c
    Assert(IsRGB,DS_string("%sClip Must be RGB",myName))    # Client MUST convert to RGB using whatever matrix and also Interlacing.
    DSVersion = 19                                          # Fixed by DeShaker.vdf, Need modify if new version of dll
    Pass=Default(Pass,1)
    Assert(Pass==1 || Pass==2, DS_String("%s Pass 1 or 2 Only(%d)",myName,Pass))
    BlockSize=Default(BlockSize,30)
    Assert(BlockSize>=1 && BlockSize<=100, DS_String("%s BlockSize 1 -> 100 Only(%d)",myName,BlockSize))
    DifferentialSearchRange=Default(DifferentialSearchRange,4)
    Assert(DifferentialSearchRange>=1, DS_String("%s 1 < 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 && SourcePixelAspectSelection <= 7, DS_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, DS_String("%s 0.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 && DestinationPixelAspectSelection <= 7,
        \ DS_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, DS_String("%s 0.0 <= DestinationPixelAspectValue(%f)",myName,DestinationPixelAspectValue))
    ###
    DestinationWidth  = (SameDestinationPropertiesAsSource) ? Width  : Default(DestinationWidth, 640)
    DestinationHeight = (SameDestinationPropertiesAsSource) ? Height : Default(DestinationHeight,480)
    Assert(DestinationWidth>=1, DS_String("%s 1 <= DestinationWidth(%d)",myName,DestinationWidth))
    Assert(DestinationHeight>=1, DS_String("%s 1 <= DestinationHeight(%d)",myName,DestinationHeight))
    ### End of Source/Dest Same as stuff
    Scale=Default(Scale,1)
    Assert(0 <= Scale, DS_String("%s 0 <= Scale(%d)",myName,Scale))
    UsePixels=Default(UsePixels,2)
    Assert(1 <= UsePixels <=4, DS_String("%s 1 <= UsePixels <= 4(%d)",myName,UsePixels))
    MotionSmoothnessHorizontalPanning=Default(MotionSmoothnessHorizontalPanning,1000)
    Assert(1 <= MotionSmoothnessHorizontalPanning, DS_String("%s 1 <= MotionSmoothnessHorizontalPanning(%d)",
        \ myName,MotionSmoothnessHorizontalPanning))
    MotionSmoothnessVerticalPanning=Default(MotionSmoothnessVerticalPanning,1000)
    Assert(1 <= MotionSmoothnessVerticalPanning, DS_String("%s 1 <= MotionSmoothnessVerticalPanning(%d)",myName,MotionSmoothnessVerticalPanning))
    MotionSmoothnessRotation=Default(MotionSmoothnessRotation,1000)
    Assert(1 <= MotionSmoothnessRotation, DS_String("%s 1 <= MotionSmoothnessRotation(%d)",myName,MotionSmoothnessRotation))
    MotionSmoothnessZoom=Default(MotionSmoothnessZoom,1000)
    Assert(1 <= MotionSmoothnessZoom, DS_String("%s 1 <= MotionSmoothnessZoom(%d)",myName,MotionSmoothnessZoom))
    DiscardMotionOfXBlocks=Float(Default(DiscardMotionOfXBlocks,4.0))
    Assert(0.0 < DiscardMotionOfXBlocks, DS_String("%s 0.0 <= DiscardMotionOfXBlocks(%f)",myName,DiscardMotionOfXBlocks))
    VideoOutput=Default(VideoOutput,1)
    Assert(0 <= VideoOutput <=3, DS_String("%s 0 <= VideoOutput <= 3(%d)",myName,VideoOutput))
    EdgeCompensation=Default(EdgeCompensation,0)
    Assert(EdgeCompensation==0||EdgeCompensation==1||EdgeCompensation==3||EdgeCompensation==4||EdgeCompensation==6,
        \ DS_String("%s EdgeCompensation 0,1,3,4 or 6 only(%d)",myName,EdgeCompensation))
    Resampling=Default(Resampling,2)
    Assert(0 <= Resampling <= 2, DS_String("%s 0 <= Resampling <= 2(%d)",myName,Resampling))
    SkipFrameIfLessThanXPercentOfBlocksOk=Float(Default(SkipFrameIfLessThanXPercentOfBlocksOk,8.0))
    Assert(0.0 <= SkipFrameIfLessThanXPercentOfBlocksOk <= 100.0, DS_String("%s 0.0 <= SkipFrameIfLessThanXPercentOfBlocksOk <= 100.0(%f)",
        \ myName,SkipFrameIfLessThanXPercentOfBlocksOk))
    InitialSearchRange=Default(InitialSearchRange,30)
    Assert(1 <= InitialSearchRange <= 99, DS_String("%s 1 <= InitialSearchRange <= 99(%d)",myName,InitialSearchRange))
    DiscardMotionOfBlocksMatchingValueLessThanX=Float(Default(DiscardMotionOfBlocksMatchingValueLessThanX,300.0))
    Assert(-1000.0 <= DiscardMotionOfBlocksMatchingValueLessThanX <= 1000.0,
        \ DS_String("%s -1000.0 <= DiscardMotionOfBlocksMatchingValueLessThanX <= 1000.0(%f)",
        \ myName,DiscardMotionOfBlocksMatchingValueLessThanX))
    DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX=Float(Default(DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,4.0))
    Assert(0.0 <= DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX,
        \ DS_String("%s 0.0 <= DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX(%f)",
        \ myName,DiscardMotionOfBlocksThatHave2ndBestMatchLargerThanBestMinusX))
    LogFile=Default(LogFile,"ShakeRattleAndRoll.Log")
    Assert(LogFile!="",DS_String("%sLogfile Cannot be Empty string",myName))
    LogFile=DS_GetFullPathName(LogFile)
    Assert(Pass==1||Exist(LogFile),DS_String("%sPass 2 Logfile Does NOT Exist(%s)",myName,LogFile))
    LogFile=DS_StrReplace(LogFile,"\","\\")
    AppendToFile=Default(AppendToFile,False)
Updated, Post #10 NOTES updated
__________________
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; 18th October 2016 at 11:58. Reason: Update AGAIN :(
StainlessS is offline   Reply With Quote
Old 18th October 2016, 07:45   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
post 3 of 3

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, DS_String("%s 0.0 < ExtraZoomFactor(%f)",myName,ExtraZoomFactor))
    MaxCorrectionLimitsHorizontalPanning=Float(Default(MaxCorrectionLimitsHorizontalPanning,15.0))
    Assert(1.0 <= MaxCorrectionLimitsHorizontalPanning, DS_String("%s 1.0 <= MaxCorrectionLimitsHorizontalPanning(%f)",
        \ myName,MaxCorrectionLimitsHorizontalPanning))
    MaxCorrectionLimitsVerticalPanning=Float(Default(MaxCorrectionLimitsVerticalPanning,15.0))
    Assert(1.0 <= MaxCorrectionLimitsVerticalPanning, DS_String("%s 1.0 <= MaxCorrectionLimitsVerticalPanning(%f)",
        \ myName,MaxCorrectionLimitsVerticalPanning))
    MaxCorrectionLimitsRotation=Float(Default(MaxCorrectionLimitsRotation,5.0))
    Assert(1.0 <= MaxCorrectionLimitsRotation, DS_String("%s 1.0 <= MaxCorrectionLimitsRotation(%f)",myName,MaxCorrectionLimitsRotation))
    MaxCorrectionLimitsZoom=Float(Default(MaxCorrectionLimitsZoom,15.0))
    Assert(1.0 <= MaxCorrectionLimitsZoom, DS_String("%s 1.0 <= MaxCorrectionLimitsZoom(%f)",myName,MaxCorrectionLimitsZoom))
    UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled=Default(UsePreviousAndFutureFramesToFillInBordersPreviousFramesEnabled,False)
    UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled=Default(UsePreviousAndFutureFramesToFillInBordersFutureFramesEnabled,False)
    UsePreviousAndFutureFramesToFillInBordersPreviousFrames=Default(UsePreviousAndFutureFramesToFillInBordersPreviousFrames,30)
    Assert(0 <= UsePreviousAndFutureFramesToFillInBordersPreviousFrames,
        \ DS_String("%s 0 <= UsePreviousAndFutureFramesToFillInBordersPreviousFrames(%d)",
        \ myName,UsePreviousAndFutureFramesToFillInBordersPreviousFrames))
    UsePreviousAndFutureFramesToFillInBordersFutureFrames=Default(UsePreviousAndFutureFramesToFillInBordersFutureFrames,30)
    Assert(0 <= UsePreviousAndFutureFramesToFillInBordersFutureFrames,
        \ DS_String("%s 0 <= UsePreviousAndFutureFramesToFillInBordersFutureFrames(%d)",
        \ myName,UsePreviousAndFutureFramesToFillInBordersFutureFrames))
    IgnorePixelsOutside_LetAreaFollowMotion=Default(IgnorePixelsOutside_LetAreaFollowMotion,False)
    DeepAnalysisIfLessThanXPercentOfVectorsAreOk=Default(DeepAnalysisIfLessThanXPercentOfVectorsAreOk,0)
    Assert(0<=DeepAnalysisIfLessThanXPercentOfVectorsAreOk && DeepAnalysisIfLessThanXPercentOfVectorsAreOk<=100,
        \ DS_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, DS_String("%s 0 <= SoftBorders_EdgeTransitionWidth(%d)",myName,SoftBorders_EdgeTransitionWidth))
    DiscardMotionOfBlocksThatMoveMoreThanXPixels=Float(Default(DiscardMotionOfBlocksThatMoveMoreThanXPixels,1000.0))
    Assert(0.0<SoftBorders_EdgeTransitionWidth, DS_String("%s 0.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 && DetectScenes_Threshold <= 1000.0, DS_String("%s 0.0 <= DetectScenes_Threshold <= 1000.0(%f)",
        \ myName,DetectScenes_Threshold))
    AdaptiveZoomSmoothness=Float(Default(AdaptiveZoomSmoothness,5000.0))
    Assert(0.0<AdaptiveZoomSmoothness, DS_String("%s 0.0 < DetectScenes_Threshold(%f)",myName,AdaptiveZoomSmoothness))
    AdaptiveZoomAmount=Float(Default(AdaptiveZoomAmount,100.0))     ##### Any Value ???
    DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX=Default(DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX,20)
    Assert(0<=DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX&&DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX<=255,
        \ DS_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,DS_String("%sCannot use Auto=True if Pass==2",myName))
    Debug=Default(Debug,True)
    #########
    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=DS_String(Fmt1,DSVersion,Pass)
    S2=DS_String(Fmt2,
        \ BlockSize,DifferentialSearchRange,
        \ SourcePixelAspectValue,SourcePixelAspectSelection,
        \ DestinationPixelAspectValue,DestinationPixelAspectSelection,
        \ DestinationWidth,DestinationHeight,Scale,UsePixels,
        \ MotionSmoothnessHorizontalPanning,MotionSmoothnessVerticalPanning,MotionSmoothnessRotation,MotionSmoothnessZoom,
        \ DiscardMotionOfXBlocks,VideoOutput,EdgeCompensation,Resampling,
        \ SkipFrameIfLessThanXPercentOfBlocksOk,InitialSearchRange,
        \ DiscardMotionOfBlocksMatchingValueLessThanX,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,
        \ ExtraZoomFactor,MaxCorrectionLimitsHorizontalPanning,MaxCorrectionLimitsVerticalPanning,
        \ MaxCorrectionLimitsRotation,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,
        \ DiscardMotionOfBlocksThatMoveMoreThanXPixels,RememberDiscardedAreasToNextFrame?1:0,
        \ RollingShutterAmount,DetectRotation?1:0,DetectZoom?1:0,DetectScenes_Threshold,
        \ AdaptiveZoomSmoothness,AdaptiveZoomAmount,DiscardMotionOfBlocksThatHaveMaximumPixelValueDifferenceLessThanX,
        \ DetectScenes?1:0,UseColorMask?1:0,MaskColorInHexRRGGBB
    \ )
    DBUG = FALSE # Used during debugging
    S=S1+S2
    Fn=DS_String("ShakeRattleAndRoll_Debug_%d.txt",Pass)
    (Debug)             ? DS_DebugF("%s",S,name=myName) : NOP
    (Debug&&DBUG)       ? DS_WriteFile(Fn,"%s",S)       : NOP
    Tmp=Deshaker(S)
    (Auto)              ? DS_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)           ? DS_String(Fmt1,DSVersion,2)+S2 : S
    (Auto&&Debug)       ? DS_DebugF("%s",S,name=myName) : NOP
    (Auto&&Debug&&DBUG) ? DS_WriteFile(Fn,"%s",S)       : NOP
    (Auto)              ? Deshaker(S)                   : NOP
    Return Last
}
Updated, post 10 notes updated.
__________________
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; 18th October 2016 at 11:28. Reason: Update AGAIN
StainlessS is offline   Reply With Quote
Old 18th October 2016, 11:23   #20  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 82
Both are now working.
The 64Bit came up with an error at first, but after replacing about four RT_String with DS_String all was well.
Now I have to get my head around an easy way to put in the deshaker preset.
Once I do that I will do some serious testing and see if my prediction of a 30 to 40% gain is achievable.
Anyway thank you so much for all your efforts. It would be great if I could give you something for all your work, just let me know.
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 05:30.


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