Overview
VideoClip is the primary class for loading and processing standard video files. It’s optimized for videos without transparency, loading frames in BGR format.
For videos with alpha channel (transparency), use
AlphaVideoClip instead. Note that AlphaVideoClip has a performance penalty (~33% more memory per frame) due to the additional alpha channel.src/movielite/video/video_clip.py:14
Constructor
Path to the video file. Supported formats:
.mp4, .mov, .avi, .mkv, .webm, .webp, .gifStart time in the composition timeline (seconds)
Duration to use from the video. If
None, uses the full video durationStart offset within the video file (seconds). Use this to skip the first N seconds of the video
Raises
ValueError: If the file format is not supportedFileNotFoundError: If the video file doesn’t existRuntimeError: If unable to read video metadata
Example
Properties
fps
src/movielite/video/video_clip.py:197
audio
AudioClip associated with this video
Example:
src/movielite/video/video_clip.py:202
Inherited Properties
Properties inherited from MediaClip and GraphicClip
Properties inherited from MediaClip and GraphicClip
From MediaClip:
start(float): Start time in the compositionduration(float): Duration in the timeline (accounts for speed)end(float): End time in the compositionspeed(float): Playback speed multiplier
size(Tuple[int, int]): Video dimensions (width, height)position(Callable): Position function or static tupleopacity(Callable): Opacity function or static valuescale(Callable): Scale function or static value
Methods
subclip
Start time within this clip (seconds, relative to clip start)
End time within this clip (seconds, relative to clip start)
New VideoClip instance representing the extracted portion
ValueError: If the range is invalid (start < 0, end > duration, or start >= end)
src/movielite/video/video_clip.py:137
set_start
Start time in seconds (must be >= 0)
Self for method chaining
src/movielite/video/video_clip.py:219
set_duration
Duration in seconds (must be > 0)
Self for method chaining
src/movielite/video/video_clip.py:234
set_offset
Offset in seconds (where to start reading from the file)
Self for method chaining
src/movielite/video/video_clip.py:249
set_end
End time in seconds (must be > start)
Self for method chaining
src/movielite/video/video_clip.py:264
set_speed
Speed multiplier (must be > 0)
1.0= normal speed2.0= twice as fast0.5= half speed (slow motion)
Self for method chaining
src/movielite/video/video_clip.py:280
loop
Whether to enable looping
Self for method chaining
src/movielite/video/video_clip.py:298
set_position
Either a static tuple
(x, y) or a function that takes time and returns (x, y)Self for method chaining
src/movielite/core/graphic_clip.py:44
set_opacity
Either a float (0.0-1.0) or a function that takes time and returns opacity
Self for method chaining
src/movielite/core/graphic_clip.py:57
set_scale
Either a float or a function that takes time and returns scale multiplier
Self for method chaining
src/movielite/core/graphic_clip.py:70
set_rotation
Rotation angle (static or animated). Positive values rotate counter-clockwise
Unit of the angle:
"deg" (degrees) or "rad" (radians)Resampling filter:
"nearest", "bilinear", or "bicubic"If True, expands canvas to fit rotated content without clipping
Center of rotation as (x, y) in pixels. If None, uses frame center
Post-rotation translation as (dx, dy) in pixels
Background color for areas outside rotated frame
Self for method chaining
src/movielite/core/graphic_clip.py:83
set_size
Target width in pixels
Target height in pixels
Self for method chaining
The resize is applied lazily (only when needed during rendering). At least one dimension must be provided.
src/movielite/core/graphic_clip.py:134
set_mask
A GraphicClip to use as mask (lighter pixels = more visible)
Self for method chaining
src/movielite/core/graphic_clip.py:169
add_effect
A visual effect instance from
movielite.vfxSelf for method chaining
src/movielite/core/graphic_clip.py:256
add_transition
The clip to transition to/from
A transition effect instance from
movielite.vtxSelf for method chaining
src/movielite/core/graphic_clip.py:273
add_transform
Function that takes (frame, time) and returns transformed frame (BGR/BGRA uint8)
Self for method chaining
src/movielite/core/graphic_clip.py:225
close
src/movielite/video/video_clip.py:126
Complete Example
See Also
AlphaVideoClip- For videos with transparencyAudioClip- For audio manipulationVideoWriter- For rendering videos