Extracting images from video in 1 minute intervals

0

1

I would like to extract images from a video Exp01.avi, the video is 24fps and 25 minutes long. I want the images to be extracted from the video after every 1 minute interval. Please someone tell me how to do that.

I have tried these commands, but did not help:

ffmpeg -i video.avi -r 1  -t 00:01:00 -f image image%02d.png

and

ffmpeg -i video.avi -r 1/1440 -f image image%02d.png

parmeshwar89

Posted 2013-02-25T08:40:45.483

Reputation: 1

Answers

2

I would use the select filter. The following will take one image every 1440 frames, which is every 1 minute at 24 frames per second - so change this depending on the frame rate of your input video:

ffmpeg -i input.file -filter:v 'select=not(mod(n\,1440))' image%02d.png

To use time-based selection (note that this will probably include the very first frame):

ffmpeg -i input.file -filter:v 'select=isnan(prev_selected_t)+gte(t-prev_selected_t\,60),setpts=N/(24*TB)' image%02d.png

See the select and setpts filter documentation for more info.

evilsoup

Posted 2013-02-25T08:40:45.483

Reputation: 10 085

Personally, the time-based selection example above gives me:[image2 @ 0000000005350680] Could not get frame filename number 2 from pattern 'image.png' (either set updatefirst or use a pattern like %03d within the filename pattern) ..... And I've tried escaping the % in many ways, since it is special to windows command line. No go. Using a 2015 ffmpeg for windows. First solution didn't work either. – ClioCJS – 2015-10-18T22:55:31.540

It is not working, it says: Unrecognized option 'filter:v' Failed to set value 'select=not(mod(n,1440))' for option 'filter:v'. and If I change -filter:v to -vf then, it starts extracting large number of images, but definitely not after 1min interval images. – parmeshwar89 – 2013-02-26T08:04:52.357

sorry, -vf option is I think for number of frames. – parmeshwar89 – 2013-02-26T08:23:04.703

@parmeshwar89 Please include your full command and the complete console output and add this new info by editing your answer (some people try to cram it all into comments). Your ffmpeg version is probably too old, or your using the fake ffmpeg from Ubuntu, but this is unknown without the complete ffmpeg console output.

– llogan – 2013-02-26T18:47:06.937

Thank you very much. I am just leaving this comment in order to inform that this also works pretty fine for .VOB files directly on a DVD. What I did is to cd into the DVD VIDEO_TS Folder, then use the name of the .VOB file (VTS_01_1.VOB) and declare an absolute path for the images destination. It is like avconv -i ./VTS_01_1.VOB -filter:v 'select=not(mod(n\,1440))' /home/geppettvs/Downloads/Temp/image%02d.png – Geppettvs D'Constanzo – 2013-10-18T18:51:23.493