Noise reduction in audio track of a video

In the spirit of doing as much as work via command line, I removed a noisy audio from a tech talk I wanted to view. This is just a note to my future self to the way I did it.

Steps:

  1. Separate audio from video

    strip_audio video_file.mp4

  2. Generate noise profile of the video

    sox audio_file.mp3 -n trim 0 2.5 np.noise_profile

  3. Remove the noise

    sox audio_file.mp3 cleaned.mp3 noisered np.noise_profile .2

  4. Replace the video with the new audio

    ffmpeg -i video_file.mp4 -i cleaned.mp3 -map 0:v -map 1:a -codec copy -shortest out.mp4

Note:

  1. strip_audio can be installed via gem install strip_audio
  2. sox can be installed via brew install sox --with-mad --with-lame