Skip to main content


Can someone give me an ffmpeg audio filter that will reduce the hum in this clip to, let's say, -66 dB? This is for silence detection purposes so it should not significantly reduce the volume of music or speech, were there any.
in reply to jwz

This is the kind of thing I love seeing on Mastodon (assuming you get the correct answer, and few if any “I didn't actually try this but here's what I think the man page says”).
in reply to jwz

Apologies. So much for subtlety. I’ll try “don’t fucking do that” the next time.
in reply to jwz

#ffmpeg can do audio processing? If the hum is from mains power, it is probably at 60Hz, with strong overtones at (odd) multiples of that, plus this high whine.
in reply to jwz

@joes
I think they're asking IF ffmpeg can audio process, or maybe they didn't see ffmpeg in the sentence 🤷‍♂️
in reply to Matthew

@mrblissett
yes thanks, that was misleading. I didn’t know that, and figured if you do, you know what you want. In any case you want a notch filter at those frequencies, i.e. very narrow (high-Q) bandreject filter with gain to -inf or as low as it goes, maybe only -20dB for the overtones. You can do multiple filters more easily with [an]equalizer. Also checkout aspectralstats.
in reply to jwz

excuse me, I just wanted to help with what I know, which is not the exact command line. What do you want to understand?
in reply to joes⚠️

@joes I asked a *very* specific question to which you do not know the answer. You are just wasting my time.
in reply to jwz

Content warning: I wonder who knows that off the top of their head. No need to be so harsh to a potential helper. I still don’t know what exactly you’re missing.

in reply to jwz

I'm struggling with this as the hum is pretty much white noise up to 10kHz. I tried a couple of simple low and high pass filters using

$ ffmpeg -i hum.mp3 -af "highpass=6000" highpass.mp3

Or combinations of:

$ ffmpeg -i hum.mp3 -af "highpass=10000, lowpass=100" highpass.mp3

Which just flattens everything.

The spectrum .png was generated using:

$ fmpeg -i hum.mp3 -lavfi showspectrumpic=s=1024x1024 hum.png

in reply to Will Deakin

I then couldn't get anything with "afftdn=nr=66:nf=-80:tn=1" which should 'Reduce white noise by 66dB, also set initial noise floor to -80dB and enable automatic tracking of noise floor so noise floor will gradually change during processing'.

meh

in reply to Will Deakin

@wnd I wonder if there's some way to get ffmpeg to say "this is in fact white noise"? It is very flat...
in reply to jwz

@wnd if it’s actual white noise it probably doesn’t compress well, so you could use ffmpeg with an audio compression codec and use output file size of audio chunks as a predictor of noise.
in reply to jwz

you can tune a highpass filter from mostly to completely removes the noise and gives a more or less a silent track.

The problem is the second bit, as if you apply the same filter to music you end up with the high-hat tsss.

(I combined Res by Underworld with the hum and ran the filter. I got great high-energy "tss tss tss" vibes for eight minutes but not much else.)

Equally I'm just messing. I have used ffmpeg filters but it's just a hobby. An expert may know how to get a better result.