FFmpeg Input Seeking vs Output Seeking
In FFmpeg, the placement of the -ss (seek) parameter
relative to the -i (input) parameter drastically changes
how a media file is processed. This article explains the core
differences between input seeking (-ss before
-i) and output seeking (-ss after
-i), comparing their speed, accuracy, and resource usage to
help you choose the right approach for your media processing
workflows.
Input Seeking (-ss
before -i)
When you place the -ss option before the -i
option, FFmpeg performs “input seeking.”
ffmpeg -ss 00:02:30 -i input.mp4 output.mp4In this mode, FFmpeg uses the container’s demuxer to jump directly to the specified timestamp before it starts decoding the file.
- Speed: Extremely fast. Because FFmpeg skips directly to the target timestamp without decoding the preceding audio and video frames, the process is nearly instantaneous.
- Resource Usage: Very low CPU and memory consumption.
- Accuracy: Historically, input seeking was imprecise
because it would jump to the nearest keyframe (i-frame) before
the specified time, which could cause a few seconds of frozen video or
black frames at the start of the output. While modern versions of FFmpeg
use “accurate seek” by default to resolve this, it can still
occasionally cause minor syncing issues with certain container formats
or when transcoding is disabled (
-c copy).
Output Seeking (-ss
after -i)
When you place the -ss option after the -i
option, FFmpeg performs “output seeking.”
ffmpeg -i input.mp4 -ss 00:02:30 output.mp4In this mode, FFmpeg reads and decodes the entire input file from the very beginning, discarding all decoded frames until it reaches the specified timestamp. Only the frames after the timestamp are sent to the output writer.
- Accuracy: Highly precise. Because every single frame from the beginning of the file is decoded, FFmpeg knows exactly where the target timestamp lies, ensuring perfect frame-level accuracy.
- Speed: Very slow, especially for large files or timestamps deep into a video (e.g., seeking to 2 hours into a movie). FFmpeg must spend time and processing power decoding all the unwanted footage first.
- Resource Usage: High CPU and processing time.
Key Differences at a Glance
| Feature | Input Seeking (-ss before
-i) |
Output Seeking (-ss after
-i) |
|---|---|---|
| Processing Method | Jumps directly to the timestamp using file headers. | Decodes and discards all preceding frames. |
| Speed | Fast (milliseconds). | Slow (depends on timestamp depth). |
| CPU Usage | Minimal. | High. |
| Accuracy | Generally accurate, but can occasionally misalign on stream copies. | Exact frame accuracy. |
Which One Should You Use?
For most everyday tasks, input seeking (-ss
before -i) is the preferred method because of its
superior speed. It is especially critical when dealing with large
high-definition video files where decoding hours of footage just to
extract a clip is highly inefficient.
You should only opt for output seeking (-ss
after -i) if you require absolute frame-by-frame
precision, or if you are experiencing audio-video synchronization issues
at the beginning of your output clip when using input seeking.