网络编程
位置:首页>> 网络编程>> Python编程>> python opencv读mp4视频的实例

python opencv读mp4视频的实例

作者:白话先生  发布时间:2022-04-13 00:32:11 

标签:python,opencv,mp4

如下所示:


#获得视频的格式
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()

来源:https://blog.csdn.net/liuweizj12/article/details/80235065

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com