ffmpeg kung-fu

I needed to filter some video files of a comedy show. There was some background noise from the spotlights I guess.

ffmeg has tons of options for post-processing audio and video files.

For the noise reduction in video I first tried:

ffmpeg -i input.mp4 -af "afftdn=nf=-25,volume=4" output.mp4

I got already a quite good result, with increased volume after filtering, but the sound was a bit dumb.

This was even more promising with the latest ffmpeg build which I downloaded and unpacked from here.

ffmpeg -i input.mp4 -af arnndn=m=cb.rnnn output.mp4

whereas you get the noise model from here - but it was not ideal, it did cancel the woman's voice.

To further analyze the root cause, I installed the amazing open source audio spectrum analyzer friture to see which frequencies create the noise. Here I saw some spikes which I now tried to filter with seven very narrow-band equalizers.

This is the final script, which I applied to the folder for batch processing all video files in it. Yes, you can simply concatenate various filters with a comma and at the end we amplify the audio for 10dB:

for i in *.MP4; do ~/Software/ffmpeg-git-20240301-amd64-static/ffmpeg -i "$i" -af "equalizer=frequency=120:width=20:width_type=h:gain=-30,equalizer=frequency=180:width=12:width_type=h:gain=-30,equalizer=frequency=241:width=5:width_type=h:gain=-30,equalizer=frequency=302:width=5:width_type=h:gain=-30,equalizer=frequency=365:width=12:width_type=h:gain=-30,equalizer=frequency=422:width=5:width_type=h:gain=-30,equalizer=frequency=485:width=10:width_type=h:gain=-20,equalizer=frequency=533:width=10:width_type=h:gain=-20,volume=10dB" "${i%.*}filtered.mp4"; done

Here is the result - a local comedy show on fair.tube - without any background noise.

For batch processing see also my post here (2013).