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
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.mp4Re-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
Cut fast with stream copy
-c copycopies packets without decoding them, so the clip starts at the keyframe before00: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.mp4Keep the last 8 seconds
-sseofseeks from the end of the file: 0 is the end and negative values are earlier. Before-iwith a re-encode, it wrote an 8-secondlast8.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
| Flag | What it does | Used here |
|---|---|---|
-ss 00:00:10 | Start position; before -i it seeks the input to the closest seek point before it | Start at 10 s |
-to 00:00:20 | Stop position, a timestamp | End at 20 s |
-t 10 | Stop after a duration; wins over -to when you pass both | Not used |
-sseof -8 | Like -ss, counted from the end of the file | Last 8 s |
-c copy | Copies packets without re-encoding, so the cut starts on a keyframe | Fast cut |
-c:v libx264 -crf 20 | Re-encodes to H.264; CRF runs 0 to 51, 23 is the default, lower is higher quality | Exact cut |
-preset veryfast | Trades x264 speed against file size; medium is the default | Exact cut |
-movflags +faststart | Moves the index (moov atom) to the start of the file | Both 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.
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"]
}'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.
- Choose a CRF value in ffmpegWhat CRF does in libx264, the file size and VMAF score for CRF 18, 23, 28 and 33 on one clip, and how x265's scale differs.
- Add faststart to an MP4 with ffmpegMove the moov atom to the front of an MP4 with -movflags +faststart so it plays before the download ends, and check where it sits.
- Set the video bitrate with ffmpegSet an average bitrate with -b:v, cap it with -maxrate and -bufsize, or run two passes to land on a file size, with measured results.
- Concatenate videos with ffmpegJoin clips with the concat demuxer and -c copy when they match, or with the concat filter when their size, frame rate or codec differ.
- Video to GIF with ffmpegMake a clean GIF from a video with palettegen and paletteuse, then shrink it with frame rate, size, colours or a different format.
- Video trimmerCut a clip out of a video in your browser, frame-exact or instantly, free and without uploading it, or with one API call.
- Trim videoCut a clip out of a longer video by URL, frame-accurate or by stream copy, for under a fifth of a cent per 10-second cut.
- ffmpeg exited with code 1: Conversion failed!fluent-ffmpeg reports only ffmpeg's exit code and last line. The real cause is in stderr: print it, or use -v error to see it alone.
- ReelSDK vs self-hosted FFmpegTranscoding a minute of 1080p to 720p takes about 24 seconds of compute: about 0.8 cents on ReelSDK, about a tenth of a cent on a busy 4 vCPU box. Below about 11,000 minutes a month, the API costs less than an always-on box.
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
