如下所示:
#获得视频的格式 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()
以上这篇python opencv读mp4视频的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
PAT 甲级真题 1006 Sign In and Sign Out (25分) python实现
OpenCV计算机视觉实战(Python)| 03、阈值与平滑处理
网友评论