python opencv读mp4视频的实例
时间:2021-03-02 11:47:17|栏目:Python代码|点击: 次
如下所示:
#获得视频的格式
videoCapture = cv2.VideoCapture('/home/lw/3661.mp4')
#获得码率及尺寸
fps = videoCapture.get(cv2.CAP_PROP_FPS)
size = (int(videoCapture.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(videoCapture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
fNUMS = videoCapture.get(cv2.CAP_PROP_FRAME_COUNT)
#读帧
success, frame = videoCapture.read()
while success :
cv2.imshow('windows', frame) #显示
cv2.waitKey(1000/int(fps)) #延迟
success, frame = videoCapture.read() #获取下一帧
videoCapture.release()
上一篇:最新PyCharm从安装到PyCharm永久激活再到PyCharm官方中文汉化详细教程
栏 目:Python代码
下一篇:python中类的一些方法分析
本文地址:http://www.codeinn.net/misctech/72852.html






