FFmpeg Cut Video: Difference Between -t and -to
Trimming videos is one of the most common tasks in FFmpeg, and it is
primarily done using the -t and -to options.
While both options define where a video cut should end, they calculate
this endpoint differently. This article explains the exact differences
between -t and -to, how they interact with the
start time (-ss), and how to use them with clear
examples.
The -t Option: Cut
by Duration
The -t option specifies the duration of
the output clip. When you use -t, you are telling FFmpeg
exactly how many seconds (or hours, minutes, and seconds) the final
video should last, starting from your split point.
Syntax and Example
ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c copy output.mp4In this example:
-ss 00:01:00starts the cut at the 1-minute mark.-t 30instructs FFmpeg to record for 30 seconds.- The resulting video will play from 00:01:00 to 00:01:30 of the original video.
You can also write the duration in HH:MM:SS format, such
as -t 00:00:30.
The -to
Option: Cut to a Specific Timestamp
The -to option specifies the exact stop
time on the timeline where the cut should end. Instead of
defining how long the video should be, you define the exact second or
timestamp where FFmpeg should stop rendering.
Syntax and Example
ffmpeg -ss 00:01:00 -i input.mp4 -to 00:01:30 -c copy output.mp4In this example:
-ss 00:01:00starts the cut at the 1-minute mark.-to 00:01:30instructs FFmpeg to stop cutting at the 1-minute and 30-second mark of the original video.- The resulting video will be 30 seconds long.
Key Differences and
Behavior with -ss
The way -t and -to behave depends heavily
on where you place the start time option (-ss) in your
command.
1. When
-ss is placed AFTER the input (-i)
If you place -ss after the input file, FFmpeg decodes
the input first.
-tacts as the duration.-toacts as an absolute timestamp of the original input file.
Recommended Command for accurate -to cuts:
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:01:30 -c copy output.mp42. When
-ss is placed BEFORE the input (-i)
If you place -ss before the input file, FFmpeg seeks to
that point immediately, resetting the timeline of the input file so that
your start point becomes 00:00:00.
-tstill acts as the duration (no change in behavior).-tobehaves exactly like-tbecause the timeline has been reset. If you set-ss 10and-to 15, FFmpeg will cut 15 seconds of video, ending at the 25-second mark of the original file.
Behavior Comparison Table:
| Option | Command Structure | Resulting Video Length |
|---|---|---|
-t |
ffmpeg -ss 10 -i input.mp4 -t 15 ... |
15 seconds (ends at 25s mark) |
-to |
ffmpeg -i input.mp4 -ss 10 -to 15 ... |
5 seconds (ends at 15s mark) |
-to
(Reset) |
ffmpeg -ss 10 -i input.mp4 -to 15 ... |
15 seconds (ends at 25s mark) |