[FFmpeg-devel] [PATCH] libavfilter/af_showvolume: A Simple Audio Filter for Extracting Volume Information

wm4 nfxjfg at googlemail.com
Mon Dec 22 22:54:28 CET 2014


On Mon, 22 Dec 2014 16:50:57 +0100
Lars Kiesow <lkiesow at uos.de> wrote:

> Hi everyone,
> I'm an FFmpeg user for quite a while now and though I might as well
> switch to dev at some point...
> 
> Please find attached to this mail a simple audio filter which makes it
> possible to extract and print volume information from audio streams. It
> works more or less like the showinfo filters only that it returns the
> pcm value information for each audio sample.
> 
> This output can then be used to easily plot a waveform image like this:
>   http://larskiesow.de/waveform.png
> 
> 
> Example:
> ./ffmpeg -nostats -i ... -filter:a aresample=100,showvolume -f null -
>   [...]
>   [Parsed_showvolume_1 @ 0x1bcc300] n: 0, channel: 0, volume: -239
>   [Parsed_showvolume_1 @ 0x1bcc300] n: 1, channel: 0, volume: 126
>   [Parsed_showvolume_1 @ 0x1bcc300] n: 2, channel: 0, volume: -74
>   [Parsed_showvolume_1 @ 0x1bcc300] n: 3, channel: 0, volume: 29
>   [...]
> 
> Example (Generate waveform using gnuplot):
> ./ffmpeg -nostats -i ... -ac 1 -filter:a aresample=100,showvolume \
>   -f null - 2>&1 | grep '^\[Parsed_showvolume_1' | \
>   gnuplot -p -e 'plot "-" using 9 with lines'
> 
> 
> The code can be found at
> https://github.com/lkiesow/FFmpeg/tree/libavfilter-audio-showvolume
> and is also attached to this mail split into three separate patches.
> 
> The first patch contains the filter itself, the necessary changes to
> allfilters.c and the build files. The second patch contains the
> documentation. Finally, the third patch contains a small script added
> to the tools section utilizing the showvolume filter for generating
> waveform images with gnuplot.
> 
> Please let me know if you think it makes sense to add this code to
> ffmpeg and/or if anything is still missing.
> 
> Regards,
> Lars

So it just dumps each sample to the terminal?

Wouldn't it be better to let gnu plot or whatever directly read data
from a raw file (which the raw encoder/muxer could produce)?


More information about the ffmpeg-devel mailing list