# MotionThresh by mf # Simple scenechange-proof motion threshold # Tile outputs 16x16 clip for speed # Use tile=true for conditional filtering, tile=false for masking function MotionThresh(clip input, float thresh, bool "tile") { tile = Default(tile, false) black = BlankClip(input, width=16, height=16) white = BlankClip(input, width=16, height=16, color=$FFFFFF) cond1 = ConditionalFilter(input, white, black, "YDifferenceFromPrevious()", "greaterthan", String(thresh)) cond2 = ConditionalFilter(input, white, black, "YDifferenceToNext()", "greaterthan", String(thresh)) Overlay(cond1, cond2, mode="darken") tile ? last : PointResize(input.width, input.height) } # MotionRamp by mf # Average motion soft-thresholding based on 5 thresholds # Dependancies: MotionThresh, BlendMulti function MotionRamp(clip input, int thresh1, int thresh2, int thresh3, int thresh4, int thresh5, int "min", int "max", int "floor", int "ceil", int "radius", bool "tile") { min = Default(min, 0) max = Default(max, 255) floor = Default(floor, 0) ceil = Default(ceil, 255) radius = Default(radius, 2) tile = Default(tile, false) input BlendMulti(MotionThresh(thresh1, tile=true), MotionThresh(thresh2, tile=true), MotionThresh(thresh3, tile=true), MotionThresh(thresh4, tile=true), MotionThresh(thresh5, tile=true)) TemporalSoften(radius,255,0,255,2) Levels(floor, 1, ceil, min, max) ColorYUV(levels="TV->PC") tile ? last : PointResize(input.width, input.height) }