How to Split Video into 10 Second Segments in FFmpeg
This article provides a quick and practical guide on how to use the
FFmpeg segment muxer to split a video file into equal
10-second parts. You will learn the exact command-line syntax for both
fast splitting (stream copying) and precise splitting (re-encoding),
along with an explanation of how each parameter works to ensure your
output files are properly formatted.
To split a video using FFmpeg, you can choose between two primary methods depending on whether you need speed or frame-accurate precision.
Method 1: Precise Splitting (Recommended)
Because video files compress data using keyframes, splitting a video at an exact timestamp often requires forcing a keyframe at those specific intervals. Re-encoding the video ensures that each 10-second segment starts exactly on time.
Run the following command in your terminal:
ffmpeg -i input.mp4 -force_key_frames "expr:gte(t,n_forced*10)" -f segment -segment_time 10 -reset_timestamps 1 output_%03d.mp4Method 2: Fast Splitting (Without Re-encoding)
If you want to split the video instantly without waiting for re-encoding, you can copy the video and audio streams directly. Note that this method may result in segments that are slightly longer or shorter than 10 seconds, as FFmpeg can only split the video on existing keyframes.
Run this command for the fast copy method:
ffmpeg -i input.mp4 -c copy -f segment -segment_time 10 -reset_timestamps 1 output_%03d.mp4Command Parameter Breakdown
-i input.mp4: Specifies the path to your source video file.-force_key_frames "expr:gte(t,n_forced*10)": Forces the encoder to write a keyframe exactly every 10 seconds. This guarantees that each output segment starts exactly at the specified time block.-c copy: Copies the video and audio codecs directly without re-encoding, saving processing time (used only in Method 2).-f segment: Tells FFmpeg to use the segment muxer.-segment_time 10: Sets the target segment duration to 10 seconds.-reset_timestamps 1: Resets the timestamps at the beginning of each segment so that every generated video file starts at 00:00.output_%03d.mp4: Defines the output naming pattern. The%03dformatting tells FFmpeg to number the output files sequentially with three digits (e.g.,output_000.mp4,output_001.mp4,output_002.mp4).