Using ffmpeg, I'm recording a talk, its audio with a semi-distant microphone. It makes sense to somewhat enhance the speech clarity, reduce background static and environmental noise, etc., in the most generic terms.

What combination of ffmpeg audio filters am I best advised to use to enhance recorded speech?

I'm currently using


as that is the range speaking voice is most prominent in,


to additionally attenuate the bass frequencies, and

compand=attacks=.05:decays=.05:points=-90/-90 -70/-90 -15/-15 0/-10:soft-knee=6:volume=-70:gain=10

to apply dynamic range compression and supposedly make the softer passages (above -70dB) louder and the louder ones more even.

I understand digital filters are not magic, but I'm looking for something more from ffmpeg's (or LADSPA's) repertoire to enhance the sound more, make it more resilient to noise, sporadic coughs, perhaps lose the acquired metallic aftersound ...

The Linux command line I'm using to test:

...above filter lines, in sequence...

arecord -q -r 11025 -f s32_le -c 1 -t wav - |
    ffmpeg -f wav -i - -af "$filters" -f wav - |
  • 1
    $\begingroup$ Excellent question; I eagerly await an answer. Of course, this may be off topic "There is no single correct answer", but I'll hold off on flagging for now :-) $\endgroup$ – lmat - Reinstate Monica Jun 17 '16 at 20:40

I just came across one article related to the compand command that might be useful (just in case someone looking for help sees this article).

From the article:

To test this, and my understanding of compand, I added a very simple filter to remove the quiet section of the audio by decreasing their volume dramatically:

ffmpeg -i in.mp3  -filter_complex \
  "compand=attacks=0:points=-30/-900|-20/-20|0/0|20/20" \

attacks=0 means that I wanted to measure absolute volume, not averaging the sound over a short (or long period of time). When the speaker suddenly yells, or talks back and forth with someone off mic, I want the volume adjustment to be immediate. The downside is that you may hear the volume being clamped.

points is the actual volume mapping function, and I’ll walk through it:

I added a mapping of -30/-900, which means that volume below -30db in the original input track gets converted to -900db (completely silent).

enter image description here


The 1st mentioned tutorial https://medium.com/@jud.dagnall/dynamic-range-compression-for-audio-with-ffmpeg-and-compand-621fe2b1a892 is a great introduction and the filter documentation also adds a few examples.


Its very dependent on situation if your set up for near field or far field but generally its common for the voice command to be the predominant range and just to reduce background noise to a minimum without giving too much effect to the voice signal of interest.

So a simple noise gate to drop low level noise where above that its given gain to normalise is probably all that is needed.

The above 2 are great sources of info as is the ffmpeg filter chain but its likely you will get better effects by modifying and testing the settings yourself.


In man ffmpeg-filters, there are several examples that may be of interest:

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:


and many others.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.