这是我的视频
这是查找fps的脚本:
import cv2
if __name__ == '__main__' :
video = cv2.VideoCapture("test.mp4");
# Find OpenCV version
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')
if int(major_ver) < 3 :
fps = video.get(cv2.cv.CV_CAP_PROP_FPS)
print "Frames per second using video.get(cv2.cv.CV_CAP_PROP_FPS): {0}".format(fps)
else :
fps = video.get(cv2.CAP_PROP_FPS)
print "Frames per second using video.get(cv2.CAP_PROP_FPS) : {0}".format(fps)
video.release();
这是此视频脚本的输出:Frames per second using video.get(cv2.CAP_PROP_FPS) : 0.0
为什么它返回0.0? FPS是14.0
执行pip install python-opencv
修复了问题并正确检测到FPS。