海康威视RTSP
1、参考:https://blog.csdn.net/Night_MFC/article/details/104193965
https://blog.csdn.net/wcghhk/article/details/86555086
https://cloud.tencent.com/developer/article/1512001
2、视频流与复合流参考:https://zhidao.baidu.com/question/60450633.html
3、主码流与子码流:https://blog.csdn.net/yxwmzouzou/article/details/52367635
4、通过以下配置可以看到视频编码是H.264
5、网络端口
6、通道配置
7、使用这种格式,报错
rtsp://[username]:[password]@[ip]:[port]/[codec]/[channel]/[subtype]/av_stream
codec是上面的H264
rtsp://admin:111111@192.168.1.2:554/h264/ch1/main/av_stream
8、改为新格式,成功
rtsp://username:password@
:101,表示1号通道(摄像头1)的(1)主码流
rtsp://admin:111111@192.168.1.2:554/Streaming/Channels/101
9、注意:一个通道就是一个摄像头。IP不是摄像头的IP,而是硬盘录像机的IP, 用户名和密码也同理,否则访问不了,毕竟直接访问摄像头,一没有缓冲,二也不能作转发。
10、在网页上插入视频
参考:https://www.cnblogs.com/zyxiaohuihui/p/10303771.html
https://blog.csdn.net/yanmuchen/article/details/98207002
11、注意配置strUrl时,不能把用户名和密码加去,即不能用:rtsp://admin:111111@192.168.1.2:554/Streaming/Channels/101
而是分开,否则启动h5ss.bat服务后,会报401的错误。
"src": [
{
"strNameComment": "name for this stream",
"strName": "Stream 1",
"strTokenComment": "token for this stream, must unique, if same, only first will be available",
"strToken": "token1",
"nTypeComment": "source type H5_FILE/H5_STREAM/H5_ONVIF",
"nType": "H5_STREAM",
"strUrlComment": "url(RTSP/RTMP...) or file path",
"strUrl": "rtsp://192.168.1.2:554/Streaming/Channels/102",
"strUserComment": "username",
"strUser": "admin",
"strPasswdComment": "password",
"strPasswd": "111111",
"bPasswdEncryptComment": "Password Encrypted",
"bPasswdEncrypt": false,
"bEnableAudioComment": "Enable Audio",
"bEnableAudio": false,
"nConnectTypeComment": "H5_ONDEMAND/H5_ALWAYS/H5_AUTO",
"nConnectType": "H5_AUTO",
"nRTSPTypeComment": "RTSP Connect protocol H5_RTSP_TCP/H5_RTSP_UDP/H5_RTSP_HTTP/H5_RTSP_HTTPS/H5_RTSP_AUTO",
"nRTSPType": "H5_RTSP_AUTO",
"strSrcIpAddressComment": "Ip Address for the device",
"strSrcIpAddress": "192.168.0.1",
"strSrcPortComment": "Port for the device",
"strSrcPort": "80",
"nChannelNumberComment": "Channel number (1-512)",
"nChannelNumber": 1,
"bOnvifProfileAutoComment": "ONVIF Auto select the video profile",
"bOnvifProfileAuto": true,
"strOnvifAddrComment": "ONVIF address (/onvif/device_service)",
"strOnvifAddr": "/onvif/device_service",
"strOnvifProfileMainComment": "ONVIF Main stream profile name",
"strOnvifProfileMain": "Profile_1",
"strOnvifProfileSubComment": "ONVIF Sub stream profile name",
"strOnvifProfileSub": "Profile_2",
"bRTSPPlaybackComment": "RTSP playback source",
"bRTSPPlayback": false,
"nRTSPPlaybackSpeedComment": "RTSP playback speed",
"nRTSPPlaybackSpeed": 1
},
12、最后的效果
13、安装后可能报错:因为计算机中丢失 VCRUNTIME140.dll。安装vcredist_x64.2017 VCRUNTIME120.dll。安装vcredist_x64.2013
14、插入mp4文件,注意strUrl中是"D:/7.mp4",不能是"D:\7.mp4",另外测试时mp4不要选太大,下个一两百M的。
"strToken": "token1",
"nTypeComment": "source type H5_FILE/H5_STREAM/H5_ONVIF",
"nType": "H5_FILE",
"strUrlComment": "url(RTSP/RTMP...) or file path",
"strUrl": "D:/7.mp4",
15、获取历史视频,参考:https://bbs.csdn.net/topics/391846900
rtsp://admin:111111@192.168.1.2:554/Streaming/tracks/101?starttime=20201028t063812z&endtime=20201028t064816z
/*表示以单播形式回放通道1 中的录像文件,时间范围是starttime 到endtime,其中starttime 和endtime 的格式要符合ISO 8601 。
具体格式是YYYYMMDD”T”HHmmSS.fraction”Z” ,Y 是年,M 是月,D 是日,T 是时间分格符,H 是小时,M 是分,S 是秒,Z 是可选的、
表示Zulu (GMT) 时间。*/