Filters
apply
apply(node, *parent)
Apply a filter input streams.
This function connects the given input nodes (either BaseInput or StreamSpecifier) to a filter node and returns a single output stream from the filter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
BaseFilter
|
The filter node to apply. |
required |
*parent
|
BaseInput | StreamSpecifier
|
Input nodes to connect to the filter. |
()
|
Returns:
Name | Type | Description |
---|---|---|
StreamSpecifier |
StreamSpecifier
|
The resulting single output stream from the filter. |
apply2
apply2(node, *parent)
Apply a filter input streams.
This function connects the given input nodes (either BaseInput or StreamSpecifier) to a filter node and returns a list of all output streams from the filter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
BaseFilter
|
The filter node to apply. |
required |
*parent
|
BaseInput | StreamSpecifier
|
Input nodes to connect to the filter. |
()
|
Returns:
Type | Description |
---|---|
list[StreamSpecifier]
|
list[StreamSpecifier]: A list of output streams from the filter. |
Text
Text(text, y, x, fontsize=16, color='white', fontname='arial.ttf', **kwargs)
Bases: BaseFilter
, TimelineEditingMixin
enable_after
enable_after(t)
Enable the filter only after the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) after which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_before
enable_before(t)
Enable the filter only before the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) before which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_between
enable_between(start, end)
Enable the filter only between the given start and end times.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
float
|
Start time (in seconds). |
required |
end
|
float
|
End time (in seconds). |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
Box
Box(x, y, width, height, color='red', t=5, replace=False)
Bases: BaseFilter
, TimelineEditingMixin
enable_after
enable_after(t)
Enable the filter only after the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) after which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_before
enable_before(t)
Enable the filter only before the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) before which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_between
enable_between(start, end)
Enable the filter only between the given start and end times.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
float
|
Start time (in seconds). |
required |
end
|
float
|
End time (in seconds). |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
XFade
XFade(name, offset=0, duration=1, expression=None)
Bases: BaseFilter
Combine two videos with transition.
Note
Requires same size and fps and aspect ratio.
Overlay
Overlay(overlay_input, x, y)
Bases: BaseFilter
, TimelineEditingMixin
Represents an overlay filter that combines two video streams.
enable_after
enable_after(t)
Enable the filter only after the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) after which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_before
enable_before(t)
Enable the filter only before the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) before which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_between
enable_between(start, end)
Enable the filter only between the given start and end times.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
float
|
Start time (in seconds). |
required |
end
|
float
|
End time (in seconds). |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
SetTimeBase
SetTimeBase(expression='AVTB')
Bases: BaseFilter
, TimelineEditingMixin
enable_after
enable_after(t)
Enable the filter only after the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) after which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_before
enable_before(t)
Enable the filter only before the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) before which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_between
enable_between(start, end)
Enable the filter only between the given start and end times.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
float
|
Start time (in seconds). |
required |
end
|
float
|
End time (in seconds). |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
TimelineEditingMixin
Mixin providing timeline-based activation control for FFmpeg filter graphs.
This mixin allows enabling filters conditionally based on the video timestamp,
using FFmpeg's enable
expression mechanism with between
, gte
, and lte
.
Attributes:
Name | Type | Description |
---|---|---|
flags |
dict
|
Dictionary storing FFmpeg filter options, such as enable expressions. |
enable_after
enable_after(t)
Enable the filter only after the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) after which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_before
enable_before(t)
Enable the filter only before the given timestamp.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Time (in seconds) before which the filter is enabled. |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
enable_between
enable_between(start, end)
Enable the filter only between the given start and end times.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
float
|
Start time (in seconds). |
required |
end
|
float
|
End time (in seconds). |
required |
Returns:
Name | Type | Description |
---|---|---|
TimelineEditingMixin |
The current instance with the updated |
BaseFilter
BaseFilter(filter_name)
Base class for all FFmpeg filters.