我想从输入的视频中获取特定时间间隔的帧,所以建议我任何对我有帮助的解决方案。告诉我如何在以下代码中设置时间限制。
import cv2
vidcap = cv2.VideoCapture('baahubali2.mp4')
vidcap.set(cv2.CAP_PROP_POS_MSEC,1000)
success, image = vidcap.read()
count = 0
success = True
while success:
success, image = vidcap.read()
print('Read a new frame: ', success)
cv2.imwrite("/home/kapil/Documents/major/image/frame%d.jpg" % count, image)
count += 1