An automatic silence remover for Final Cut Pro X.
This project has its origins in jashmenn's final-cut-it-out.js script.
All credit goes to him and those who have left follow-up comments on his Gist.
This script is meant to work with Final Cut Pro X (on a Mac), and requires the use of ffmpeg
to detect silent portions of the clip.
You can install Final Cut Pro X from the app store, and ffmpeg
using Homebrew: brew install ffmpeg
.
You should clone or download this project to somewhere on your computer, and in the Terminal, change directories into this project's directory.
The following is how I use this script. You could have a simpler or more complex workflow, depending on your needs.
- Insert the video clip with silent portions into an open project timeline in Final Cut Pro X.
- Export the video to a low-resolution file that can be processed via
ffmpeg
. - Run the following
ffmpeg
command to detect silence in your video:ffmpeg -i [exported video file here.mp4] -af silencedetect=n=-35dB:d=800ms -f s16le -y /dev/null 2>&1 | tee silence.txt
- Run
./final-cut-it-out.js silence.txt
and watch as the script makes cuts through the timeline at the margins of each silent section, then goes back and deletes all the silent portions. - Run through the timeline and adjust the gaps using the select/trim tool as desired.
Before running this script, you should always have a backup Project/timeline in FCPX since this will make destructive edits to your video timeline! Cmd-Z should not be relied on in case of disaster—you've been warned!
I currently record at 23.98p, so some of the settings within moveToTimecode()
have been changed accordingly. The original script was written with 60p footage in mind.
Someday it would be nice to modify the script to account for different frame rates... but for now, you'll need to modify the script if you shoot at 30p or 60p.
The other parameters you may wish to tweak, based on your own speaking style and the rhythm of your speech:
- In the
ffmpeg
command,silencedetect=n=-35dB:d=800ms
: change the dB setting to a higher or lower threshold if you have softer or louder audio and are getting parts cut out that you do not want cut. Adjust thed
value (how long a portion is silent before it is marked for deletion) as needed. - In the script, adjust the
startMargin
andendMargin
to your liking. I like a little bit of space before and after the audio, but some people like a bit more of a 'jump' cut style so should reduce these values a bit.