惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
D
Docker
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
Recent Announcements
Recent Announcements
GbyAI
GbyAI
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
L
LangChain Blog
A
About on SuperTechFans
M
MIT News - Artificial intelligence
B
Blog

博客园 - Showker

ecstore-bbc-本地做域名-验证码不显示 mac 源码安装php8.4 免费ssl证书在线生成 验证码平台 Shopify应用开发创意与盈利指南 shopify-app开发实战 ssl免费在线生成 git自动拉取脚本 佳能单反相机连接抖音直播伴侣没有画面只有Eos Webcam Unity问题解决办法 thinkphp5碰到mysql占用CPU100%问题,原来是大量的SHOW COLUMNS FROM导致 centos7 升级curl命令,php不变问题 centos 更新curl版本 mysql联合索引优化 msyql leftjoin及大表-分表优化 等保-linux-三权分立账号设置 阿里云负载均衡全过程:ECS图片资源迁移OSS操作全过程 设置PHP最大连接数及php-fpm -static高并发+ab测试 谷歌ai平台测试。真的很好用 通义1.8B开源大模型实战及微调
php对接海康卫视NVR监控设备全过程-互联网(公网)快速集成设备
Showker · 2023-10-28 · via 博客园 - Showker

如果需要在互联网(公网)集成设备实现视频预览回放、语音、配置控制、报警事件等功能,当前的集成方法有:

1)推荐使用我司云曜开放平台,云曜平台支持GB/T28181国标协议、部标协议、萤石协议、NB-IoT协议以及第三方私有协议等各种协议和类型的设备接入,同时直接提供云端API接口(例如H5、小程序视频直播)供三方集成,集成简便快捷。云曜平台的对接文档地址:

https://help.hikyun.com/index

服务专用热线是0571-87006061或者进入云曜官网https://www.hikyun.com/index直接留言咨询。

2)可以使用设备网关,资料详见:

https://open.hikvision.com/osp#%E8%AE%BE%E5%A4%87%E9%9B%86%E6%88%90%E7%BD%91%E5%85%B3

有固定IP地址的Windows或者Linux服务器上直接安装运行网关,设备使用ISUP5.0协议注册添加到网关,然后三方平台或者应用可以使用HTTP/HTTPS协议和RTSP协议对接网关,集成方便快捷。

3)如果不使用我司平台软件或者网关,自己开发所有接入和转发服务,则可以使用设备网络SDK(设备有固定IP或者域名的情况)或者ISUP SDK(设备无固定IP或者域名的情况)动态库接口和硬件设备对接,SDK包含服务器和设备之间交互的接口,设备管理、流媒体转发等均需要自行实现,具有一定的开发工作量。资料详见:

https://open.hikvision.com/osp#%E8%AE%BE%E5%A4%87%E9%9B%86%E6%88%90SDK

1、确定对接方式用

监控设备里启用:使用ISUP协议,填写服务端的网关IP,端口(这里比较坑,默认是7660,实际是7661,导致设备一直没法注册成功。)

服务器端:安装海康的Gateway网关

2、服务端Linux系统里安装海康的Gateway网关(官网下载)

./install.sh --port=81
Checking ports completed. Port 81 will be used.
hpr tls index{0}
schina GetAdapterInfo_Inter_Posix link: 1 iterface: eth0
schina GetAdapterInfo_Inter_Posix link: 1 iterface: lo
recvfrom end. len [1348]
mac[0:0:0:0:0:0] index[1]
mac[0:16:3e:26:f4:aa] index[2]
recvfrom end. len [20]
recvfrom end. len [144]
ipv6[00::00:00:00:00] index[1]
ipv6[fe80::00:00:00:216] index[2]
recvfrom end. len [20]
loop[2] find 2 mac and 2 ip
schina get ipv6[0000] index[1]
schina get ipv6[fe80] index[2]
/proc/16163/cmdline
./DeviceGatewayService-install
please wait, install DeviceGatewayService service may take a few minutes...
0+1 records in
0+1 records out
14 bytes (14 B) copied, 5.9667e-05 s, 235 kB/s
setenforce: SELinux is disabled
install DeviceGatewayService service successfully.
Port rules are added to firewalld by default.
FirewallD is not running

2、设备注册成功后,按开发文档调试

 打开服务端的管理界面,添加设备

常见问题:

设备离线:等待设备注册到网关

        如为isup5.0登陆密钥错误请修改密钥后重试

        如为等待设备注册到网关请检查:

            ①如果使用ISUP5.0添加设备,部署网关的服务器防火墙是否关闭

            ②如果涉及端口映射本地测试,设备是否能正常注册上线

    3. 收集网关日志后,收集相关信息发送到SDK邮箱进行排查.

