From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E15384D1D9 for ; Tue, 18 Feb 2025 12:46:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DDD4568C100; Tue, 18 Feb 2025 14:46:18 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F17E68BE12 for ; Tue, 18 Feb 2025 14:46:08 +0200 (EET) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with ESMTP id DFCC841C5E; Tue, 18 Feb 2025 13:46:07 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Feb 2025 13:46:03 +0100 Message-ID: <20250218124603.95398-4-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250218124603.95398-1-ffmpeg@haasn.xyz> References: <20250218124603.95398-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/4] fftools/ffmpeg_filter: add -dump_filter_graph option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas 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".