我已编写此代码,该代码在特定时间从视频中读取帧。我已提供下面的数据集。我能够读取帧直到580843 ms。在上面,我得到'ret'的假值。我的视频长度是1154000毫秒。 ms =毫秒。如果有人能够确定为什么会这样发生,我将不胜感激。同样的解决方案。 在此先感谢!!!
数据集140033,191001,228283,245265,270808,286592,293878,310243,352469,375504,397433,410997,431035,439021,456558,469285,477976,489867,496843,513780,520805,528651,536385 580843,617097,630329,652290,660603,667891,676055,689438,734821,775232,789900,800481,811521,817390,824388,849925,866860,873889,908463,945620,952115,966052,973513,988208,1002409, 1050239,1067801,1089931
import cv2
import numpy as np
frame_no
cap = cv2.VideoCapture('1.avi')
fps =cap.get(5)
frame_count=cap.get(7)
frame_no = 1089000
cap.set(0,frame_no);
ret, frame = cap.read()
cv2.waitKey()
cv2.imwrite("par1-" + ".jpg",frame)
print ret
print frame_no
cap.release()
cv2.destroyAllWindows()