Two flavors of trim
Trimming is FFmpeg's most subtle operation because -ss and -t/-to behave differently depending on position and on whether you're copy-mode or re-encoding.
- Fast, keyframe-aligned (copy mode) —
-ssbefore-i. Demuxer seeks to the nearest preceding keyframe. Output is sub-second to produce. Trim accuracy: ±1 keyframe interval (typically up to 5 seconds). - Frame-accurate (re-encode) —
-ssafter-i. FFmpeg decodes from input start, discards frames before-ss, encodes the rest. Trim accuracy: exact frame. Cost: full re-encode.
The hybrid pattern (best of both)
Put -ss both before and after -i: pre-input does fast keyframe seek, post-input does frame-accurate adjustment. Modern FFmpeg makes pre-input seek frame-accurate when re-encoding too, so this hybrid trick is mostly historical — but it never hurts to know.
Specifying time
FFmpeg accepts -ss 90 (seconds), -ss 1:30 (mm:ss), or -ss 00:01:30.500 (hh:mm:ss.fff). -t is duration; -to is end-time. They're mutually exclusive.