What You Will Learn

Tested version: Verified with FFmpeg 6.1 (ubuntu-latest / CI-validated) Target OS: Windows / macOS / Linux


Basic Options Reference

OptionPositionDescription
-ss positionBefore input or before outputSpecifies where processing starts
-to positionBefore outputSpecifies where processing ends (absolute timestamp from file start)
-t durationBefore input or before outputSpecifies the duration to process

-to and -t cannot be used together. If both are specified, -t takes precedence (per the FFmpeg official documentation).


Time Formats

FFmpeg accepts two styles of time specification.

FormatExampleDescription
HH:MM:SS00:01:301 minute 30 seconds
HH:MM:SS.ms00:01:30.5001 minute 30 seconds 500 milliseconds
Seconds (decimal allowed)90 or 90.590 seconds (or 90.5 seconds)

Input-Side -ss vs. Output-Side -ss (Most Important)

The position of -ss is the single biggest factor controlling trimming speed and accuracy.

Input-Side -ss (Fast Seek / Keyframe-Based)

ffmpeg -ss 00:01:00 -i input.mp4 -to 00:02:00 -c copy output.mp4

Placing -ss before -i causes FFmpeg to perform a fast seek (fast seek) to the keyframe immediately before the specified time.

Output-Side -ss (Slow Seek / Frame-Accurate)

ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4

Placing -ss after -i causes FFmpeg to decode from the beginning of the file up to the specified frame.

Which Should You Use?

Use CaseRecommendation
Fast extraction with stream copy (-c copy)Input-side -ss (speed priority)
Frame-accurate cut requiredInput-side -ss + re-encoding (see below)
Quickly extracting a short clip for reviewInput-side -ss

Fast Trimming with Stream Copy (-c copy)

Extremely fast because no re-encoding occurs. However, accuracy depends on keyframe boundaries.

ffmpeg -ss 00:00:30 -i input.mp4 -to 00:01:30 -c copy output.mp4
ffmpeg -ss 90 -i input.mp4 -t 60 -c copy output.mp4

Notes:


Accurate Trimming (with Re-Encoding)

For frame-accurate cuts, combine input-side -ss with re-encoding. Input-side -ss performs a fast seek, then re-encoding begins from there — a good balance of speed and accuracy.

ffmpeg -ss 00:00:30 -i input.mp4 -to 00:01:30 -c:v libx264 -crf 23 -c:a aac output.mp4

Specifying by duration:

ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c:v libx264 -crf 23 -c:a aac output.mp4

Choosing Between -to and -t

-to: Specify by End Timestamp

ffmpeg -ss 00:01:00 -i input.mp4 -to 00:03:00 -c copy output.mp4

This example extracts 2 minutes from 1:00 to 3:00. -to is an absolute timestamp from the file start.

-t: Specify by Duration

ffmpeg -ss 00:01:00 -i input.mp4 -t 120 -c copy output.mp4

This example extracts 120 seconds (2 minutes) starting at 1:00. Convenient because you do not need to calculate the end time.


Common Pitfalls

Output Beginning Looks Corrupted with -c copy

Cause: The cut start point is not a keyframe, so the decoder cannot correctly reconstruct frames. Fix: Re-encode with -c:v libx264 -c:a aac, or adjust the start point to a keyframe position.

-to Timestamp Behavior Is Affected by Input-Side -ss

Behavior may vary depending on the FFmpeg version and situation. If results are unexpected, replacing -to with -t (duration) gives more predictable results.

Output Has No Audio or No Video

Verify that audio and/or video streams exist in the source. Also check that -an (no audio) or -vn (no video) has not been specified unintentionally.



Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner) Primary sources: ffmpeg.org/ffmpeg.html / trac.ffmpeg.org/wiki/Seeking / ffmpeg.org/ffmpeg-formats.html