ffmpeg -ss 00:00:10 -to 00:00:20 -i in.mp4 cuts a 10-second clip; re-encode for an exact cut, since -c copy can start almost 2 seconds early. ReelSDK's video trimmer does it free in your browser, or by API at $0.02 per compute minute.

Trim a video with ffmpeg: copy or re-encode

Re-encode when the cut must land on the exact frame, copy when speed matters: on a 28-second 1080x1920 file, ReelSDK's API finishes a copy in about 7 seconds and a re-encode in about 10.

GuidesUpdated

exact cut
ffmpeg -ss 00:00:10 -to 00:00:20 -i in.mp4 \
  -c:v libx264 -crf 20 -preset veryfast \
  -c:a aac -movflags +faststart cut.mp4

Re-encodes in.mp4 from 00:00:10 to 00:00:20 with libx264 and AAC; +faststart moves the index to the front so playback can start before the download ends. cut.mp4 comes out at exactly 10 seconds: 300 frames at 30 fps.

Variations

The other commands you will need

  1. Cut fast with stream copy

    -c copy copies packets without decoding them, so the clip starts at the keyframe before 00:00:10, here almost 2 seconds early. An MP4 edit list hides those extra frames from the timeline, but they stay in the file.

    fast cut
    ffmpeg -ss 00:00:10 -to 00:00:20 -i in.mp4 -c copy cut.mp4
  2. Keep the last 8 seconds

    -sseof seeks from the end of the file: 0 is the end and negative values are earlier. Before -i with a re-encode, it wrote an 8-second last8.mp4.

    last 8 seconds
    ffmpeg -sseof -8 -i in.mp4 \
      -c:v libx264 -crf 20 -preset veryfast \
      -c:a aac -movflags +faststart last8.mp4

The flags

The flags in these commands

The flags in these commands
FlagWhat it doesUsed here
-ss 00:00:10Start position; before -i it seeks the input to the closest seek point before itStart at 10 s
-to 00:00:20Stop position, a timestampEnd at 20 s
-t 10Stop after a duration; wins over -to when you pass bothNot used
-sseof -8Like -ss, counted from the end of the fileLast 8 s
-c copyCopies packets without re-encoding, so the cut starts on a keyframeFast cut
-c:v libx264 -crf 20Re-encodes to H.264; CRF runs 0 to 51, 23 is the default, lower is higher qualityExact cut
-preset veryfastTrades x264 speed against file size; medium is the defaultExact cut
-movflags +faststartMoves the index (moov atom) to the start of the fileBoth re-encodes

Sources: ffmpeg documentation, FFmpeg H.264 encoding guide, checked November 2026.

Copy or re-encode: what the two files show

We ran both cuts on the same 28-second H.264 file. Its keyframes are far apart: the last one before the 10-second mark sits at about 8.3 seconds.

The ffmpeg docs explain why the results differ. With -ss before -i, ffmpeg "will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved."

The re-encode decoded and dropped the frames before the 10-second mark and wrote exactly 10 seconds. The copy kept them, so it starts almost 2 seconds early and came out about 40% bigger.

Where -ss goes

Put -ss before -i. As an input option, ffmpeg jumps to the closest seek point before your time; when re-encoding, it decodes and drops the short stretch up to your timestamp, so the cut is still exact.

After -i, as an output option, ffmpeg "decodes but discards input until the timestamps reach position". That is exact too, but on our input it would decode the first 10 seconds just to throw them away.

-to or -t

-to is a position: "Stop writing the output or reading the input at position." -t is a duration. With -ss 00:00:10 -to 00:00:20 before -i, the cut ends at 00:00:20 of the input, so the re-encode is 10 seconds long.

Pass one or the other. In the docs' words, "-to and -t are mutually exclusive and -t has priority."

Without installing ffmpeg

The same command as one API call

Send the same args to POST /v1/ffmpeg with the input URL in inputs and the file to keep in outputs. Each job runs ffmpeg 8.1 on a fresh machine, at $0.02 per compute minute billed per second; the exact cut above finished in about 10 seconds and cost under half a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/out/job_x5wepdaqkop4tepq05xp/video.mp4"
    },
    "args": [
      "-ss", "00:00:10", "-to", "00:00:20", "-i", "in.mp4", "-c:v",
      "libx264", "-crf", "20", "-preset", "veryfast", "-c:a", "aac",
      "-movflags", "+faststart", "cut.mp4"
    ],
    "outputs": ["cut.mp4"]
  }'
The exact cut from the API: 10 seconds, about 3.8 MB.Input: 28-second inputcopy cutlast8.mp4

FAQ

Questions, answered

Why does my -c copy cut start before the time I asked for?

With -ss before -i, ffmpeg seeks to the closest seek point before your time, and with -c copy the stretch from that keyframe to your time is kept. Our cut at 00:00:10 started at the keyframe at about 8.3 s, so almost 2 seconds of frames sit before the start, hidden by an MP4 edit list.

Is -to a duration or a timestamp?

A timestamp: it stops reading the input or writing the output at that position. For a duration, use -t. The two are mutually exclusive, and if you pass both, -t wins.

Which is faster, copy or re-encode?

Copy, because nothing is decoded or encoded. On our 28-second 1080x1920 input, the copy job finished in about 7 seconds and the libx264 re-encode in about 10.

Can I trim a video on a server without ffmpeg installed?

Yes. Send the same args to POST https://api.reelsdk.com/v1/ffmpeg with the input URL in inputs and cut.mp4 in outputs. It runs ffmpeg 8.1 on a fresh machine per job for $0.02 per compute minute, billed per second with a 1-second minimum, and failed jobs are free.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains