Skip to content

Converting Videos to Images

Kian Gorgichuk edited this page Jun 17, 2020 · 2 revisions

Description

The purpose of this command is to convert a video file into a set of images so they can be used in our machine learning models. This is done using the ffmpeg utility.

Requirements:

  • ffmpeg (available for macOS, Windows, and Linux)

Command:

ffmpeg -ss 00:00:00 -i INPUT.mp4 -t 00:01:00 -r 1 -qscale:v 2 output_00%d.jpeg

Configurable values:

  • -ss 00:00:00: the timestamp in the video to start capturing images. Default is at the start of the video.
  • -i INPUT.mp4: input video filename
  • -t 00:01:00: the timestamp in the video to stop capturing images. Note this property is optional.
  • -r 1: frequency of images to be extracted from movie. Default is 1 image per second.
  • -qscale:v 2: the quality of the images. Do not change.
  • output_00%d.jpeg: the format of the output images where %d is an increasing integer value. Note do not change the image file format to png as the file size of images will increase to ~2MB per image.
Clone this wiki locally