Originally published at ffmpeg-micro.com
Trimming video with FFmpeg looks simple until your 5-second clip comes out as 7 seconds. Or your output starts a few frames late. The culprit is almost always flag order: where you put -ss relative to -i completely changes how FFmpeg processes the seek.
This post covers what -ss , -t , and -to do, why their placement matters, and when to use each combination.
What -ss, -t, and -to Actually Do
Three flags control timing in FFmpeg:
-ss sets the start position (the seek point)
-t sets the duration of the output
-to sets the end timestamp
-t and -to are mutually exclusive. If you use both, -t wins and -to gets ignored silently.
The critical distinction is where you place -ss : before -i (input seeking) or after -i (output seeking). The two produce different results with different tradeoffs.
Input Seeking: Fast but Imprecise
Place -ss before -i and FFmpeg jumps directly to the nearest keyframe at or before your timestamp.…