LiveNVR获取通道视频直播流地址 RTSP/WebRTC/RTMP/HLS/HTTP-FLV/WS-FLV
- 1、 Onvif/RTSP等直播流拉转服务
- 2、配置拉转直播流
- 3、接口获取视频流地址
- 4、浏览器F12查看播放地址
- 5、播放页面快速集成
- 6、JS接口调用示例
1、 Onvif/RTSP等直播流拉转服务
可接入传统监控行业里面的高清网络摄像机的RTSP直播流,及 RTMP、HTTP-FLV、M3U8等其它直播流,实现互联网直播分发;可分发多种格式流,支持GB28181注册级联到第三方国标平台;同时能实时云端存储、录像计划、检索、时移回放
LiveNVR Onvif/RTSP流媒体服务,支持RTSP等其它流拉流接入,支持Onvif协议接入,支持RTMP/HLS/HTTP-FLV/WS-FLV/RTSP/GB28181输出,将传统安防监控设备互联化,无插件直播等。
2、配置拉转直播流
2.1 RTSP获取配置规则
Onvif/RTSP流媒体安防RTSP无插件直播方案及RTSP配置规则
2.2 编辑通道配置
3、接口获取视频流地址
3.1、接口服务地址说明
http://192.168.2.135:10800 是示例的ip及端口,更换成自己部署的LiveNVR的ip及端口
3.2、获取通道直播链接接口
3.3、获取HTTP-FLV播放地址示例
3.3.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=flv
3.3.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"
}
}
}
3.4、获取WS-FLV播放地址示例
3.4.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=ws-flv
3.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": "ws://192.168.2.135:10800/ws-flv/hls/stream_1.flv"
}
}
}
3.5、获取WebRTC播放地址示例
3.5.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=webrtc
3.5.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"
}
}
}
3.6、获取RTMP播放地址示例
3.6.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=rtmp
3.6.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"
}
}
}
3.7、获取HLS播放地址示例
3.7.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=hls
3.7.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"
}
}
}
3.8、RTSP
3.8.1、开启RTSP
RTSP输出,默认是关闭的,开启需要在基础配置界面配置 RTSP端口(默认554),需要在服务器上开放此端口 TCP
3.8.2、获取RTSP播放地址示例
3.8.2.1、接口调用示例
http://192.168.2.135:10800/api/v1/getchannelstream?channel=1&protocol=rtsp
3.8.2.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"
}
}
}
4、浏览器F12查看播放地址
5、播放页面快速集成
为方便客户在网页中集成播放功能, 我们单独提供了可供 HTML iframe 集成的分享页 详见, 形如:
http://ip:port/play.html?channel=xx
其中 URL 参数:
-
channel 通道号
-
aspect 配置只显示视频播放区域, 同时指定宽高比, 可选, wxh, 例如 640x360, 即16:9, 当 aspect=fullscreen 时, 整页显示播放器
-
share 是否显示分享, 可选, yes/no, 默认值为 yes
-
fluent 是否以流畅模式播放, 可选, yes/no, 默认值为 yes
-
autoplay 是否自动播放, 可选, yes/no, 默认值为 yes
-
controls 是否显示播放器控制栏, 可选, yes/no, 默认值为 yes
-
stretch 是否拉伸显示, 可选, yes/no, 默认值为 no
-
muted 是否播放器静音, 可选, yes/no, 默认值为 yes
-
protocol 播放流格式, 可选, rtmp/hls/flv/ws_flv, 默认 auto check
6、JS接口调用示例
LiveNVROnvif|RTSP流媒体服务中二次开发接口jquery调用示例