How to Trim a Video With FFmpeg Without Re-Encoding
Trimming with re-encoding is slow and loses a small amount of quality every time. Trimming on keyframes with stream copy is instant and lossless — the tradeoff is you can only cut on keyframe boundaries, not frame-exact.
Trimming with re-encoding is slow and loses a small amount of quality every time. Trimming on keyframes with stream copy is instant and lossless — the tradeoff is you can only cut on keyframe boundaries, not frame-exact.
The command
ffmpeg -ss 00:00:10 -i input.mp4 -to 00:00:25 -c copy output.mp4What each flag does
| -ss 00:00:10 | Seek to 10 seconds before reading input — placing it before -i makes this a fast keyframe seek. |
| -i input.mp4 | The source file. |
| -to 00:00:25 | End the output at the 25-second mark (not a duration — an absolute timestamp). |
| -c copy | Copies both video and audio streams without re-encoding — this is what makes it instant. |
Where this goes wrong
With -c copy, FFmpeg can only start the output on a keyframe, so your trim point can land up to a couple of seconds off from where you asked, snapping to the nearest keyframe before it. If you need a frame-exact cut, drop -c copy and let FFmpeg re-encode — slower, but exact.
Frame-exact trim (re-encoding)
ffmpeg -i input.mp4 -ss 00:00:10 -to 00:00:25 -c:v libx264 -crf 18 -c:a aac output.mp4Here -ss is placed after -i, which forces FFmpeg to decode from the start and seek precisely, at the cost of speed. -crf 18 keeps quality close to visually lossless.
FFmpeg trims the clip. It doesn't add the caption, the zoom, or the callout on top of it — that's a separate step, and it's the one NULLFRAME's templates automate.
See the templatesCommon questions
Why is my trimmed clip a few seconds longer than expected?+
Can I trim without specifying an end time?+
-t instead of -to to specify a duration from the start point instead of an absolute end timestamp.