Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFmpeg -ss weird behaviour

Tags:

video

ffmpeg

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?

like image 510
Enigmaster Avatar asked Aug 08 '11 15:08

Enigmaster


1 Answers

This is an educated guess. When -ss occurs before -i, it is treated as instructions for the input, so the first frame of the video stream is the one at 30 seconds. When -ss occurs after -i, it is treated as an effect, and the first 30 seconds of frames are read and dropped, leading to a performance difference.

like image 135
wberry Avatar answered Sep 30 '22 18:09

wberry