Examples
The following example shows how to use ffmpeg for creating a sequence of files 'img-001.jpeg', 'img-002.jpeg', ..., taking one image every second from the input video:
ffmpeg -i in.avi -vsync cfr -r 1 -f image2 'img-%03d.jpeg'
Note that with ffmpeg, if the format is not specified with the -f option and the output filename specifies an image file format, the image2 muxer is automatically selected, so the previous command can be written as:
ffmpeg -i in.avi -vsync cfr -r 1 'img-%03d.jpeg'
Note also that the pattern must not necessarily contain "%d" or "%0Nd", for example to create a single image file 'img.jpeg' from the start of the input video you can employ the command:
ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
The 'strftime' option allows you to expand the filename with date and time information. Check the documentation of the strftime() function for the syntax.
For example to generate image files from the strftime() "%Y-%m-%d_%H-%M-%S" pattern, the following ffmpeg command can be used:
ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg"
You can set the file name with current frame's PTS:
ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg"