Functions Index :: E :: EditTrim

[<< up one level]

Module:

filters :: edit

Definition:

EditTrim(clip base, int fstart, int "fend", int "fcount")

Description:

Returns a portion of a clip. It is intended as a replacement of the Trim standard Avisynth function, providing a more flexible and easier to use behavior.

Arguments:

base: The clip to trim.

fstart: The frame to start trimming from.

Negative values are allowed and specify the offset from the end of the clip (ie -10 means " start from the frame 10 positions before the end of clip").

"fend" (Optional, defaults to base.Framecount): The frame to end trimming. The end frame does not get included in the result ie the function always returns the frame interval [fstart..fend).

Negative values are allowed and specify the offset from the end of the clip (ie -10 means "stop at frame 10 positions before the end of clip").

"fcount" (Optional, defaults to zero): The number of frames to include in the result. Accepts only values >= 0 (when zero a null clip (length=0) is returned).

Notes and conditions on arguments relations:

1] fend and fcount are mutually exclusive. If both are supplied the function throws an error.

2] If both fend and fcount are ommited the function returns all frames from fstart to the end of clip.

3] If after processing negative indices and converting fcount (if supplied) to an equivalent fend value, fstart >= fend the function returns a null clip (length=0).

4] If fend is set to zero the function returns a null clip (length=0), since then the processed fstart will be >= fend (see note above).

Examples:

# load a clip to c and then make it a 200 frames clip

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

# now operate on c; use OOP notation

fc = c.Framecount

# get frames from 20 to 100, number 20-99 (100 is not included)

t0 = c.EditTrim(20, 100)

# get the first frame only

t1 = c.EditTrim(0, 1)

# get the last frame only

t2 = c.EditTrim(-1) # same as c.EditTrim(fc-1, fc)

# get 5 frames from the end, number 195-199

t3 = EditTrim(c, -5)

# get 15 frames starting 5 frames from the end

# actually only 5 frames will be retrieved, number 195-199

t4 = c.EditTrim(-5, fcount=15)

# get frames from 20 before end up to 10 frames before end, number 180-189

t5 = c.EditTrim(-20, -10)

# get 100 frames from -300 before end, number (-100)-(-1)

# since no frame of c is in that range a null clip (length=0) is returned

t6 = c.EditTrim(-300, fcount=100)

# this is also happens if a zero fcount is supplied or fstart==fend

t7 = c.EditTrim(25, fcount=0)

t8 = c.EditTrim(25, 25)

 

[<< top]