Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Reduce Loud Sounds (aka Night Mode, aka Reduce Full Range Audio, etc..) #1492

Open
pradorocchi opened this issue Feb 15, 2018 · 9 comments

Comments

@pradorocchi
Copy link
Contributor

Hi,
A lot of people watch movies at night, some newer device players like AppleTV have this "Reduce Loud Sounds" option for night play, today we depend on 3d party apps on Mac to have this kind of adjust (eg: Boom, where they call it 'night mode' [but it´s not a good calibration])..

So I thought it could be a good feature to have it on iina and I implemented [a very well calibrated] 'night feature' (still hardcoded on a local branch for testing) using iina's ffmpeg audio filters.

Although it´s possible to do it via Custom Audio Filter, it requires a very complex filter parametrization to meet quality standardization (i'm following ITU guidelines for 'momentary', 'short term', 'integrated' and 'peak' audio values) so I decided this could be a "ready to use" practical option for the user (instead of building a custom filter)

My feature is still hardcoded and I´m working now on the UI to add it as an option, here is a screenshot of it as of now.

audio_dynnorm

My questions:
Are there any guidelines to follow for adding such kind of feature?
Are there any guidelines/rules about changing the UI to add such feature? (My reference is being the video deinterlace UI option style)
Is it a nice feature for iina and for others? :)

Waiting for your comments.
Regards,
Prado

@atomicsaiko
Copy link

What is the algorithm here? Since you mentioned terms which made me think about the EBU R128 loudness norm.

For me simply sliding down the volume would solve the problem. But I suppose that 'Reduce Loud Sounds' option simply is trying to reduce the dynamic range which is relatively high for movie soundtracks so loud peaks are toned down while the soft whispers like vocals can use a little boost.

@berengerzyla
Copy link

Would love to see that in IINA. In the meantime, could you share your audio filter? Is it a FFmpeg filter?
Thanks in advance!

@atomicsaiko
Copy link

atomicsaiko commented Dec 31, 2018

@jerkstore369
The audio dynamic range in movies is generally much larger due to artistic choices. It is purposely mixed in a way to be played back on large speakers in combination with certain room accoustics (Cinema comes to mind). Unfortunately, this doesn't apply for watching a movie in your own living room. Sometimes, a more compressed audio stream as in less dynamic range is provided for the above mentioned case.

@berengerzyla
You could try inserting the loudnorm or dynaudnorm FFmpeg filter. Again it is no magic and it might alter the sound perception in such way it doesn't convey the original intent by the producer. But that is a price to pay for more consistent loudness perception for the various low/mid/high tones.

However inserting the filter in IINA is quite difficult in Audio -> Audio Filters... In the FFmpeg commandline I would insert the filter like this.

# Take first detected uncompressed audio stream from decoder
-af loudnorm=i=-23

# Select specific audio stream index from source container
-filter_complex [0:1]af loudnorm=i=-23[aout0] -map "[aout0]"

IINA immediately tries to add lavfi (Libavfilter input virtual device). At this stage, I am not even sure whether the Audio Filters GUI in IINA actually works. Maybe one of the IINA developers can show us how to insert FFmpeg filters within IINA.

@Therapist1911
Copy link

All digital releases of movies should have less dynamic audio, for sure.

@IntricateD
Copy link

Oh man! I wish this was a feature. Im watching event horizon right now and hating the dynamism. Any updates on this?

@ekstasis
Copy link
Contributor

I was just going to see how far I could get trying to use some FFmpeg filter for this. But Rafael Prado seems to have done some very valuable work on this, but I think it is not available publicly. @pradorocchi -- do you mind sharing what you've done so far? I would love to see it, and help if I can.

I implemented [a very well calibrated] 'night feature' (still hardcoded on a local branch for testing) using iina's ffmpeg audio filters.

Prado

@ekstasis
Copy link
Contributor

ekstasis commented Mar 8, 2020

The filter "dynaudnorm" does everything I need with its default setting. It intelligently keeps the volume fairly level.

As @atomicsaiko mentioned, dealing with audio filters is a bit sketchy in iina.

The current releases, 1.0.6 and 1.0.7 beta both have (different) bugs that make the following impossible -- but this should work in 1.0.7 whenever it comes out.

Here's how to create and save a filter (dynaudnorm with default settings) that can be toggled on and off:

  1. Open Audio Filters... from the Audio Menu (Cmd-shft-G)
  2. Hit the "+" at the bottom left of the top pane, which is a list of active filters
  3. Click Custom (mpv). ffmpeg works too, I believe.
  4. Type "dynaudnorm" into the "Filter name" field*
  5. Leave "Filter value" blank for default settings**
  6. Hit Add button
  7. Hit save
  8. Give it a "name" (should prob. be referred to as a "label"), e.g., "Loudness Norm (default settings)" or "dynaudnorm (defaults)"

Now, it should be in the top pane, meaning it's audible/active, as well as in the bottom pane, which is a list of saved filters. These filters can be toggled, which inserts/removes them from the active filters list above.

https://ffmpeg.org/ffmpeg-filters.html#dynaudnorm
https://muldersoft.com/docs/dyauno_readme.html#how-it-works

*I have noticed the name and value fields change position, maybe not in this particular window, but be aware.
**Filter value should prob. be thought of as "filter parameters". "f=250", "s=15", for example, might help if you need more "effect". "f=250:s=15" is the syntax for setting multiple parameters (I think??).

@thomasrene
Copy link

thomasrene commented Apr 21, 2020

@ekstasis's dynaudnorm guidelines somehow worked for me with 1.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@berengerzyla @thomasrene @ekstasis @pradorocchi @Therapist1911 @IntricateD @atomicsaiko and others