How to Split Video by Silence with FFmpeg

This guide explains how to automatically split a video into smaller segments based on silent intervals using FFmpeg. By detecting the silent parts in your video’s audio track, you can generate precise timestamps and use them to cut your video into individual, high-quality clips without re-encoding.

Step 1: Detect Silence Timestamps

First, you need to analyze the video’s audio track to find where the silent parts occur. FFmpeg has a built-in filter called silencedetect for this purpose.

Run the following command in your terminal:

ffmpeg -i input.mp4 -af silencedetect=noise=-30dB:d=0.5 -f null -

Parameter Breakdown:

After running this command, look at the terminal output. You will see lines containing the silence timestamps:

[silencedetect @ 0x...] silence_start: 12.504
[silencedetect @ 0x...] silence_end: 13.211 | silence_duration: 0.707
[silencedetect @ 0x...] silence_start: 45.120
[silencedetect @ 0x...] silence_end: 46.010 | silence_duration: 0.890

Note down the silence_start (or the midpoint of the silence) timestamps.

Step 2: Split the Video Using Timestamps

Once you have the timestamps where the silence occurs, you can use FFmpeg’s segment muxer to split the video.

Using the example timestamps from the step above (silences starting around 12.5 and 45.1 seconds), run the following command:

ffmpeg -i input.mp4 -f segment -segment_times 12.5,45.1 -c copy output_%03d.mp4

Parameter Breakdown:

Note: Because -c copy splits the video at the nearest keyframe (I-frame), the split might not be 100% frame-accurate. If you require exact frame-accurate cuts, omit -c copy to re-encode the video during the split.