[FFmpeg-devel] [PATCH 5/8] lavu: add a JSON writer API (WIP)

Anton Khirnov anton at khirnov.net
Sat Apr 29 21:27:32 EEST 2023


Quoting Nicolas George (2023-04-29 19:11:52)
> Anton Khirnov (2023-04-29):
> > As far as I can see, there are exactly two places in the codebase that
> > produce JSON: af_loudnorm and ffprobe.
> 
> I think I remember finding a few other places, but it does not matter
> much.
> 
> Users have been asking¹ for parse-friendly output from filters for years,
> and JSON is often the format they prefer. Therefore, all the filters
> that log useful information are candidates where a JSON writing API is
> useful.

libavfilter is a C library with a C API. Any structured output from
filters should be in the form of a C object, typically a struct. I do
not see why are you so in love with strings, they make for terrible
APIs.

We could conceivably use e.g. the AVOption mechanism to allow automated
serialization of such structs, but the actual mechanism should be left
to the callers.

> (See my answer to James for why “put it in frame metadata” is not a real
> solution.)

I believe frame metadata is a mistake and should not exist, so I am
certainly not suggesting to use it for anything.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list