Playing Video From File Video playback from file is similar to capturing video from camera. For this operation, only the video file name and the camera directory should be changed. Also, cv2.waitKey () is used when viewing the frame. capture = cv2.VideoCapture( 'testvideo.avi' ) while (capture.isOpened()): ret , frame = capture.read() cv2.imshow( 'frame' , frame) if cv2.waitKey( 1 ) & 0xFF == ord ( 'e' ): break capture.release() cv2.destroyAllWindows()