jiixyj / libebur128

A library implementing the EBU R128 loudness standard.
MIT License
395 stars 76 forks source link

Very low loudness values #120

Open Rohit-Khali opened 2 years ago

Rohit-Khali commented 2 years ago

Hi,

For a specific audio stream, I am getting very low values for momentary(M) and short term loudness(S). Even with FFMPEG values are very low but seems consistent.

Is this something expected?

Example: libebur128: M(-1576.563004 LUFS) S(-1045.551367 LUFS) FFMPEG: M:-163.5 S:-172.3 _* I do compare loudness values with -HUGEVAL and if 'true', assigns -80. Maybe I should treat all these low values as -80 only.

aud-loudness ffmpeg.txt aud-loudness libebur128.txt

Thanks in advance!

Rohit Khali

jiixyj commented 2 years ago

This is expected behavior of the low pass filter. If the current filter state is non-zero (i.e. if you fed it some audio) it will take a bit of time for the filter state to be "all zero" again when you feed it with silence.

jiixyj commented 2 years ago

I guess the different values between ffmpeg and libebur128 can be explained by some internal thresholds or different data types used for the calculations.

Rohit-Khali commented 2 years ago

Thanks for the response. I am bit curious here. What is the the minimum possible loudness value just before -INF? Just want to be sure that -1576.563004 LUFS is a legitimate loudness value.

jiixyj commented 2 years ago

What is the the minimum possible loudness value just before -INF?

Should be around DBL_MIN I think (so not a subnormal number because those are flushed to zero).

Rohit-Khali commented 2 years ago

Thanks, I was in impression that min loudness just before -INF will depend upon the audio sample size/type. Something like 20*log10(1/(2^31-1))=-186.638597308.

jiixyj commented 2 years ago

It all depends on the implementation of the filter. libebur128 uses a IIR filter, so its output, when fed silence, will approach zero like you are observing. It will only become zero when the output reaches the subnormal numbers, at which point the output is flushed to zero.