[FFmpeg-devel] [PATCH v1 1/2] fftools: add global option to dump filter graph to stderr
Limin Wang
lance.lmwang at gmail.com
Thu Nov 21 13:28:02 EET 2019
On Thu, Nov 21, 2019 at 10:49:28AM +0100, Carl Eugen Hoyos wrote:
> Am Mi., 20. Nov. 2019 um 16:03 Uhr schrieb <lance.lmwang at gmail.com>:
> >
> > From: Limin Wang <lance.lmwang at gmail.com>
> >
> > It's useful for debugging filter graph purposes, now only lavfi can do that.
> >
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> > doc/ffmpeg.texi | 4 ++++
> > fftools/ffmpeg.h | 1 +
> > fftools/ffmpeg_filter.c | 7 +++++++
> > fftools/ffmpeg_opt.c | 3 +++
> > 4 files changed, 15 insertions(+)
> >
> > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> > index 9cccc2337d..7e55f67898 100644
> > --- a/doc/ffmpeg.texi
> > +++ b/doc/ffmpeg.texi
> > @@ -668,6 +668,10 @@ Defines how many threads are used to process a filter pipeline. Each pipeline
> > will produce a thread pool with this many threads available for parallel processing.
> > The default is the number of available CPUs.
> >
> > + at item -filter_dumpgraph (@emph{global})
> > +Dump filter graph to stderr. It is off by default, the option is mostly useful
> > +for debugging filter graph purposes
> > +
> > @item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream})
> > Specify the preset for matching stream(s).
> >
> > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
> > index 7b6f802082..b3133e7e99 100644
> > --- a/fftools/ffmpeg.h
> > +++ b/fftools/ffmpeg.h
> > @@ -608,6 +608,7 @@ extern float max_error_rate;
> > extern char *videotoolbox_pixfmt;
> >
> > extern int filter_nbthreads;
> > +extern int filter_dumpgraph;
> > extern int filter_complex_nbthreads;
> > extern int vstats_version;
> >
> > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
> > index 72838de1e2..35ba3a38db 100644
> > --- a/fftools/ffmpeg_filter.c
> > +++ b/fftools/ffmpeg_filter.c
> > @@ -1109,6 +1109,13 @@ int configure_filtergraph(FilterGraph *fg)
> > if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
> > goto fail;
> >
> > + if (filter_dumpgraph) {
> > + char *dump = avfilter_graph_dump(fg->graph, NULL);
> > + fputs(dump, stderr);
> > + fflush(stderr);
> > + av_free(dump);
> > + }
> > +
> > /* limit the lists of allowed formats to the ones selected, to
> > * make sure they stay the same if the filtergraph is reconfigured later */
> > for (i = 0; i < fg->nb_outputs; i++) {
> > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> > index 71063cc443..44eb890e86 100644
> > --- a/fftools/ffmpeg_opt.c
> > +++ b/fftools/ffmpeg_opt.c
> > @@ -110,6 +110,7 @@ int frame_bits_per_raw_sample = 0;
> > float max_error_rate = 2.0/3;
> > int filter_nbthreads = 0;
> > int filter_complex_nbthreads = 0;
> > +int filter_dumpgraph = 0;
> > int vstats_version = 2;
> >
> >
> > @@ -3523,6 +3524,8 @@ const OptionDef options[] = {
> > "create a complex filtergraph", "graph_description" },
> > { "filter_complex_threads", HAS_ARG | OPT_INT, { &filter_complex_nbthreads },
> > "number of threads for -filter_complex" },
> > + { "filter_dumpgraph", OPT_BOOL, { &filter_dumpgraph },
> > + "dump filter graph to stderr" },
>
> dump_filtergraph ?
Carl, thanks for the feedback, I'm ok with your recomment name and will
update it if no further comments next time.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list