[FFmpeg-devel] [PATCH 2/3] fftools/ffmpeg_graphprint: Add options for filtergraph printing
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Feb 21 13:11:06 EET 2025
Soft Works:
>
>
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
>> Andreas Rheinhardt
>> Sent: Freitag, 21. Februar 2025 10:23
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH 2/3] fftools/ffmpeg_graphprint: Add
>> options for filtergraph printing
>>
>> softworkz:
>>> From: softworkz <softworkz at hotmail.com>
>>>
>>> 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
>>>
>>> Note: This commit includes only the default and JSON writers.
>>>
>>> Signed-off-by: softworkz <softworkz at hotmail.com>
>>> ---
>>> fftools/Makefile | 1 +
>>> fftools/ffmpeg.h | 3 +
>>> fftools/ffmpeg_graphprint.c | 1152
>> +++++++++++++++++++++++++++++++++++
>>> fftools/ffmpeg_graphprint.h | 224 +++++++
>>> fftools/ffmpeg_opt.c | 12 +
>>> 5 files changed, 1392 insertions(+)
>>> create mode 100644 fftools/ffmpeg_graphprint.c
>>> create mode 100644 fftools/ffmpeg_graphprint.h
>>>
>>> diff --git a/fftools/Makefile b/fftools/Makefile
>>> index 4499799818..189feb4e2a 100644
>>> --- a/fftools/Makefile
>>> +++ b/fftools/Makefile
>>> @@ -19,6 +19,7 @@ OBJS-ffmpeg += \
>>> fftools/ffmpeg_mux_init.o \
>>> fftools/ffmpeg_opt.o \
>>> fftools/ffmpeg_sched.o \
>>> + fftools/ffmpeg_graphprint.o \
>>> fftools/sync_queue.o \
>>> fftools/thread_queue.o \
>>>
>>> diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
>>> index 6cc0da05a0..432954b4cc 100644
>>> --- a/fftools/ffmpeg.h
>>> +++ b/fftools/ffmpeg.h
>>> @@ -714,6 +714,9 @@ extern float max_error_rate;
>>> extern char *filter_nbthreads;
>>> extern int filter_complex_nbthreads;
>>> extern int vstats_version;
>>> +extern int print_graphs;
>>> +extern char* print_graphs_file;
>>> +extern char* print_graphs_format;
>>> extern int auto_conversion_filters;
>>>
>>> extern const AVIOInterruptCB int_cb;
>>> diff --git a/fftools/ffmpeg_graphprint.c b/fftools/ffmpeg_graphprint.c
>>> new file mode 100644
>>> index 0000000000..77f143b8c2
>>> --- /dev/null
>>> +++ b/fftools/ffmpeg_graphprint.c
>>> @@ -0,0 +1,1152 @@
>>> +/*
>>> + * Copyright (c) 2018 - softworkz
>>> + *
>>> + * This file is part of FFmpeg.
>>> + *
>>> + * FFmpeg is free software; you can redistribute it and/or
>>> + * modify it under the terms of the GNU Lesser General Public
>>> + * License as published by the Free Software Foundation; either
>>> + * version 2.1 of the License, or (at your option) any later version.
>>> + *
>>> + * FFmpeg is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> GNU
>>> + * Lesser General Public License for more details.
>>> + *
>>> + * You should have received a copy of the GNU Lesser General Public
>>> + * License along with FFmpeg; if not, write to the Free Software
>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
>> USA
>>> + */
>>> +
>>> +/**
>>> + * @file
>>> + * output writers for filtergraph details
>>> + */
>>> +
>>> +#include "config.h"
>>> +
>>> +#include <string.h>
>>> +
>>> +#include "ffmpeg_graphprint.h"
>>> +#include "ffmpeg_filter.h"
>>> +
>>> +#include "libavutil/avassert.h"
>>> +#include "libavutil/avstring.h"
>>> +#include "libavutil/opt.h"
>>> +#include "libavutil/pixdesc.h"
>>> +#include "libavutil/dict.h"
>>> +#include "libavutil/intreadwrite.h"
>>> +#include "libavutil/common.h"
>>> +#include "libavfilter/avfilter.h"
>>> +#include "libavfilter/filters.h"
>>
>> That's an internal header which must not be used by fftools.
>
> Thanks Andreas,
>
> I know, but isn't fftools itself "internal"?
fftools is just an ordinary user of the libraries; it is not special in
any way. filters.h is internal to libavfilter and must not be used
anywhere else.
>
> What's the alternative? I could move AVFilterPad to avfilter.h.
> It's prefixed with 'AV', so isn't it meant to be public anyway?
>
> And then there's the hw_frames_ctx does it make sense to
> move it to AVFilterLink? Or rather add a function to access it?
>
More information about the ffmpeg-devel
mailing list