import cv2
import numpy as np

cap = cv2.VideoCapture('./inputs/testroad.mp4')

if cap.isOpened() == False:
    print("Error opening video stream or file")

count = 0
while(cap.isOpened()):
    ret, frame = cap.read()
    if ret == True:
        cv2.imshow('Frame', frame)
        cv2.imwrite("cap/frame%d.jpg" % count, frame)     # save frame as JPEG file
        count += 1
        if cv2.waitKey(25) & 0xFF == ord('q'):
            break
    else:
        break
cap.release()
