## Banzai-v0.3 by mf ## ## Frame replacement functions for manual overrides ## RWPrev: replaces current frame with previous ## RWNext: replaces current frame with next ## RWCouple: replaces two consecutive frames with their outside neighbours ## RWCustom: replaces current frame with a specified frame ## RWClip: replaces current frame or frame range with the same framenumbers from a different clip ## CRW*: Chroma-only versions of the above ## Remove: removes a range of frames from the clip ## ## Dependancies: jdl-util.avsi by stickboy - http://www.avisynth.org/stickboy/ ## ## Caution: process audio separately. function RWNext(clip clip, int frame) { clip.DeleteFrame(frame).DuplicateFrame(frame) } function RWPrev(clip clip, int frame) { clip.DeleteFrame(frame).DuplicateFrame(frame-1) } function RWCustom(clip clip, int frame, int repframe) { clip.Trim(0, frame-1) before = last clip.Trim(frame+1, 0) after = last clip.Trim(repframe, repframe) replace = last before+replace+after } function RWCouple(clip clip, int frame) { clip.RWPrev(frame) RWNext(frame+1) } # RWClip, modified version of JDL_ApplyRange # Replace parts of a clip with another version # by mf (roarr) Import("jdl-util.avsi") function RWClip(clip c, clip replacement, int start, int "end") { end = Default(end, start) Assert(start >= 0 && start < c.FrameCount(), "RWClip("+String(start)+", "+String(end)+"): start frame out of bounds") Assert(end >= start && end < c.FrameCount(), "RWClip("+String(start)+", "+String(end)+"): invalid end frame") c seg1 = c.Trim2(0, start) seg2 = replacement.Trim2(start, end + 1) seg3 = c.Trim2(end + 1) return seg1 + seg2 + seg3 } function Remove(clip c, int start, int end) { Assert(start < c.FrameCount(), "Remove("+String(start)+", "+String(end)+"): start frame out of bounds") Assert(end >= start && end < c.FrameCount(), "Remove("+String(start)+", "+String(end)+"): invalid end frame") c seg1 = (start!=0) ? c.Trim2(0, start) : c seg2 = c.Trim2(end + 1) return (start!=0) ? seg1 + seg2 : seg2 } function CRWNext(clip clip, int frame) { MergeChroma(clip, RWNext(clip, frame)) } function CRWPrev(clip clip, int frame) { MergeChroma(clip, RWPrev(clip, frame)) } function CRWCustom(clip clip, int frame, int repframe) { MergeChroma(clip, RWCustom(clip, frame, repframe)) } function CRWCouple(clip clip, int frame) { MergeChroma(clip, RWCouple(clip, frame)) } function CRWClip(clip c, clip replacement, int start, int "end") { end = Default(end, start) MergeChroma(clip, RWClip(c, replacement, start, end)) } function DeleteFrameRange(clip src, int a, int b) { Trim(src,0,a-1) ++ Trim(src,b+1,0) }