5
$\begingroup$

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

highpass-frequency=300,
lowpass-frequency=4000,

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

bass=frequency=100:gain=-50,
bandreject=frequency=200:width_type=h:width=200,

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:

filters='
...above filter lines, in sequence...
'

arecord -q -r 11025 -f s32_le -c 1 -t wav - |
    ffmpeg -f wav -i - -af "$filters" -f wav - |
    aplay
$\endgroup$
  • $\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$ – Limited Atonement Jun 17 '16 at 20:40
3
$\begingroup$

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" \
  out.wav

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

New contributor
A. Martín is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
1
$\begingroup$

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:

compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2

Another example for audio with whisper and explosion parts:

compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0 

and many others.

$\endgroup$

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.