I have to 'adjust' some recordings of lessons I've attended. The professor was walking here and there but my recorder was in a fixed place; now I have audio tracks going from loud to whispers. How can I deal with it using ffmpeg?
There are a few possibilities:
Apply simple normalization (e.g. peak or RMS normalization). This will only change the gain throughout the entire file, so you'll still experience variations between loud and soft parts. Not really recommended for your use case.
Use dynamic compression with the
compandfilter. This will reduce the dynamic range (i.e. the difference between soft and loud parts) throughout the recording. You have to find a proper threshold at which the compression kicks in, and you will most likely get quite noisy signals for the soft parts.
dynaudnormfilter, which “allows for applying extra gain to the ‘quiet’ sections of the audio while avoiding distortions or clipping the ‘loud’ sections.” In your case, that'd be the preferred option.
Basically, you just have to download a recent static build of ffmpeg from here and then run:
ffmpeg -i input.wav -filter:a "dynaudnorm" output.wav
You will most likely need to tweak the filter options for your particular use case. Use the examples given for the
compand filter as a starting point:
Make music with both quiet and loud passages suitable for listening to in a noisy environment:
Another example for audio with whisper and explosion parts:
Here, the second example's options are, specifically:
You may adjust the gain to keep the same dynamic processing but adjust it to your baseline input level.
Also, as a graphical alternative to ffmpeg, you can use Audacity and its built-in compressor, which achieves the same effect as the
compand filter in ffmpeg. The wiki has a quite good explanation for the options, too.