view
¶
Visualization utilities for FFmpeg filter graphs.
This module provides functionality to generate visual representations of FFmpeg filter graphs using Graphviz. These visualizations can be useful for understanding complex filter chains, debugging, and documentation purposes.
Functions:
Name | Description |
---|---|
view |
Visualize a filter graph node and its dependencies using Graphviz. |
view
¶
view(
node: Node, format: Literal["png", "svg", "dot"]
) -> str
Visualize a filter graph node and its dependencies using Graphviz.
This function creates a graphical representation of the FFmpeg filter graph starting from the given node. It traverses the entire graph and generates a visual diagram showing all nodes and their connections. The visualization uses different colors to distinguish between input, output, and filter nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
Node
|
The root node to visualize (typically an output node) |
required |
format
|
Literal['png', 'svg', 'dot']
|
The output format for the visualization (png, svg, or dot) |
required |
Returns:
Type | Description |
---|---|
str
|
The path to the rendered graph file |
Raises:
Type | Description |
---|---|
ImportError
|
If the graphviz package is not installed |
Example
# Create a filter graph and visualize it
output = (
ffmpeg.input("input.mp4").filter("scale", 1280, 720).output("output.mp4")
)
graph_path = ffmpeg.utils.view(output, format="png")
print(f"Graph visualization saved to {graph_path}")