[FFmpeg-devel] [PATCH] avfilter: add dumpwave filter.

Tobias Rapp t.rapp at noa-archive.com
Tue Jan 8 10:20:21 EET 2019


On 07.01.2019 15:31, Dmitry Humeniuk wrote:
> Signed-off-by: Dmitry Humeniuk <dhumeniuk at google.com>
> ---
>   Changelog                            |    1 +
>   doc/filters.texi                     |   23 +
>   libavfilter/Makefile                 |    1 +
>   libavfilter/af_dumpwave.c            |  234 ++++
>   libavfilter/allfilters.c             |    1 +
>   libavfilter/version.h                |    4 +-
>   tests/fate-run.sh                    |    9 +
>   tests/fate/filter-audio.mak          |   12 +
>   tests/ref/fate/filter-dumpwave       | 1800 ++++++++++++++++++++++++++
>   tests/ref/fate/filter-dumpwave-24bit | 1800 ++++++++++++++++++++++++++
>   tests/ref/fate/filter-dumpwave-fltp  | 1800 ++++++++++++++++++++++++++
>   11 files changed, 5683 insertions(+), 2 deletions(-)
>   create mode 100644 libavfilter/af_dumpwave.c
>   create mode 100644 tests/ref/fate/filter-dumpwave
>   create mode 100644 tests/ref/fate/filter-dumpwave-24bit
>   create mode 100644 tests/ref/fate/filter-dumpwave-fltp
> 
> diff --git a/Changelog b/Changelog
> index f135fa56b6..1eb337796b 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -13,6 +13,7 @@ version <next>:
>   - GIF parser
>   - vividas demuxer
>   - hymt decoder
> +- dumpwave filter
>   
>   
>   version 4.1:
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 98858c5356..66c2961fd8 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -2912,6 +2912,29 @@ Set window length in seconds used to split audio into segments of equal length.
>   Default is 3 seconds.
>   @end table
>   
> + at section dumpwave
> +Dump RMS envelope to a file.
> +Convert samples to decibels and calculates RMS (Root-Mean-Square) audio power in 0 to 1.0 floats.
> +
> + at table @option
> + at item w, width
> +Number of data values.
> +The default value is @var{1800}
> +
> + at item n, nb_samples
> +Samples count per value per channel, default 128
> +
> + at item f, file
> +Path to a file ``-'' is a shorthand
> +for standard output.
> + at end table
> +
> +For example, to generate RMS envelope for 44.1 kHz 6 seconds length audio
> +with dimensions @var{1800x140}, samples count @code{44100*6/1800=147} and store it to @var{/tmp/out.csv}, you might use:
> + at example
> +dumpwave=w=1800:n=147:f=/tmp/out.csv
> + at end example
> +
>   @section dynaudnorm
>   Dynamic Audio Normalizer.
>   
> [...]

I appreciate the completeness of the proposed patch (documentation, 
tests, version bump) but it seems that the functionality overlaps with 
existing filters. Besides the different output format I think the same 
can be achieved by using a command like:

ffmpeg -i input.wav -f null -filter:a 
"asetnsamples=147,astats=metadata=on,ametadata=print:key=lavfi.astats.Overall.RMS_peak:file=/tmp/out.dat" 
/dev/null

So if it is only about the output format, it would be better to add CSV 
support to the ametadata filter, IMHO. That way other filters with frame 
metadata output will also gain CSV support.

Best regards,
Tobias



More information about the ffmpeg-devel mailing list