y5gfunc.filter.temporal¶
temporal
¶
Functions:
| Name | Description |
|---|---|
temporal_stabilize |
Temporally stabilizes a processed video clip using motion compensation based on a reference clip. |
reduce_fliker |
|
temporal_stabilize
¶
temporal_stabilize(processed_clip: VideoNode, ref_clip: VideoNode, delta: int = 3, pel: int = 1, retain: float = 0.6) -> VideoNode
Temporally stabilizes a processed video clip using motion compensation based on a reference clip.
This function aims to reduce temporal inconsistencies (like flickering or unsteadiness) in the processed_clip by referencing a reference_clip.
It calculates the difference between reference_clip and processed_clip, stabilizes this difference using motion vectors derived from processed_clip,
and then applies the stabilized difference back onto reference_clip.
A common use case is when processed_clip is the result of filtering applied to reference_clip, and that filtering
introduced temporal instability. This function attempts to apply a temporally consistent version of the filter's effect.
The core stabilization logic uses motion vector analysis on processed_clip and motion compensation on the difference clip.
A limiting step ensures the stabilized difference doesn't deviate too drastically from the original difference, controlled by the retain parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
VideoNode
|
The input video clip that likely contains temporal instabilities. |
required |
|
VideoNode
|
The reference video clip, the original source before the processing that introduced instability. |
required |
|
int
|
Temporal radius for temporal stabilize (1-6). This value corresponds to the |
3
|
|
int
|
Subpixel accuracy for motion estimation passed to |
1
|
|
float
|
Weight for merging the limited stabilized difference with the full stabilized difference. A value of 1.0 means only the full stabilized difference is used, while 0.0 means only the limited difference (closer to the original difference) is used. It controls the strength of the stabilization effect versus preserving the original difference characteristics. Range [0.0, 1.0]. |
0.6
|
Returns:
| Type | Description |
|---|---|
VideoNode
|
A new video clip, ideally resembling |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ValueError
|
if |
ValueError
|
If |
Source code in y5gfunc/filter/temporal.py
reduce_fliker
¶
reduce_fliker(clip: VideoNode, tr: int = 5)