Extraire une image d’une vidéo toutes les n secondes
How to extract one frame of a video every N seconds to an image?
▻https://superuser.com/questions/135117/how-to-extract-one-frame-of-a-video-every-n-seconds-to-an-image
Ok so now we know how to export the movie as a sequence of images, but say we don’t want to export every single frame?
The trick is to simply change the frame rate of the output to whatever we want using the -r n
option where n
is the number of frames per second. 1 frame per second would be -r 1
, one frame every four seconds would be -r 0.25
, one frame every ten seconds would be -r 0.1
and so on.
So to put it all together, this is how it would look to save one frame of input.mov every four seconds to output_0000.png
, output_0001.png
, etc.:
ffmpeg -i input.mov -r 0.25 output_%04d.png
Note that the -r 0.25
option goes after the -i input.mov
part, because it’s controlling the frame rate of the output. If you put it before the input it would treat the input file as if it had the specified frame rate.