On 18 Feb 2025, at 13:46, Niklas Haas wrote:

> From: Niklas Haas <g...@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 },

Seems this is a leftover from your other patch that accidentally got in here.

>      { "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-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to