6

Is there a plugin I'm missing that allows me to determine the volume samples over the length of an audio file?

For example, a sample of every second to gain the dB vs timestamp?

1
  • See here, especially the ebur filter.
    – Gyan
    Feb 28, 2017 at 14:55

1 Answer 1

10

The ebur128 filter provides info in terms of the Loudness Recommendation EBU R128 metric.

The astats filter can provide this info, in terms of dBs:

ffmpeg -i in.mp3 -af astats=metadata=1:reset=1,ametadata=print:key=lavfi.astats.Overall.RMS_level:file=log.txt -f null -

This produces an output like this:

frame:221  pts:226304  pts_time:4.71467
lavfi.astats.Overall.RMS_level=-67.437152
frame:222  pts:227328  pts_time:4.736  
lavfi.astats.Overall.RMS_level=-67.159036
frame:223  pts:228352  pts_time:4.75733
lavfi.astats.Overall.RMS_level=-63.862748
frame:224  pts:229376  pts_time:4.77867
lavfi.astats.Overall.RMS_level=-63.666815

If this is too fine-grained in terms of temporal resolution, increase the reset value which is the frame count for the filter's sampling frequency. For a 1-second slice, an integer approximating audio sampling rate/1000 should be used.

11
  • Hi, I'm trying to use this but if I change the reset value to samplingRate/1000, it returns the exact same output. I mean, if I use reset=44 (44100/1000), I have the exact same output. Any suggestion? I'm processing a flac file.
    – JFValdes
    Nov 25, 2020 at 11:05
  • Can't reproduce here. Share the input if you can.
    – Gyan
    Nov 25, 2020 at 11:22
  • ffmpeg -i mywav.wav -af astats=metadata=1:reset=44,ametadata=print:key=lavfi.astats.Overall.RMS_level:file=gains.txt -f null - this is my input. It doesn't matter if the input file is wav or flac or mp3 or wathever.
    – JFValdes
    Nov 25, 2020 at 11:53
  • 2
    -af asetnsamples=44100,astats=metadata=1:reset=1,ametadata=print:key=lavfi.astats.Overall.RMS_level:file=log.txt
    – Gyan
    Nov 25, 2020 at 12:27
  • 1
    For 1-second readouts, yes.
    – Gyan
    Nov 25, 2020 at 13:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .