[FFmpeg-devel] [PATCH] libavfilter/af_showvolume: A Simple Audio Filter for Extracting Volume Information
stefasab at gmail.com
Tue Dec 23 08:38:54 CET 2014
On date Monday 2014-12-22 16:50:57 +0100, Lars Kiesow encoded:
> 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:
> ./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'
I think a better approach would be to export the average per-frame
volume to the metadata. Then you can use ffprobe to show such values
and process them. Parsing the log is not robust.
Also you could extend one of the existing filters to do that, or
design a new audio filter based on signalstats (it could be
Also, I think ideally we should be able to generate an output showing
as an image directly from ffmpeg (but could be more tricky due to the
undefined length of an audio track).
FFmpeg = Fast & Faithless Mean Powered Enlightening Generator
More information about the ffmpeg-devel