I believe there is a possible error with this code because it saves more images than it should when I calculate (fps * seconds). It also saves a NULL image at the end. I feel like this is the most basic code to save images and I'm not sure what the error could be.
Also, I'd like an option to specify at which fps rate I'd take the images. The fps I would like the use the most is 1 fps. I couldn't find a feature in opencv that allows us to specify this, so I was considering taking the approach of somehow saving a frame at each second. Another approach could be saving all the frames, but iterating through and using the frame at each second. I'm fairly new at these concepts. Are these approaches good, and how should I begin coding them? I'm not sure where to begin.
def extractFrames():
vidcap = cv2.VideoCapture('video.AVI')
success,image = vidcap.read()
count = 0;
while success:
success,image = vidcap.read()
cv2.imwrite("%d.jpg" % count, image)
count += 1