Cut a clip of fixed length with -t
Use -t as an output option in FFmpeg 7.1 to keep exactly the first N seconds of a stream, and know how it differs from -to.
-t sets a duration, not an end time, and it stops reading the input after that much output has been written. That makes it the simplest way to take a fixed-length sample, such as a ten second preview from the start or from a point you chose with -ss.
ffmpeg -ss 90 -i input.mp4 -t 10 -c copy preview.mp4
ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 preview.mp410.000000The printed value is what the second command reports for a clip whose first frame lands on a keyframe. With -c copy the real duration can be a little longer or shorter than 10 seconds, because packets are kept whole and the clip starts on a keyframe. Re-encoding gives you the length you asked for to within a frame.
-t and -to do the same job from two directions: -t 10 means ten seconds of output, -to 100 means stop when the timestamp reaches 100. If both are given, -t wins, as the ffmpeg manual states. Placed before -i, -t limits how much of the input is read instead, which is rarely what you meant if you also use -ss after the input.