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

Bg audio too loud and speech too quiet #6563

Closed
ghost opened this issue Mar 16, 2019 · 14 comments
Closed

Bg audio too loud and speech too quiet #6563

ghost opened this issue Mar 16, 2019 · 14 comments

Comments

@ghost
Copy link

ghost commented Mar 16, 2019

mpv version and platform

Most recent version

Reproduction steps

Expected behavior

To play video with bg sound same volume as speech

Actual behavior

Bg sound is overwhelmingly loud compared to speech.

Log file

Sample files

Does anyone know how to normalize audio on mpv, it's really annoying having to turn down the volume everytime there are explosions and turning it up when they speak.

@Akemi
Copy link
Member

Akemi commented Mar 16, 2019

just search the issue tracker (#3979). there are various ways with the help of ffmpeg filters. some examples that might still work.

af=drc=2
af=lavfi=[dynaudnorm=g=5:f=250:r=0.9:p=0.5]
af=lavfi=[loudnorm=I=-16:TP=-3:LRA=4]

@Akemi Akemi closed this as completed Mar 16, 2019
@ghost
Copy link
Author

ghost commented Mar 16, 2019

The first one just disabled my audio completely, the second one works but I think third one sounds best. Thank you so much.

@bedrin
Copy link

bedrin commented Sep 8, 2021

This one causes dropped frames for me (output)

af=lavfi=[loudnorm=I=-16:TP=-3:LRA=4]

This one works great:

af=lavfi=[dynaudnorm=g=5:f=250:r=0.9:p=0.5]

@tomjaguarpaw
Copy link

None of the above worked for me, but via #6343 (comment) I found a SuperUser question which introduced the FFMpeg pan filter. Playing around, the following seems OK for me:

mpv '-af=pan="stereo|FL=0.707*FC+0.3*FL+0.1*BL+0.1*LFE|FR=0.707*FC+0.3*FR+0.1*BR+0.1*LFE"' <filename>

@flipflop133
Copy link

I think this should better fit your needs.

@tomjaguarpaw
Copy link

tomjaguarpaw commented Jan 16, 2022

Thanks, but the first thing I tried was --audio-channels=stereo, with and without --ad-lavc-downmix=yes, and it didn't seem to have any effect.

@flipflop133
Copy link

What does the log says when you run mpv from the terminal? It should say something like this if it works:
AO: [pulse] 192000Hz stereo 2ch float

@tomjaguarpaw
Copy link

Yes it does say that, but the result in the audio is indistinguishable from when I omit --audio-channels=stereo (in which case the output says AO: [pulse] 48000Hz 5.1(side) 6ch float). In both cases the speech/dialogue is drowned out by the background noise/music. On the other hand, with

-af=pan="stereo|FL=0.707*FC+0.3*FL+0.1*BL+0.1*LFE|FR=0.707*FC+0.3*FR+0.1*BR+0.1*LFE"

or even, for 1980s mono recording, something as stark as

-af=pan="stereo|FL=1*FC|FR=1*FC"

the speech/dialogue comes across very clearly over the background noise/music.

@flipflop133
Copy link

flipflop133 commented Jan 16, 2022

Maybe you should open another issue if you think that --audio-channels=stereo isn't working.
Also, one thing you can try that really helps with inaudible voices is this setting:
af=lavfi=[loudnorm=I=-16] (equivalent to --af=lavfi="loudnorm=I=-16")

@cheater
Copy link

cheater commented Jan 16, 2022

@flipflop133 this issue already exists, see #6343

@flipflop133
Copy link

flipflop133 commented Jan 16, 2022

What about this note in FFmpeg documentation about the pan filter:

Note that ffmpeg integrates a default down-mix (and up-mix) system that should be preferred (see "-ac" option) unless you have very specific needs.

Isn't the -ac option the same as --audio-channels=stereo?
EDIT: the superuser thread mentioned above seems to mention that the -ac 2 option is the same as pan=stereo|FL < 1.0*FL + 0.707*FC + 0.707*BL|FR < 1.0*FR + 0.707*FC + 0.707*BR

@cheater
Copy link

cheater commented Jan 17, 2022

@flipflop133 this needs to work with mpv as well, not just ffmpeg.

@wolph
Copy link

wolph commented Jan 6, 2023

Perhaps a useful addition for some, if you put the following lines in your input.conf, you can use the F1 and F2 keys to toggle the filters:

F1 af toggle "lavfi=[loudnorm=I=-16]"
F2 af toggle 'pan="stereo|FL=0.707*FC+0.3*FL+0.1*BL+0.1*LFE|FR=0.707*FC+0.3*FR+0.1*BR+0.1*LFE"'

@mzakomorny
Copy link

Perhaps a useful addition for some, if you put the following lines in your input.conf, you can use the F1 and F2 keys to toggle the filters:

F1 af toggle "lavfi=[loudnorm=I=-16]"
F2 af toggle 'pan="stereo|FL=0.707*FC+0.3*FL+0.1*BL+0.1*LFE|FR=0.707*FC+0.3*FR+0.1*BR+0.1*LFE"'

Make sure to use escape characters for the quotes on the second line, otherwise mpv says "Changing filters failed!". The following works:

F2 af toggle "pan=\"stereo|FL=0.707*FC+0.3*FL+0.1*BL+0.1*LFE|FR=0.707*FC+0.3*FR+0.1*BR+0.1*LFE\""

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

7 participants