Effects
Effects modify video frames without changing their count or dimensions.
Usage
from videopython.base import Video, Blur, Zoom
video = Video.from_path("input.mp4")
# Apply blur effect
blur = Blur(mode="constant", iterations=50)
video = blur.apply(video, start=0, stop=2.0)
# Apply zoom effect
zoom = Zoom(zoom_factor=1.5, mode="in")
video = zoom.apply(video)
Effect (Base Class)
Effect
Bases: ABC
Abstract class for effect on frames of video.
The effect must not change the number of frames and the shape of the frames.
Source code in src/videopython/base/effects.py
Blur
Blur
Bases: Effect
Applies Gaussian blur with constant, ascending, or descending intensity.
Source code in src/videopython/base/effects.py
__init__
__init__(
mode: Literal["constant", "ascending", "descending"],
iterations: int,
kernel_size: tuple[int, int] = (5, 5),
)
Initialize blur effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
Literal['constant', 'ascending', 'descending']
|
Blur mode - "constant" (same blur), "ascending" (increasing blur), or "descending" (decreasing blur). |
required |
iterations
|
int
|
Number of blur iterations to apply. |
required |
kernel_size
|
tuple[int, int]
|
Gaussian kernel size for blur operation. |
(5, 5)
|
Source code in src/videopython/base/effects.py
Zoom
Zoom
Bases: Effect
Applies zoom in or out effect by cropping and scaling frames progressively.
Source code in src/videopython/base/effects.py
__init__
Initialize zoom effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zoom_factor
|
float
|
Maximum zoom level, must be greater than 1. |
required |
mode
|
Literal['in', 'out']
|
Zoom direction - "in" for zoom in effect, "out" for zoom out effect. |
required |
Source code in src/videopython/base/effects.py
FullImageOverlay
FullImageOverlay
Bases: Effect
Overlays an image on top of video frames with optional transparency and fade.
Source code in src/videopython/base/effects.py
__init__
Initialize image overlay effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
overlay_image
|
ndarray
|
RGB or RGBA image to overlay, must match video dimensions. |
required |
alpha
|
float | None
|
Overall opacity from 0 (transparent) to 1 (opaque), defaults to 1.0. |
None
|
fade_time
|
float
|
Duration in seconds for fade in/out at start and end. |
0.0
|