介绍
本文主要介绍如何在chrome浏览器中播放海康、大华、宇视的h264/h265的rtsp码流
要求
- 支持rtsp的h264 h265码流
- 支持海康、大华、宇视 IPC
- 低延时 500ms之内
技术细节
- onvif 获取rtsp 地址
- ffmpeg 将rtsp转为rtmp
- nginx or srs 作为流媒体中间件
- xxxplayer.js 作为h264 /h265 播放器
onvif获取rtsp地址
通过onvif协议获取rtsp地址的方法很多,我使用的方法是用python的onvif2-zeep。
流格式
chrome对于http-flv支持的比较简单,当然也可以通过ws来支持rtsp,但还是http-flv方法更通用。
通过ffmepg将rtsp转为rtmp
流媒体服务器
流媒体服务器推荐使用srs,支持http-flv
js播放器
- jussibuca/nodeplayer 都可以,如果要好的效果建议购买商业版。