Frame extractor from video
import cv2
import numpy as np
import math
cap= cv2.VideoCapture("vid.avi")
frameRate = cap.get(5) #frame rate
x=5050
while True:
frameId = cap.get(1)
_, frame =cap.read()
#uncomment if you want to rotate the frames
#frame=cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE)
if (frameId % (math.floor(frameRate)*5) == 0):
filename = 'images/mox' + str(int(x)) + ".jpg";x+=1
cv2.imwrite(filename, frame)
cap.release()
print ("Done!")