Skip to content

Instantly share code, notes, and snippets.

@esa1975
Created December 14, 2019 02:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save esa1975/46ca1151f2a2ee2725aa20b61fe3e67a to your computer and use it in GitHub Desktop.
Save esa1975/46ca1151f2a2ee2725aa20b61fe3e67a to your computer and use it in GitHub Desktop.
Using jumpcutter to trim silence from videos

jumpcutter - Remove silence from videos

Introduction

One of the most time consuming aspects of editing videos for me is removing silence. I tend to create an outline for a video which I refer to as I record but inevitably have to think as I go which leads to pauses. It can dramatically increase the length of a video and I try to keep mine as short as I can.

I capture an average of two to three times the length of a finished video in raw footage that I then need to edit down. The editing process can take many hours depending on the amount of footage. Anything I can do to reduce that time is huge, not only in time saved but in reducing fatigue and overall making the process much less taxing and enjoyable (this is supposed to be fun!).

Enter jumpcutter, a Python script that wraps ffmpeg enabling you to automatically cut silence from raw video. You'll still need to edit the output to remove any unwanted content, retakes, and so on BUT it can save a tremendous amount of time. For example, a recent video I created was 43 minutes as raw footage, jumpcut reduced it to 31 minutes. Yes, there was 12 minutes of silence in that video which I would have had to clip in small pieces. I estimate that saved me over an hour of editing.

Developer Video

YouTube video explaining jumpcutter - https://youtu.be/DQ8orIurGxw

Setup

Install python 3 and python 3 pip:

Depending on your distro, python 3 may or may not be the default version of python. If it is the default version, you won't need to specify "3" in the following commands. To be able to tell, use your package manager to search for python. If you see python 2 and python 3 packages you will probable need to specify "3".

For example, on Ubuntu 18.04 you would run:

sudo apt install ffmpeg python3 python3-pip

Clone the repository:

git clone https://github.com/carykh/jumpcutter.git

Install the required python packages:

cd jumpcutter

python -m pip install --user -r requirements.txt

General-use command line:

python jumpcutter.py --input_file input.mkv --sounded_speed 1 --silent_speed 999999 --frame_margin 2 --frame_rate 30

Things to Watch For

  • You will want to set your frame rate as there doesn't appear to be any automatic detection.
    • Adjust the frame_rate parameter to match the input video
  • Make sure you have plenty of disk space
    • jumpcutter works by extracting individual frames as images and takes up a lot of temp space while running i.e. many GB of space.
  • Depending on your audio and speech patterns, you may need to adjust the frame_margin parameter
    • This parameter provides space for things like soft speech sounds like s and f
    • Increase this if you hear audio clipping
@ildarius
Copy link

ildarius commented May 7, 2020

Nice thank you! Wondering if you ever ran into an issue with audio not matching the video

@emmanueltsukerman
Copy link

@ildarius yes, if the frame rate isn't set correctly

@kapilcanopus
Copy link

How we can do the same for windows?

@dag7dev
Copy link

dag7dev commented Jan 19, 2022

@kapilcanopus it is the same procedure, just make sure to install ffmpeg for windows and add /ffmpeg/bin folder to your PATH environment variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment