操作系統 : Windows 10 [版本 10.0.19043.1165]
Python 版本 : 3.9.2_x64
可以借助python代碼使用opencv實現,命令行示例代碼如下:
# python3
# pip install opencv-python numpy
import os,cv2
import numpy as np
def save_img(img,addr,num):
naddr = "%s/%d.jpg" % (addr,num)
ret = cv2.imwrite(naddr,img)
#print("ret :",ret)
return ret
srcFile = "./1.mp4"
dstDir = "./output"
if not os.path.isdir(dstDir):
os.mkdir(dstDir)
videoCapture = cv2.VideoCapture(srcFile)
isOK,frame = videoCapture.read()
i=0
while isOK :
i = i + 1
if not save_img(frame,dstDir,i) :
print("error occur!")
break
if (i+1)%100 == 1 : print('save img:',i)
isOK,frame = videoCapture.read()
也可以借助python的界面實現,具體代碼見共享的資源文件。
附圖:
文件列表:

命令行模式效果:

圖形模式效果:

提取效果:

本文涉及資源下載地址:https://pan.baidu.com/s/1xhBxGnc8akC3UH70CyIDdw
可關注微信公眾號(聊聊博文)后回復 2021101601 獲得提取碼。
