[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: normalize audio in mp4s



	Hi.

On Wed, Mar 11, 2020 at 01:51:26PM -0500, David Wright wrote:
> > Personally I just reencode audio in such cases.
> > For instance (0:1 is the first audio track, use 0:2 for english):
> > 
> > ffmpeg -i ford-v-ferrari-2019.mkv -map 0:0 -map 0:1 \
> > 	-c:v copy \
> > 	-c:a libopus -b:a 128k -ac 2 -clev 1.414 -slev .5 \
> > 	ford-v-ferrari-2019.good_audio.mkv
> 
> That's a useful little recipe, and pleased the OP, but can you just
> clarify the arguments   -clev 1.414 -slev .5

Sure. First things first - [1].
clev stands for center_mix_level, slev for surround_mix_level.
Both values are dB.


> I get the impression that for resampling, the number should be in
> dB, whereas for downmixing (-center_mixlev and -surround_mixlev),
> they're scale factors, which is what yours look like).

Nope. It's just a clever hack, originally borrowed from [2] (I'm unsure
if the link is still valid).
What ffmpeg does by default then downmixing is:

FL = FL + 0.707 * FC + 0.707 * BL

where FL stands for Front Left channel, FC is Center, BL is Back Left
channel. And it's the same for right channel.

Your typical movie has dialogue on center channel, gunfire & cars'
sounds come from the front channels, ambient comes from the back ones.

So, what's needed is to gain volume on dialogues, while downplaying
ambient somewhat.


The real trick (which I have not mastered so far) is to apply it on the
fly.


> And how do you decide to resample rather than downmix? (being
> clueless at this stuff).

Resampling (and changing audio codec) is not mandatory in this case.
Reencoding is required though, you cannot use aforementioned example
with "-c:a copy".

It's just that I have the habit of storing videos, and the less their
size - the better. opus gives my ears best result for relative low
bitrate. Being a libre codec is another bonus.

Reco

[1] https://ffmpeg.org/ffmpeg-resampler.html
[2] https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=1851


Reply to: