factory
¶
Factory functions for creating FFmpeg filter nodes.
This module provides factory functions that create filter nodes based on FFmpeg filter definitions. These factories handle the evaluation of automatic parameters and the conversion of input/output typing specifications.
Functions:
Name | Description |
---|---|
eval_formula |
Evaluate a formula string with the given parameters. |
filter_node_factory |
Create a FilterNode from an FFmpeg filter definition. |
eval_formula
¶
eval_formula(
formula: str, **kwargs: Any
) -> list[StreamType]
Evaluate a formula string with the given parameters.
This function evaluates a formula string using the provided parameters. It supports basic arithmetic operations and conditional logic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
formula
|
str
|
The formula string to evaluate |
required |
**kwargs
|
Any
|
Additional keyword arguments to pass to the formula |
{}
|
Returns:
Type | Description |
---|---|
list[StreamType]
|
The result of the formula evaluation |
filter_node_factory
¶
filter_node_factory(
ffmpeg_filter_def: FFMpegFilterDef,
*inputs: FilterableStream,
**kwargs: Any
) -> FilterNode
Create a FilterNode from an FFmpeg filter definition.
This function creates a FilterNode based on the provided FFmpeg filter definition. It handles the evaluation of Auto parameters and the conversion of input/output typing specifications from the filter definition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ffmpeg_filter_def
|
FFMpegFilterDef
|
The FFmpeg filter definition to create a node from |
required |
*inputs
|
FilterableStream
|
The input streams to connect to the filter |
()
|
**kwargs
|
Any
|
Filter-specific parameters as keyword arguments |
{}
|
Returns:
Type | Description |
---|---|
FilterNode
|
A FilterNode configured according to the filter definition |
Note
This function is primarily used internally by the filter generation system to create filter nodes from the FFmpeg filter definitions.