This file can be run from the command line as:
python ImagesFromVideo.py [options]
Here the [options]
are:
--input_file
: The full path to input video file from which one or more frames need to be captured and saved as images.--start_time
: The position in seconds on the video track. This will be the starting position from which one or more video frames will be captured as still image(s). The first snapshot will always be atstart_time
.--duration
: The duration (in seconds) of the video track starting from thestart_time
. 'N' number of frames will be captured starting from thestart_time
.--num_of_captures
: Total number of frames that need to be captured fromstart_time
(including it) up to,end_time= start_time + duration
(but not including the still image atend_time
).
If not already done, download the file
ImagesFromVideo.py
from the Packt website. Following is an outline of the code for saving video frames.import os, sys, time import thread...