FFmpeg -ss weird behaviour

Viewed 5940

I've been using FFmpeg to extract single frames into an image. Though some Googling, it turns out that running:

ffmpeg.exe -i video.avi -ss 00:30:00 -y -an -vframes 1 test.png

...runs SIGNIFICANTLY slower than the following, which is nearly identical, but instantaneous:

ffmpeg.exe -ss 00:30:00 -i video.avi -y -an -vframes 1 test.png

The only difference is the order of -i and -ss. Is this an intentional 'feature'? Is there some sort of technical reason for the difference here?

4 Answers

wberry's answer is indeed a very educated one. Reading the documentation can help even further:

ā€˜-ss position (input/output)’

When used as an input option (before -i), seeks in this input file to position. When used as an output option (before an output filename), decodes but discards input until the timestamps reach position. This is slower, but more accurate.

(position may be either in seconds or in hh:mm:ss[.xxx] form.)

(as found in http://ffmpeg.org/ffmpeg.html#Main-options)

I'm currently writing an audio grabber application, and, as such, I'm using the slower but more accurate method. It is up to you to choose the best approach.

Related