Vivek Haldar

Automatically edit out silence (dead air) from videos

Over on my YouTube channel, I make talking head videos, covering various computer science topics, mostly research papers. One of the most time-consuming yet mindnumbingly boring parts of that process is finding out all the dead air in the original video and editing it out. That’s got to be automatable, right? I’d been looking for a while but couldn’t find a good solution.

Massive props to Donald Feury who created a script that combines ffmpeg and MoviePy to do just that.

I’ve been using that to edit the last couple of videos I created, and also been making minor improvements to it:

  • the original script depends on the “silencedetect” filter in ffmpeg, which in my experience can sometimes leave long stretches of silence undetected, forcing me to edit the video manually and then render it again
  • the original script uses a two-step process: first run the ffmpeg silencedetect filter, then use the output of that with MoviePy to render the final video

I’ve addressed those issues in this script which does the silence-detection using MoviePy’s audio APIs, eliminating the dependency on ffmpeg, while also making the script self-contained such that it does the job in one invocation. It has proven to be much more reliable at detecting all silent periods in the original video.