[FFmpeg-devel] [PATCH] filters/metadata: add CSV output support

Werner Robitza werner.robitza at gmail.com
Thu Feb 25 13:43:50 EET 2021


On Thu, Feb 25, 2021 at 11:25 AM Nicolas George <george at nsup.org> wrote:
>
> Werner Robitza (12021-02-25):
> > If you are referring to:
> >
> > -vf your_filter,metadata=mode=print
> >
> > That does not work in ffprobe.
>
> Of course, since ffprobe does the printing for you.

At the risk of repeating the same question, could you please show a
command with ffprobe that achieves the same kind of parsable output
that this patch generates?

After fiddling around a bit, when I run:

ffprobe -loglevel error -f lavfi -i "testsrc,signalstats"
-show_entries tags -of csv=nk=0 | head -n 1

I get a line like:

packet,tag:lavfi.signalstats.YMIN=16,tag:lavfi.signalstats.YLOW=16,…

which is not semantically meaningful, since both keys and values are
contained in the individual cells. This makes parsing incredibly more
complex than it has to be.

> > For instance, using the patch I submitted, I can get easy to parse output like:
>
> Parsing the standard output of any program is bad design and bound to
> break at some point.

That was just an example on the CLI. The filter has a file option with
which you can output to a well-formatted CSV file, so parsing is not
an issue there.

> Also, I wonder why you chose CSV, which is one of the worse possible
> formats.

I feel this is only tangential to the discussion, but: It's
well-defined, easy to parse by numerous libraries, can be modified
easily, and is a de-facto standard for sharing data in certain
communities (. It wouldn't even occur to me why you'd want another
format for certain kinds of applications. In particular with data that
isn't nested, it's much easier to use in data analysis procedures than
JSON or others.


More information about the ffmpeg-devel mailing list