[FFmpeg-devel] [PATCH 0/3] print_graphs: Complete Filtergraph Printing

ffmpegagent ffmpegagent at gmail.com
Wed Feb 19 11:59:29 EET 2025


The key benefits are:

 * Different to other graph printing methods, this is outputting:
   * all graphs with runtime state
     (including auto-inserted filters)
   * each graph with its inputs and outputs
   * all filters with their in- and output pads
   * all connections between all input- and output pads
   * for each connection:
     * the runtime-negotiated format and media type
     * the hw context
     * if video hw context, both: hw pixfmt + sw pixfmt
 * Output can either be printed to stdout or written to specified file
 * Output is machine-readable
 * Use the same output implementation as ffprobe, supporting multiple
   formats
   (this commit includes only the default and JSON writers)

Right after filtergraph configuration, the connection details are often not
complete yet. On the other side, when waiting too long or if an error occurs
somewhere, the graph info might never be printed. Experience has shown, that
the most suitable and realiable point in time for printing graph information
is right before cleanup.

Due to the changes for multi-threading, this is no longer doable as easy as
before, so the following method is used: Each filtergraph initiates its own
graph printing short before cleanup into a buffer. Before final cleanup in
ffmpeg.c, the outputs from the individual graphs are pieced together for the
actual output to file or console. (the structure according to the output
format remains valid)

Example output:
https://gist.github.com/softworkz/2a9e8699b288f5d40fa381c2a496e165

softworkz (3):
  fftools/ffmpeg_filter: Move some declaration to new header file
  fftools/ffmpeg_graphprint: Add options for filtergraph printing
  fftools: Enable filtergraph printing and update docs

 doc/ffmpeg.texi             |   10 +
 fftools/Makefile            |    1 +
 fftools/ffmpeg.c            |    4 +
 fftools/ffmpeg.h            |    3 +
 fftools/ffmpeg_filter.c     |  193 +-----
 fftools/ffmpeg_filter.h     |  232 +++++++
 fftools/ffmpeg_graphprint.c | 1152 +++++++++++++++++++++++++++++++++++
 fftools/ffmpeg_graphprint.h |  224 +++++++
 fftools/ffmpeg_opt.c        |   12 +
 9 files changed, 1644 insertions(+), 187 deletions(-)
 create mode 100644 fftools/ffmpeg_filter.h
 create mode 100644 fftools/ffmpeg_graphprint.c
 create mode 100644 fftools/ffmpeg_graphprint.h


base-commit: e18f87ed9f9f61c980420b315dc8ecb308831bc5
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-52%2Fsoftworkz%2Fsubmit_print_graphs5-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-52/softworkz/submit_print_graphs5-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/52
-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list