Creating screenshots with FFmpeg is slow?
Just a quick note for everyone who’s using FFmpeg for creating screenshots from video files. Today I noticed that FFmpeg can be VERY slow on large/long movie files, but there’s a pretty neat trick to speed up the screenshot generation.
I used to create my screenshots this way:
ffmpeg -i /var/www/input.mov -y -f image2 -ss 1234 -sameq -t 0.001 “/var/www/screenshot.jpg” 2>&1
and on huge files it sometimes took minutes. The solution is simple:
ffmpeg -ss 1234 -i /var/www/input.mov -y -f image2 -sameq -t 0.001 “/var/www/screenshot.jpg” 2>&1
Put the -ss parameter in front of the input file and FFmpeg skips to the selected frame almost instantly.
hf!
November 4th, 2010 at 03:41
Lol, this is really funny trick. Maybe you should write a bugreport?
December 23rd, 2010 at 12:36
ooh man, this was good to find out. ffmpeg was REALLLY slow before, with ss param as it was. such an improvement & so simple once u know. thanks for sharing
August 28th, 2011 at 23:50
Loving you. You saved me a LOT of CPU and time. You should file a bug, anyway.
February 10th, 2012 at 13:17
Its not a bug. The way ffmpeg work with parameter is:
-all_parameters_before_opening_a_file (eg: -f, -t, -ss) -i filename
The -ss after the -i parameters is use to seek the output file, not the input.
February 10th, 2012 at 13:19
@Rafael, thanks for pointing this out!