Trim

Trim (clip, int first_frame, int last_frame [, bool pad_audio])

Trim trims a video clip so that it includes only the frames first_frame through last_frame. The audio is similarly trimmed so that it stays synchronized. If you pass 0 for last_frame it means "end of clip." A negative value of last_frame returns the frames from first_frame to first_frame + (- last_frame-1). This is the only way to get the very first frame!

pad_audio (default true) causes the audio stream to be padded to align with the video stream. Otherwise the tail of a short audio stream is left so. When last_frame=0 and pad_audio=false the end of the two streams remains independent.

Trim(100,0)         # delete the first 100 frames, audio padded
                    # or trimmed to match the video length.
Trim(100,0,false)   # delete the first 100 frames of audio and video,
                    # the resulting stream lengths remain independent.
Trim(100,-100)      # is the same as trim(100,199)
Trim(100,199,false) # audio will be trimmed if longer but not
                    # padded if shorter to frame 199
Trim(0,-1)          # returns only the first frame

Changelog:

v2.56 added pad audio

$Date: 2008/10/26 14:18:27 $