首先安装
pip install opencv-python -i https://pypi.douban.com/simple/
code
import cv2 vidcap = cv2.VideoCapture('%93%81%E7%BB%8F%E7%90%86.mp4') success,image = vidcap.read() n=1 while n < 30: success, image = vidcap.read() n+=1 imag = cv2.imwrite('fdfd2.jpg',image) if imag ==True: print('ok')