# Adapted from an example somewhere on the net. LoadPlugin("depanestimate.dll") LoadPlugin("depan.dll") function DupeSequence(clip c, int length) { length == 0 ? Eval(""" return c """) : Eval(""" DuplicateFrame(c, length-1) return DupeSequence(c, length-1) """) } source = ImageSource("frame%02d.jpg", 0, 42).ConvertToYV12() # If you want to have a smaller image, uncomment the following line. # Also, change the height in the following line accordingly. source = source.LanczosResize(1024, 768) frame_height = 768 frame0 = source.Trim(0,-1) frame0translate = 2 # Get the ball rolling by duplicating the first frame with a slight offset. blankedge = BlankClip(length=1, width=frame0translate, height=frame_height, pixel_type="YV12") frame0 = StackHorizontal(blankedge.KillAudio(), frame0.Crop(0,0,-frame0translate,0)) source = source.Trim(0, -1) + frame0 + source.Trim(1, 999) cropped = source.Crop(100,100,-150,-220) mdata = DePanEstimate(source, trust=0.00) stabilised = DePanStabilize\ (\ source,\ data=mdata,\ cutoff = 0.00006,\ damping = 0,\ prev = 0,\ next = 0,\ dxmax = 800,\ rotmax = 15,\ info = false\ ) stabilised.ConvertToRGB24() # Delete the frame that caused the shifting. # This is the returned video. stabilised.Trim(0, -1) + stabilised.Trim(2, 42)