1# Python program to play a video
2# in reverse mode using opencv
3import cv2
4
5cap = cv2.VideoCapture("video_file_location")
6
7check , vid = cap.read()
8counter = 0
9check = True
10frame_list = []
11while(check == True):
12 check , vid = cap.read()
13 frame_list.append(vid)
14 counter += 1
15
16# last value in the frame_list is None, that's why we will pop it
17frame_list.pop()
18frame_list.reverse()
19
20for frame in frame_list:
21 cv2.imshow("Frame" , frame)
22 if cv2.waitKey(25) and 0xFF == ord("q"):
23 break
24
25cap.release()
26cv2.destroyAllWindows()