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

James Almer jamrial at gmail.com
Sat Apr 29 17:06:37 EEST 2023


On 4/29/2023 6:41 AM, Anton Khirnov wrote:
> Quoting Nicolas George (2023-04-29 11:11:59)
>> Nicolas George (12023-04-28):
>>> Signed-off-by: Nicolas George <george at nsup.org>
>>> ---
>>>   libavutil/Makefile |   1 +
>>>   libavutil/json.c   | 368 +++++++++++++++++++++++++++++++++++
>>>   libavutil/json.h   | 470 +++++++++++++++++++++++++++++++++++++++++++++
>>>   3 files changed, 839 insertions(+)
>>>   create mode 100644 libavutil/json.c
>>>   create mode 100644 libavutil/json.h
>>
>> I forgot to write: I wrote this code not only because we have half-baked
>> JSON output in multiple places in the code
> 
> As far as I can see, there are exactly two places in the codebase that
> produce JSON: af_loudnorm and ffprobe.
> 
> af_loudnorm:
> * can optionally produce final filter stats as JSON output with av_log()
> * the relevant code has ~25 lines and is unlikely to be simplified by
>    this
> * IMO the filter should not be doing this at all and instead produce some
>    sort of a struct and let the users process it as they wish

It should be exporting frame metadata, like aphasemeter, cropdetect, etc.
av_log() output is not meant to be parseable. It's why the relevant 
output of vf_showinfo can be freely changed, whereas output from things 
like framecrc/framehash muxers is standardized.

> 
> ffprobe:
> * is not one of the libraries, but rather their caller
> * we are not in business of providing random non-multimedia-related
>    services to callers, unless they are useful in our libraries;
>    if this code is only useful in ffprobe then it should live in fftools/
> * it is not at all obvious that switching ffprobe to this code would
>    be an improvement; a patch actually demonstrating this would be most
>    useful
> 


More information about the ffmpeg-devel mailing list