How can I convert a video file to a sequence of images, for example one frame every N seconds. Can mplayer or ffmpeg do this? I have used MPlayer to grab screenshots manually but I would like to automate this for a long video.
It's very simple with ffmpeg, and it can output one frame every N seconds without extra scripting. To export as an image sequence just use
Ok so to export as an image sequence we can use an image format as the output with a sequential filename, but we don't want to export every single frame. So simply change the frame rate of the output to whatever we want using the
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.:
Change the %xd to however many digits you need, e.g. if the command would create more than 10,000 frames change the
On the command line use
In CMD and BAT Scripts use
Don't use just one
will save a frame as a jpeg file every 5 seconds.
However, it will not stop at the end of the file, it will continue producing copies of the last frame. To avoid this, find the duration of the video in seconds, using another player, or with mplayer:
and look for a line like "ID_LENGTH=147.00".
Subtract 2 from the length, and use this value for the
This command generates a 320×240 sized JPG thumbnail at the 4th second in the video. Put this in a script that changes the time and file name and you're done.
With VLC 1.1.0 and above, you can use the scene video filter:
The above saves 1 out of every 24 frames (--scene-ratio=24), starting at 00:00:10 and ending at 00:00:11.
Just tested and confirmed this works with VLC 2.0.3 on a fresh Windows 8 installation (I have no additional video plugins or software).
Full documentation: http://wiki.videolan.org/How_to_create_thumbnails
If you are after a kind of contact sheet and if you are working with a Unix-like OS, you can use this elaborate script, called to the point Video Contact Sheet *NIX, short vcs.
In the background it also uses
For a interval of 10 minutes, the invocation is like that:
Check the full list of commandline options for some other tweaks.
Here is an example contact sheet, taken from the homepage:
You could also try this
You can skip frames in VirtualDub. Just use "Decimate By" option located at Video -> Frame Rate menu. For example if you set "Decimate By 100" then use File -> Export -> Image sequence, it will save only every 100th frame.
You must log in to answer this question.
protected by slhck Nov 20 '14 at 19:12
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?