Skip to content

Graph Diagram

When you're chaining several filters together — scaling, overlays, mixing, subtitles — it gets hard to keep the whole pipeline in your head. ffmpeg-studio can render your filter graph as a diagram, so you can see exactly how inputs, filters, and outputs connect before you run the command.

This is especially useful for:

  • Debugging a filter graph that isn't producing the output you expect
  • Understanding someone else's (or your future self's) pipeline
  • Documenting complex, multi-input/multi-output workflows

FFmpeg filter graph diagram generated with ffmpeg-studio

Example

example/graph_diagram.py
from ffmpeg import (FFmpeg, FileInputOptions, InputFile, Map, apply,
                    draw_filter_graph)
from ffmpeg.filters import Overlay, Scale

# Do Filter as usual
ffmpeg = FFmpeg()

# Exmple filter graph
clip = InputFile("video.mp4", FileInputOptions(duration=10))
overlay = InputFile("overlay.png")

upscaled_clip = apply(Scale(1440, 1920), clip)
overlay = apply(Scale(100, 100), overlay)
upscaled_clip = apply(Overlay(overlay, x=0, y=10), clip)


ffmpeg.output(
    Map(upscaled_clip),
    Map(clip.get_stream(stream_name="a", stream_index=1)),
    path="output.mp4",
    vcodec="libx264",
)
# Use This Function for making drawing with graphviz
# You must install graphviz with pip and it is dependencies
draw_filter_graph(ffmpeg, "graph_output")

Running this generates a visual representation of the filter graph: