clip ¶
Functions:
-
shift_clip
–Shift a clip forwards or backwards by N frames.
-
shift_clip_multi
–Shift a clip forwards or backwards multiple times by a varying amount of frames.
shift_clip ¶
shift_clip(clip: VideoNodeT, offset: int) -> VideoNodeT
Shift a clip forwards or backwards by N frames.
This is useful for cases where you must compare every frame of a clip with the frame that comes before or after the current frame, like for example when performing temporal operations.
Both positive and negative integers are allowed. Positive values will shift a clip forward, negative will shift a clip backward.
Parameters:
-
clip
¶VideoNodeT
) –Input clip.
-
offset
¶int
) –Number of frames to offset the clip with. Negative values are allowed. Positive values will shift a clip forward, negative will shift a clip backward.
Returns:
-
VideoNodeT
–Clip that has been shifted forwards or backwards by N frames.
Source code in vstools/functions/clip.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
shift_clip_multi ¶
shift_clip_multi(
clip: VideoNodeT, offsets: StrictRange = (-1, 1)
) -> list[VideoNodeT]
Shift a clip forwards or backwards multiple times by a varying amount of frames.
This will return a clip for every shifting operation performed. This is a convenience function that makes handling multiple shifts easier.
Example:
>>> shift_clip_multi(clip, (-3, 3))
[VideoNode, VideoNode, VideoNode, VideoNode, VideoNode, VideoNode, VideoNode]
-3 -2 -1 0 +1 +2 +3
Parameters:
-
clip
¶VideoNodeT
) –Input clip.
-
offsets
¶StrictRange
, default:(-1, 1)
) –Tuple of offsets representing an inclusive range. A clip will be returned for every offset. Default: (-1, 1).
Returns:
-
list[VideoNodeT]
–A list of clips, the amount determined by the amount of offsets.
Source code in vstools/functions/clip.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|