常见问题:

1、视频web查看,wss协议如何访问。

做域名video.aa.com解析到DVR所在主机的IP(没有公网,做公网映射,443接口,因为80端口运营商早就封掉了,所以在路由器端做81端口映射,443正常)

jssdk里用video.aa.com访问各通道信息。

完整nginx配置如下

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;

events {
    worker_connections  2000;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
	server_tokens off;
    access_log  off;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  300;
	client_max_body_size 20M;
	proxy_connect_timeout       300s;
	proxy_send_timeout          300s;
	proxy_read_timeout          300s;
	send_timeout                300s;
    #gzip  on;
	
	upstream gateway_server{
			server 127.0.0.1:8081;
			keepalive 1024;
		}
	upstream websocket_server{
			server 127.0.0.1:9081;
			keepalive 1024;
		}	
	upstream wsStream_server{
	server 127.0.0.1:7314;


			keepalive 1024;
		}	
	upstream picture_server{
			server 127.0.0.1:10081;
		}	
	
	upstream download_server{
			server 127.0.0.1:11081;
		}
	# HTTP server
    server {
        listen       81;
		listen       443 ssl default;
		
        server_name  0.0.0.0;
		
		if ($request_method !~* GET|POST|PUT|DELETE) {
			return 444;
		}
		
         ssl_certificate 	cert.pem;
         ssl_certificate_key cert.key;
		 ssl_password_file 	  key.pass;
         ssl_session_cache     shared:SSL:1m;
         ssl_session_timeout  5m;
         ssl_ciphers  AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
         ssl_prefer_server_ciphers  on;

        add_header X-Content-Type-Options 'nosniff';
		add_header X-Frame-Options SAMEORIGIN;
		add_header X-Xss-Protection '1; mode=block';
		location / {
			proxy_http_version 1.1;
			proxy_set_header Host $host;
			proxy_set_header Upgrade 'websocket';
			proxy_set_header Connection 'Upgrade';
			
			if ($query_string ~ "cipherSuites=0"){
				proxy_pass http://wsStream_server;
				break;
			}
			
			try_files $uri $uri/ /index.html;
			root   html;
			index  index.html;
			
			if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
				add_header Content-Disposition: 'attachment;';				
			}
        }				
		
		location /ISAPI {
			proxy_pass http://gateway_server/ISAPI;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
		}
		
		location /ISAPI/Event/notification/subscribeDeviceMgmt {
			proxy_pass http://gateway_server/ISAPI/Event/notification/subscribeDeviceMgmt;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
		
		location /ISAPI/Event/notification/alertStream {
			proxy_pass http://gateway_server/ISAPI/Event/notification/alertStream;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
		
		location /ISAPI/ContentMgmt/download {
			proxy_pass http://download_server/ISAPI/ContentMgmt/download;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
				
		location /SDK {
			proxy_pass http://gateway_server/SDK;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
		
		location /daf {
			proxy_pass http://gateway_server/daf;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
		
		location ~* /ISAPI/System/TwoWayAudio/channels/.*/audioData {
			audiotalk_serveraddr 127.0.0.1;
			audiotalk_serverport 12081;
			audiotalk_put;
		}
		
		location ~* /ISAPI/System/TwoWayAudio/channels/.*/(open|close) {
			proxy_pass http://download_server;
			proxy_http_version 1.1;
			proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';	
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
		
		location /Streaming {
			proxy_pass http://gateway_server/Streaming;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
		}
		
		location /HikGatewayStorage/ {
			proxy_pass http://picture_server/;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host:$server_port;
			proxy_set_header X-Forwarded-For $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Real-Port $remote_port;
			proxy_set_header Connection 'Keep-Alive';
			proxy_buffering off;
			chunked_transfer_encoding       off;
		}
		
		location /ISAPI/System/ProtocolMgmt/SurGard/eventMonitor {
			proxy_pass http://websocket_server/ISAPI/System/ProtocolMgmt/SurGard/eventMonitor;
			proxy_http_version 1.1;
		   	proxy_set_header Host $host;
			proxy_set_header Upgrade 'websocket';
			proxy_set_header Connection 'Upgrade';
		}
    }

}

 2、device-gateway里的nginx启动报错

OpenEvent(“Global\ngx_stop_1676“)failed (2: The system cannot find the file specified

删除nginx下的nginx.pid,error.log,右下角deviceguard服务先stop service,再start service.

也有可能是权限问题,因为ssl证书到期,更换了cert和key文件,给这个2个文件,安全里几个角色,都给完全控制。