import cv2
import time
import os
i=0
j=250
file1='./file1/'
f = os.listdir('./video')
for im in f:
print(im)
im='./video/'+im
cap = cv2.VideoCapture(im)
(grabbed, frame) = cap.read()
while grabbed:
(grabbed, frame) = cap.read()#获取每一帧
# if not grabbed:
# exit()
i+=1
if i%200==0:
name = file1+str(j).zfill(4)+'.jpg'
j+=1
cv2.imwrite(name,frame)
将多个视频放入视频文件夹video中,file1就是截图文件所在。