From: Niklas Haas <ffmpeg@haasn.xyz> To: ffmpeg-devel@ffmpeg.org Cc: Niklas Haas <git@haasn.dev> Subject: [FFmpeg-devel] [PATCH v2 4/4] fftools/ffmpeg_filter: add -dump_filter_graph option Date: Tue, 18 Feb 2025 13:46:03 +0100 Message-ID: <20250218124603.95398-4-ffmpeg@haasn.xyz> (raw) In-Reply-To: <20250218124603.95398-1-ffmpeg@haasn.xyz> From: Niklas Haas <git@haasn.dev> Debugging option to dump the filter graph after insertion of auto-filters. Named such to avoid clashing with the existing -dumpgraph option on lavfi devices. --- doc/ffmpeg.texi | 18 ++++++++++++++++++ fftools/ffmpeg.h | 1 + fftools/ffmpeg_filter.c | 13 +++++++++++++ fftools/ffmpeg_opt.c | 4 ++++ libavfilter/vf_libplacebo.c | 2 +- 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index da6549f043..298c736b47 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -2768,6 +2768,24 @@ filter (scale, aresample) in the graph. On by default, to explicitly disable it you need to specify @code{-noauto_conversion_filters}. +@item -dump_filter_graph +Print out the fully settled filter graph, after all automatic conversion +and format restriction filters have been inserted. Accepts a key/value list of +suboptions to influnce the output. +@table @option +@item format +Choose the output format. Possible values are: + +@table @option +@item none +Don't print anything. +@item pretty +Pretty-print an ASCII art graph. This is the default. +@item complex +Print in a format suitable for consumption by @option{-filter_complex}. +@end table +@end table + @item -bits_per_raw_sample[:@var{stream_specifier}] @var{value} (@emph{output,per-stream}) Declare the number of bits per raw sample in the given output stream to be @var{value}. Note that this option sets the information provided to the diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 6cc0da05a0..d6be3df539 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -715,6 +715,7 @@ extern char *filter_nbthreads; extern int filter_complex_nbthreads; extern int vstats_version; extern int auto_conversion_filters; +extern char *dump_filter_graph; extern const AVIOInterruptCB int_cb; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 800e2a3f06..5aa871c8ad 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -23,6 +23,7 @@ #include "ffmpeg.h" #include "libavfilter/avfilter.h" +#include "libavfilter/filters.h" #include "libavfilter/buffersink.h" #include "libavfilter/buffersrc.h" @@ -1986,6 +1987,18 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt) if ((ret = avfilter_graph_config(fgt->graph, NULL)) < 0) goto fail; + /* Print the generated filter graph after insertion of auto filters */ + if (dump_filter_graph) { + char *graph = avfilter_graph_dump(fgt->graph, dump_filter_graph); + if (graph) + av_log(NULL, AV_LOG_INFO, "%s", graph); + else + av_log(NULL, AV_LOG_ERROR, "Failed dumping filtergraph!\n"); + } + + avfilter_inout_free(&inputs); + avfilter_inout_free(&outputs); + fgp->is_meta = graph_is_meta(fgt->graph); /* limit the lists of allowed formats to the ones selected, to diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 3c0c682594..aa8a6508ab 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -76,6 +76,7 @@ char *filter_nbthreads; int filter_complex_nbthreads = 0; int vstats_version = 2; int auto_conversion_filters = 1; +char *dump_filter_graph; int64_t stats_period = 500000; @@ -1733,6 +1734,9 @@ const OptionDef options[] = { { "auto_conversion_filters", OPT_TYPE_BOOL, OPT_EXPERT, { &auto_conversion_filters }, "enable automatic conversion filters globally" }, + { "dump_filter_graph", OPT_TYPE_STRING, OPT_EXPERT, + { &dump_filter_graph }, + "dump filter graph after insertion of auto-filters" }, { "stats", OPT_TYPE_BOOL, 0, { &print_stats }, "print progress report during encoding", }, diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index e1c6629f6d..20f5c2cf75 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -1288,7 +1288,7 @@ static const AVOption libplacebo_options[] = { { "force_divisible_by", "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used", OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 256, STATIC }, { "normalize_sar", "force SAR normalization to 1:1 by adjusting pos_x/y/w/h", OFFSET(normalize_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, STATIC }, { "pad_crop_ratio", "ratio between padding and cropping when normalizing SAR (0=pad, 1=crop)", OFFSET(pad_crop_ratio), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, 1.0, DYNAMIC }, - { "fillcolor", "Background fill color", OFFSET(fillcolor), AV_OPT_TYPE_STRING, {.str = "black"}, .flags = DYNAMIC }, + { "fillcolor", "Background fill color", OFFSET(fillcolor), AV_OPT_TYPE_STRING, {.str = "black@0.0"}, .flags = DYNAMIC }, { "corner_rounding", "Corner rounding radius", OFFSET(corner_rounding), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, .flags = DYNAMIC }, { "extra_opts", "Pass extra libplacebo-specific options using a :-separated list of key=value pairs", OFFSET(extra_opts), AV_OPT_TYPE_DICT, .flags = DYNAMIC }, -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-02-18 12:46 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-02-18 12:46 [FFmpeg-devel] [PATCH v2 1/4] avfilter/graphdump: implement options parsing Niklas Haas 2025-02-18 12:46 ` [FFmpeg-devel] [PATCH v2 2/4] avfilter/filters: keep track of AVFilterPad labels Niklas Haas 2025-02-18 12:46 ` [FFmpeg-devel] [PATCH v2 3/4] avfilter/graphdump: add complex format Niklas Haas 2025-02-18 12:46 ` Niklas Haas [this message] 2025-02-18 16:43 ` [FFmpeg-devel] [PATCH v2 4/4] fftools/ffmpeg_filter: add -dump_filter_graph option epirat07 2025-02-19 17:36 ` Niklas Haas 2025-02-18 12:50 ` [FFmpeg-devel] [PATCH v2 1/4] avfilter/graphdump: implement options parsing Niklas Haas
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250218124603.95398-4-ffmpeg@haasn.xyz \ --to=ffmpeg@haasn.xyz \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=git@haasn.dev \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git