Today I Learned: Capturing Frames from Video Files

Monday August 6, 2018 at 07:03 pm CDT

First head over here to download FFMPEG. if you happen to be a Mac user, you can use Homebrew:

brew install ffmpeg

I would check out the Homebrew page for all of the options available (of which, there are quite a few).

To extract frames from a video file, you use the following command:

ffmpeg -i my_vid.webm -r 10 -frames:v 30 -f image2 foo-%03d.jpeg

The above command extracts 10 frames per second and saves them as jpeg files with names ‘foo-001.jpeg’, ‘foo-002.jpeg’, and so on. The maximum number of images that will be created is 30. image2 refers to the demuxer used.

You can read more about this in the documentation.

Photo by Jonny Caspari on Unsplash