Automatic silence remover for Final Cut Pro X
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.
First, export a project timeline with the silent portions to an 'Audio only' file or a low-resolution video file that ffmpeg
can process.
Second, run the following ffmpeg
command to output silent portions into a text file:
ffmpeg -i [VIDEO.MP4] -af silencedetect=n=-35dB:d=800ms -f s16le -y /dev/null 2>&1 | tee silence.txt
Third, run this script to trim all the silent portions (it will take a little while if you have a long video):
./final-cut-it-out.js silence.txt
Finally, adjust the remaining 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:
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 the d
value (how long a portion is silent before it is marked for deletion) as needed.startMargin
and endMargin
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.