本文主要是介绍如何或者无插件Web页面监控播放软件LiveNVR的固定视频流地址,实现大屏上墙、播放、视频分析等目的,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、LiveNVR介绍
LiveNVR的安防监控的视频直播,可以按标准的Onvif/RTSP协议接入监控设备,也可以通过海康、大华、天地伟业等厂家私有SDK接入监控,实现web页面的播放和录像回放。 可以分发HTTP-FLV、WS-FLV、WebRTC、RTMP、HLS(M3U8)、RTSP等多中视频流
2、三种方法获取LiveNVR直播流地址获取
2.1、方法一、HTTP接口获取
2.1.1、接口说明
http://192.168.2.135:10800 是示例的ip及端口,更换成自己部署的LiveNVR的ip及端口
通道相关 - 获取通道直播链接
2.1.2、获取HTTP-FLV流地址
2.1.2.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=flv
2.1.2.2、接口返回示例
获取接口返回的,URL字段,前面拼接上服务的ip和端口
{"LiveQing": {"Header": {"CSeq": "1","Version": "v1","MessageType": "MSG_SC_SERVER_GET_CHANNEL_STREAM_ACK","ErrorNum": "200","ErrorString": "Success OK"},"Body": {"AudioEnable": false,"ChannelName": "拉取 FLV","DeviceType": "FLV","NumOutputs": 0,"OSD": "拉取 FLV","Ondemand": true,"Recording": false,"SnapURL": "/snap/channel_1.jpg?t=1615518655678277862","SourceAudioCodecName": "aac","SourceAudioSampleRate": 8000,"SourceVideoCodecName": "h264","SourceVideoFrameRate": 25,"SourceVideoHeight": 576,"SourceVideoWidth": 704,"URL": "/flv/hls/stream_1.flv"}}
}
2.1.3、获取WS-FLV流地址
2.1.3.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=ws-flv
2.1.3.2、接口返回示例
获取接口返回的,URL字段
{"LiveQing": {"Header": {"CSeq": "1","Version": "v1","MessageType": "MSG_SC_SERVER_GET_CHANNEL_STREAM_ACK","ErrorNum": "200","ErrorString": "Success OK"},"Body": {"AudioEnable": false,"ChannelName": "拉取 FLV","DeviceType": "FLV","NumOutputs": 1,"OSD": "拉取 FLV","Ondemand": true,"Recording": false,"SnapURL": "/snap/channel_1.jpg?t=1615519865764505509","SourceAudioCodecName": "aac","SourceAudioSampleRate": 8000,"SourceVideoCodecName": "h264","SourceVideoFrameRate": 25,"SourceVideoHeight": 576,"SourceVideoWidth": 704,"URL": "ws://192.168.2.135:10800/ws-flv/hls/stream_1.flv"}}
}
2.1.4、获取WebRTC流地址
2.1.4.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=webrtc
2.1.4.2、接口返回示例
获取接口返回的,URL字段
{"LiveQing": {"Header": {"CSeq": "1","Version": "v1","MessageType": "MSG_SC_SERVER_GET_CHANNEL_STREAM_ACK","ErrorNum": "200","ErrorString": "Success OK"},"Body": {"AudioEnable": false,"ChannelName": "拉取 FLV","DeviceType": "FLV","NumOutputs": 1,"OSD": "拉取 FLV","Ondemand": true,"Recording": false,"SnapURL": "/snap/channel_1.jpg?t=1615519865764505509","SourceAudioCodecName": "aac","SourceAudioSampleRate": 8000,"SourceVideoCodecName": "h264","SourceVideoFrameRate": 25,"SourceVideoHeight": 576,"SourceVideoWidth": 704,"URL": "webrtc://192.168.2.135:10800/rtc/stream_1"}}
}
2.1.5、获取RTMP流地址
2.1.5.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=rtmp
2.1.5.2、接口返回示例
获取接口返回的,URL字段,服务需要开启对应的rtmp端口 TCP
{"LiveQing": {"Header": {"CSeq": "1","Version": "v1","MessageType": "MSG_SC_SERVER_GET_CHANNEL_STREAM_ACK","ErrorNum": "200","ErrorString": "Success OK"},"Body": {"AudioEnable": false,"ChannelName": "拉取 FLV","DeviceType": "FLV","NumOutputs": 1,"OSD": "拉取 FLV","Ondemand": true,"Recording": false,"SnapURL": "/snap/channel_1.jpg?t=1615519865764505509","SourceAudioCodecName": "aac","SourceAudioSampleRate": 8000,"SourceVideoCodecName": "h264","SourceVideoFrameRate": 25,"SourceVideoHeight": 576,"SourceVideoWidth": 704,"URL": "rtmp://192.168.2.135:10935/hls/stream_1"}}
}
2.1.6、获取HLS流地址
2.1.6.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=hls
2.1.6.2、接口返回示例
获取接口返回的,URL字段,前面拼接上服务的ip和端口
{"LiveQing": {"Header": {"CSeq": "1","Version": "v1","MessageType": "MSG_SC_SERVER_GET_CHANNEL_STREAM_ACK","ErrorNum": "200","ErrorString": "Success OK"},"Body": {"AudioEnable": false,"ChannelName": "拉取 FLV","DeviceType": "FLV","NumOutputs": 1,"OSD": "拉取 FLV","Ondemand": true,"Recording": false,"SnapURL": "/snap/channel_1.jpg?t=1615519865764505509","SourceAudioCodecName": "aac","SourceAudioSampleRate": 8000,"SourceVideoCodecName": "h264","SourceVideoFrameRate": 25,"SourceVideoHeight": 576,"SourceVideoWidth": 704,"URL": "/hls/stream_1/stream_1_live.m3u8"}}
}
2.1.7、RTSP
2.1.7.1、开启RTSP
RTSP输出,默认是关闭的,开启需要在基础配置界面配置 RTSP端口(默认554),需要在服务器上开放此端口 TCP
2.1.7.2、获取RTSP流地址
2.1.7.2.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=rtsp
2.1.7.2、接口返回示例
获取接口返回的,URL字段
{"LiveQing": {"Header": {"CSeq": "1","Version": "v1","MessageType": "MSG_SC_SERVER_GET_CHANNEL_STREAM_ACK","ErrorNum": "200","ErrorString": "Success OK"},"Body": {"AudioEnable": false,"ChannelName": "拉取 FLV","DeviceType": "FLV","NumOutputs": 1,"OSD": "拉取 FLV","Ondemand": true,"Recording": false,"SnapURL": "/snap/channel_1.jpg?t=1615519865764505509","SourceAudioCodecName": "aac","SourceAudioSampleRate": 8000,"SourceVideoCodecName": "h264","SourceVideoFrameRate": 25,"SourceVideoHeight": 576,"SourceVideoWidth": 704,"URL": "rtsp://192.168.2.135:554/stream_3"}}
}
2.2、方法二浏览器F12查看播放地址
2.3、方法三安固定格式拼接
不调用开始直播可以获取播放地址吗?可以的,LiveNVR支持流地址播放直接启动通道拉流,配置规则如下:
2.3.1、HTTP端口直播流地址格式
-
WEBRTC: webrtc://{ip}:{port}/rtc/stream_{通道号}
-
FLV: http://{ip}:{port}/flv/hls/stream_{通道号}.flv
-
WS_FLV: ws://{ip}:{port}/ws-flv/hls/stream_{通道号}.flv
-
HLS: http://{ip}:{port}/hls/stream_{通道号}/stream_{通道号}_live.m3u8
-
RTMP: rtmp://{ip}:{port}/hls/stream_{通道号}
-
RTSP: rtsp://{ip}:{port}/stream_{通道号}
2.3.2、HTTPS端口直播流地址格式
-
WEBRTC: webrtc://{ip}:{port}/rtc/stream_{通道号}
-
FLV: http://{ip}:{port}/flv/hls/stream_{通道号}.flv
-
WS_FLV: ws://{ip}:{port}/ws-flv/hls/stream_{通道号}.flv
-
HLS: http://{ip}:{port}/hls/stream_{通道号}/stream_{通道号}_live.m3u8
-
RTMP: rtmp://{ip}:{port}/hls/stream_{通道号}
-
RTSP: rtsp://{ip}:{port}/stream_{通道号}
2.3.3、关闭静态流地址播放
livenvr.ini ->[base_config]->allow_stream_start_by_url=0 , 默认是开启此功能的,配置后重启LiveNVR服务
[base_config]
allow_stream_start_by_url=0
3、RTSP/HLS/FLV/RTMP拉流Onvif流媒体服务
- 支持 Windows Linux 及其它CPU架构(国产、嵌入式…)操作系统
- 安装包下载 、 安装使用说明
- 更多常见问题
这篇关于如何或者无插件Web页面监控播放软件LiveNVR的固定视频流地址,实现大屏上墙、播放、视频分析等目的的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!