I often find myself needing to convert video to a series of images. It’s a great way to look through the content to find some details or identify screenshots that are worth keeping. For example I used this method to look through all talks given at Chrome Dev Summit to supplement my notes. Another use case was converting an HD footage of my son’s birthday to a series of images to print.
The command line tool I use is called ffmpeg. You can download it form the official site, but it’s also available via Homeberew on Mac with
brew install ffmpeg command (that is how I have it installed).
Once you have
ffmpeg on your system, you can convert your video to images via the following:
# cd to folder with video file
mkdir photos # Photos will be stored here
ffmpeg -i your-video-file.mp4 -r 1 photos/output_%05d.png
Code language: PHP (php)
-i your-video-file.mp4 points to the file that you are trying to convert.
-r 1 parameter means frame rate, i.e. how many frames per second. In case of
r 1 it will produce 1 photo per second. If more picture is needed,
-r 10 which will produce 10 photos per second, if less
r 0.1 will produce 1 photo for every 10 seconds etc.
photos/output_%05d.png specified that files should be saved into
photos directory, and named in the format
After the conversion is done, I usually open photo files in Preview App (on Mac), where I go through the images one by one, deleting what I don’t need. This leaves me with the needed collection of screenshots.