slhck / ffmpeg-normalize

Audio Normalization for Python/ffmpeg
MIT License
1.26k stars 117 forks source link

Keep original loudness range unchanged, EBU R 128 does not specify a default 7 #269

Open wyup opened 1 day ago

wyup commented 1 day ago

According to command help and wiki examples, default loudness range for ffmpeg-normalize for EBU R 128 normalization is 7. However, a default LRA is not specified by EBU R128, only that Program Loudness Level target is −23.0 LUFS, and -1 db True Peak, as specified: https://tech.ebu.ch/files/live/sites/tech/files/shared/r/r128.pdf Minimum requirements for authentic programmes range from values 5 for a narrow loudness range (commercial/promo) to wide loudness range of 15 (movie/drama), as specified here: https://tech.ebu.ch/files/live/sites/tech/files/shared/tech/tech3342.pdf

A default LRA of 7 is arguably a compressed loudness range. Given that ffmpeg-normalized is used for a unspecified content that can be movies which need a high dynamic range, in order to get a target EBU R 128 normalized volume, IMHO LRA should be left untouched by default.

slhck commented 1 day ago

While I understand your argumentation, ffmpeg itself uses a default of 7, and this is why the same default is set here.

Asking the user to specify a range explicitly for every command would also be very confusing.

If there were a set of recommended parameters, I could imagine adding certain presets (e.g. music, dialog, movie,...) that set these values automatically.

wyup commented 1 day ago

I see. And an option to keep the source range? After all, EBU R 128 is mainly volume normalization, not so much compression. The user should provide a custom range, if needed. Otherwise, the user would find compression not wished for.

slhck commented 1 day ago

The issue is that ffmpeg's loudnorm filter should also work in a single pass, for which you won't have an input loudness range calculated. Perhaps it would have been a better choice to make the loudness range target a mandatory setting, but this would have kind of forced a two-pass approach onto users. I guess the original author just picked something that was meaningful for them.

An option to keep the loudness range target is already implemented in ffmpeg-normalize! It's --keep-loudness-range-target. This will set the LRA to the input's LRA and override the default of 7 LUFS:

https://github.com/slhck/ffmpeg-normalize/blob/7edfe8ccf5c89c49f25fe3f99ad2ebc70ea47b9e/ffmpeg_normalize/_streams.py#L460-L473

PS: So far, I have not received feedback about the loudnorm filter being too aggressive by default. There is no ticket in FFmpeg about it either. I assume that most users don't care, and those who do will already set their target value per their needs.

That being said, I am still thinking about whether presets would make sense as a more user-friendly set of options. But I have limited experience with what works and what is recommended in various industries.