python处理RSTP视频流过程解析
作者:前方、有光 时间:2023-11-22 00:54:55
这篇文章主要介绍了python处理RSTP视频流过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
python链接海康摄像头,并以弹出框的方式播放实时视频流,
这种方式是以弹出框的形式播放。本地测试可以,实际业务场景不建议使用。可以采用rtsp转rtmp的方式
@shared_task
def parse_video(rtsp_address=None):
winname = 'Video'
if not rtsp_address:
raise exceptions.ParseError('摄像头rstp地址错误!')
cap = cv2.VideoCapture(rtsp_address)
if not cap.isOpened():
raise exceptions.ParseError('视频播放失败!')
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
cv2.putText(frame, 'Please press "ESC" to close the window', (900, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (55, 255, 155), 1)
cv2.imshow(winname, frame)
k = cv2.waitKey(1)
if cv2.getWindowProperty(winname, cv2.WND_PROP_AUTOSIZE) < 1:
break
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
来源:https://www.cnblogs.com/52-qq/p/11803463.html
标签:python,RSTP,视频,流
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
IE9一个非常牛的“bug”
2010-05-07 12:45:00
Go语言面试题之select和channel的用法
2024-04-26 17:27:39
![](https://img.aspxhome.com/file/2023/1/134081_0s.png)
Python并发之多进程的方法实例代码
2022-04-13 12:43:54
如何在事件代理中正确使用 focus 和 blur 事件
2010-01-30 12:51:00
python实现获取当前设备的地点位置
2022-02-11 05:30:59
![](https://img.aspxhome.com/file/2023/7/102987_0s.png)
基于事件冒泡、事件捕获和事件委托详解
2024-04-28 09:43:33
![](https://img.aspxhome.com/file/2023/2/132812_0s.jpg)
详解利用Pytorch实现ResNet网络之评估训练模型
2023-06-13 16:23:24
Python脚本完成post接口测试的实例
2022-01-01 15:40:22
![](https://img.aspxhome.com/file/2023/2/112582_0s.jpg)
Python字典底层实现原理详解
2021-04-09 12:58:28
Go 语言结构体链表的基本操作
2024-02-07 18:51:11
![](https://img.aspxhome.com/file/2023/4/101044_0s.png)
django model通过字典更新数据实例
2021-08-15 13:00:15
Java使用正则表达式验证手机号和电话号码的方法
2023-11-20 08:07:12
python3.5 email实现发送邮件功能
2023-06-14 15:58:59
一些你可能不熟悉的JS知识点总结
2024-04-17 09:46:24
python函数的重新定义及练习
2023-10-12 22:47:55
![](https://img.aspxhome.com/file/2023/8/63528_0s.png)
golang gorm开发架构及写插件示例
2024-04-25 13:19:00
数据库性能优化一:数据库自身优化提升性能
2024-01-24 04:02:07
![](https://img.aspxhome.com/file/2023/4/94464_0s.png)
巧用Javascript的逻辑运算符
2024-04-16 09:47:42
Python生成随机MAC地址
2023-04-09 18:05:57
pytorch Variable与Tensor合并后 requires_grad()默认与修改方式
2021-08-05 09:11:59