FFMPEG COMMAND

Split a video into parts with FFmpeg

The segment muxer writes a numbered file every N seconds. With stream copy it can only cut on keyframes, which explains most surprises; the commands below show both the fast path and the exact path with measured part lengths.

Verified with FFmpeg 9.0.1 on 26 August 2026. Search intent: ffmpeg split video into parts.

the command
ffmpeg -i input.mp4 -c copy -map 0 -f segment -segment_time 4 -segment_time_delta 0.1 -reset_timestamps 1 part-%03d.mp4

Cuts the file into 4 s pieces without re-encoding. On a 12 s file with a keyframe every 2 s it produced part-000.mp4 (4.02 s), part-001.mp4 (4.00 s) and part-002.mp4 (4.00 s) in a fraction of a second.

Flags, explained

-f segment
Use the segment muxer, which opens a new output file for each piece.
-segment_time 4
Target length of each piece in seconds. Cuts land on the first keyframe at or after each boundary.
-segment_time_delta 0.1
Accept a keyframe up to 0.1 s before the boundary. Without it the first part came out 6.02 s long.
-reset_timestamps 1
Start every piece at 0 instead of carrying the source timeline. Players and concat tools expect this.
-map 0
Include every stream of the input. Without it the muxer keeps one video and one audio stream only.
-c copy
No decoding or encoding. Instant, lossless, keyframe-bound.
-force_key_frames "expr:gte(t,n_forced*4)"
When re-encoding, insert a keyframe every 4 s so the cuts can be exact.
-segment_times 3,9
Comma-separated cut points instead of a fixed length.

Variants

Exact lengths by re-encoding with forced keyframes

shell
ffmpeg -i input.mp4 -map 0 -c:v libx264 -preset veryfast -crf 20 -force_key_frames "expr:gte(t,n_forced*4)" -c:a aac -b:a 128k -f segment -segment_time 4 -segment_time_delta 0.1 -reset_timestamps 1 part-%03d.mp4

Forces a keyframe every 4 s so the muxer can cut exactly there: three parts of 120 frames each (4.02, 4.00 and 4.00 s) from a source with only two keyframes. Costs a full encode.

Cut at explicit timestamps

shell
ffmpeg -i input.mp4 -c copy -map 0 -f segment -segment_times 3,9 -reset_timestamps 1 part-%03d.mp4

Splits at 3 s and 9 s. With stream copy each cut snaps to the next keyframe: on the 2 s keyframe file the parts were 4.02 s, 6.00 s and 2.00 s, not 3, 6 and 3. Re-encode with forced keyframes at those times for exact cuts.

Just one part

shell
ffmpeg -ss 4 -t 4 -i input.mp4 -c copy part.mp4

Seeks to 4 s and keeps 4 s. Stream copy starts on the keyframe before the seek point, so the part contained 122 frames and 4.07 s here. See the trim page for frame-accurate cuts.

Pitfalls we hit

  • Without -segment_time_delta the first piece is often longer than asked: the muxer measured the boundary from the first packet (0.067 s in), so the keyframe at exactly 4.000 s fell just before it and the cut moved to 6.0 s. -segment_time_delta 0.1 fixed it.
  • Stream copy cuts only on keyframes. A file with a keyframe every 8.3 s split into 8.35 s and 3.67 s pieces when asked for 4 s pieces.
  • Forgetting -map 0 silently drops extra audio tracks and subtitles.
  • Pieces without -reset_timestamps 1 start at 4, 8, 12 s in their own timeline; some players show a black screen until then.
  • Numbering starts at 000, and %03d overflows past 999 pieces. Pick the pattern width for the number of parts you expect.

How we verified it

Run with FFmpeg 9.0.1 on 26 August 2026. Stream copy on a 12 s 1920x1080 file with a keyframe every 2 s: 4.021 s, 4.000 s and 4.000 s with -segment_time_delta 0.1; 6.021 s, 4.000 s and 2.000 s without it. Same command on a file with keyframes at 0 and 8.33 s: 8.355 s and 3.667 s. Re-encode with forced keyframes every 4 s: three parts of 120 frames (4.021, 4.000, 4.000 s). -segment_times 3,9 with copy: 4.021, 6.000 and 2.000 s. -ss 4 -t 4 with copy: 122 frames, 4.067 s.

The same edit as a typed operation

split_video forces keyframes at the boundaries so every part is the requested length (1 to 3600 s, up to 50 parts), then returns each part as its own signed URL in the job result. The last part can be shorter, which is stated in the result rather than discovered later.

MCP tool: split_videoPOST /api/v1/tools/split-video
request body
{
  "inputs": [{ "id": "main", "url": "https://example.com/long-video.mp4" }],
  "options": { "segment_duration": 10 }
}

FAQ

Why are my parts longer or shorter than the time I asked for?

With -c copy FFmpeg can only cut on keyframes, so each cut moves to the next keyframe. Add -segment_time_delta 0.1 to accept keyframes just before the boundary, or re-encode with -force_key_frames to place keyframes where the cuts must be.

How do I split a video into N equal parts?

Divide the duration by N and use that as -segment_time, or list the cut points with -segment_times. For exact equal lengths re-encode with -force_key_frames at the same interval.

Can I split without losing quality?

Yes, with -c copy nothing is re-encoded. The trade-off is that cuts land on keyframes, so pieces are only as precise as the keyframe interval of the source.

How do I extract a single part instead of all of them?

Use -ss for the start and -t for the length before -i, with -c copy for speed or a re-encode for a frame-accurate start. The trim page covers both.

Related commands

All FFmpeg commands