Functions Index :: E :: EditReplace

[<< up one level]


filters :: edit


EditReplace(clip base, clip inclip, int frame, int "ins_frames", int "rep_frames", int "op", string "extra_info")


Replaces a specified number of frames of a base clip with a specified number of frames of an insert clip, starting at a specified frame position. The operation is the sum of a "Trim" and an "Insert" and thus the resulting clip may have different length from base clip.


base: The clip to replace frames from.

inclip: The clip to insert frames of (ie the clip that contains the replacement frames).

frame: The frame-number to start replacing from (the frame corresponding to this number is excluded from the resulting clip).

The value of frame is clamp-ed between zero and base.Framecount. Thus, values <= 0 result in replacement starting from the start of base clip and values >= base.Framecount in addition of inclip (trimmed to ins_frames length) to the end of base.

"ins_frames" (Optional, defaults to inclip.Framecount): The number of frames to insert from inclip (always starting from the begining of it).

The value of ins_frames is always clamp-ed between zero and inclip.Framecount.

Specifying zero for this argument is the same as ommiting it.

"rep_frames" (Optional, defaults to processed value of ins_frames): The number of base clip frames to replace.

The value of rep_frames is always clamp-ed between zero and Max(0, base.Framecount - frame), ie maximum available frames after frame. Thus, if the replacement is requested near the end of base clip, the replaced frames may be less than ins_frames.

Specifying zero for this argument is the same as ommiting it.

"op" (Optional): The operation to perform for joining the resulting clip parts after trimming the initial clips.

Accepts one of the EDOP_xxx constants, defined at the filters::edit module. If not supplied, defaults to EDOP_ADD, ie join with UnallignedSplice(), the "+" clip operator.

"extra_info" (Optional, defaults to ""): Additional information to pass when the op argument is one of EDOP_DISS (join with Dissolve()) or EDOP_USER (join with a user-supplied function).

In the first case it must be a string representation of an integer, which has the same meaning as the overlap argument in the Dissolve() standard Avisynth function.

In the second case it must be the name of the user-supplied function.


# load a clip to c and d and then make them 200 frames long

c = AVISource( ... ).EditTrim(0, 200)

d = AVISource( ... ).EditTrim(0, 200)

# now operate on c; use OOP notation

# replace 90 frames starting from 0 with 10 frames of d (-80 decrease, 120 total)

r1 = c.EditReplace(d, 0, 10, 90)

# replace 50 frames starting from 100 with 50 frames from d (same length, 200 total)

r2 = c.EditReplace(d, 100, 50)

# replace all frames to the end starting from 120 with entire d (+120 increase, 320 total)

r3 = c.EditReplace(d, 120)


[<< top]