<p>I have a process sampling <code>mean_volume</code> levels from <code>$ ffmpeg -af 'volumedetect' ...</code> <a href="https://ffmpeg.org/ffmpeg-filters.html#volumedetect" rel="nofollow noreferrer">which outputs</a> negative <code>-##.## dB</code> measurements where 0 dB is very loud and -100 dB is very quiet.  I need to line those measurements up with "common" loudness scales lining up different positive dB levels with noise environments we encounter such as:</p>

<ul>
<li>30 dB = Leaves rustling, soft music, whisper</li>
<li>40 dB = Average home noise</li>
<li>60 dB = Normal conversation, background music</li>
<li>70 dB = Office noise, inside car at 60 mph</li>
<li>75 dB = Vacuum cleaner, average radio</li>
</ul>

<p>How should one go about converting the negative dB measurements from <code>ffmpeg</code> to positive dB values on such scales?</p>

<p>(There are many sources for the "common" loudness scales I refer to here, including built into various smartphone apps for measuring environmental noise and on various web pages such as where I copied <a href="https://myhealth.alberta.ca/Health/Pages/conditions.aspx?hwid=tf4173#targetText=Normal%20conversation%20is%20about%2060,such%20as%20earplugs%20or%20earmuffs." rel="nofollow noreferrer">the sample above from</a>, and they all roughly agree.  I would assume this conversion would require me to do some sort of "calibration" to get measurements from both the <code>ffmpeg</code> output and something on these common scales.  That's something I can do using said apps. Perfect accuracy isn't the goal and isn't required here, just a reasonable rough mapping from the <code>ffmpeg</code> output onto to these common scales.)</p>

CC BY-SA 4.0
2019-07-13T11:53:56.497Z
Try the replaygain filter. See https://sound.stackexchange.com/a/44522
Gyan
CC BY-SA 4.0
2019-07-13T19:43:56.450Z
@Gyan *How* would I use the replaygain filter to do the conversion I'm trying to do?

At any rate, that certainly seems like that's the stackexchange where this question belongs.  I didn't find that one when I was trying to find the best one, I assume because it's beta.  But thanks for the pointer!  Can someone move this question to https://sound.stackexchange.com?
Ross Patterson
CC BY-SA 4.0
2019-07-14T04:37:05.363Z
The filter output prints out the gain required to achieve 89 dB. So `89 - gain_value` is the measured loudness.
Gyan
CC BY-SA 4.0
2019-07-30T17:54:32.337Z
Thanks, @Gyan!  That seems to be working well.
Ross Patterson
CC BY-SA 4.0
2019-07-30T17:55:11.143Z
Oh, if you want to write that up as an answer, I'll call this answered, @Gyan.
Ross Patterson
<ffmpeg><audio><loudness>
Convert ffmpeg audio volumedetect negative dB levels to common loudness positive dB levls
Ross Patterson
# Convert ffmpeg audio volumedetect negative dB levels to common loudness positive dB levls

(Asked by: username_0 on 2019-07-13)

I have a process sampling `mean_volume` levels from `$ ffmpeg -af 'volumedetect' ...` [which outputs](https://ffmpeg.org/ffmpeg-filters.html#volumedetect) negative `-##.## dB` measurements where 0 dB is very loud and -100 dB is very quiet. I need to line those measurements up with "common" loudness scales lining up different positive dB levels with noise environments we encounter such as:

* 30 dB = Leaves rustling, soft music, whisper
* 40 dB = Average home noise
* 60 dB = Normal conversation, background music
* 70 dB = Office noise, inside car at 60 mph
* 75 dB = Vacuum cleaner, average radio

How should one go about converting the negative dB measurements from `ffmpeg` to positive dB values on such scales?

(There are many sources for the "common" loudness scales I refer to here, including built into various smartphone apps for measuring environmental noise and on various web pages such as where I copied [the sample above from](https://myhealth.alberta.ca/Health/Pages/conditions.aspx?hwid=tf4173#targetText=Normal%20conversation%20is%20about%2060,such%20as%20earplugs%20or%20earmuffs.), and they all roughly agree. I would assume this conversion would require me to do some sort of "calibration" to get measurements from both the `ffmpeg` output and something on these common scales. That's something I can do using said apps. Perfect accuracy isn't the goal and isn't required here, just a reasonable rough mapping from the `ffmpeg` output onto to these common scales.)

**Tags:** ffmpeg, audio, loudness

> **Comments:**
> **username_1**: Try the replaygain filter. See https://sound.stackexchange.com/a/44522  
> **username_0**: @username_1 *How* would I use the replaygain filter to do the conversion I'm trying to do?  At any rate, that certainly seems like that's the stackexchange where this question belongs.  I didn't find that one when I was trying to find the best one, I assume because it's beta.  But thanks for the pointer!  Can someone move this question to https://sound.stackexchange.com?  
> **username_1**: The filter output prints out the gain required to achieve 89 dB. So `89 - gain_value` is the measured loudness.  
> **username_0**: Thanks, @username_1!  That seems to be working well.  
> **username_0**: Oh, if you want to write that up as an answer, I'll call this answered, @username_1.  

---

## 0 answers

