The following are the steps for this recipe:
- Create a VideoCapture object for video file:
import cv2capture = cv2.VideoCapture('../data/drop.avi')
- Replay all the frames in the video:
while True: has_frame, frame = capture.read() if not has_frame: print('Reached the end of the video') break cv2.imshow('frame', frame) key = cv2.waitKey(50) if key == 27: print('Pressed Esc') breakcv2.destroyAllWindows()