Description
I've been trying to make ffmpeg's loudnorm
filter fit into my music processing pipeline via ffmpeg-normalize
(like many people did, as evident by the various issues) but it seems that loudnorm
is not designed for music, where preserving the dynamic range / linearity is more important than achieving the desired loudness metrics. (podcasts, realtime audio, etc.)
I have created a yet another option for making loudnorm
behave linearly in #273 but this is more of a band-aid fix than a true solution, made necessary by loudnorm
not allowing true peaks to be higher than 0 for some stupid reason.
What I propose instead is a very straightforward feature where we get loudness stats from the first loudnorm
pass and just do a linear volume adjustment using ffmpeg's volume
filter.
How does this work?
First of, I'm far from anything close to being an audio expert, but what I've gathered from my web research is that LUFS and dB are closely related metrics such that e.g. a -4dB change in volume will result in -4 LUFS change (approx).
Please inform me if my understanding is incorrect.
So the code is basically this:
- Get
input_i
from first pass. - Calculate necessary volume change:
vol_change = target_level - input_i
. - Generate the filter:
f"volume={vol_change}dB"
@slhck Let me know what do you think about the feature request and whether you are willing to work on this. I might get to it myself (or not depending on how life goes).