1 import cv2
2 import sys
3
4 path = 'D:\jiji_download\花花世界迷人眼❀波喵一花依世界'
5 video_filename = '1.❀波喵❀(Av926216547,P1).mp4'
6 vc = cv2.VideoCapture(path + '\\' + video_filename)
7
8 ret_val = None
9 if vc.isOpened():
10 ret_val = True
11 print("Open video succeed...")
12 else:
13 ret_val = False
14 print("Open video failed...")
15
16 timeF = 200
17 c = 1
18 while ret_val:
19 ret_val, frame = vc.read()
20 if c % timeF == 0:
21 if not cv2.imwrite(path + '\\' + str(c) + '.jpg', frame):
22 print("Write image failed, please check the image path whether is ok...")
23 sys.exit(1)
24 c = c + 1
25 vc.release()