在搭建的过程中也走过不少弯路,安装了很多版本,每个版本都或多或少有部分问题出现,一致都不能成功,经过多方尝试,最后成功搭建一款使用与本地Windows的GB28181平台。
1、通信流程图
2、流程概括图
3、部署SIP服务器(wvp服务):
3.1、下载wvp-gb28181-pro升级版本的代码到本地
1、下载地址:可直接下载zip包 https://gitcode.net/mirrors/648540858/wvp-GB28181-pro 2、或者用git clone(推荐此方法,巨好用) git clone https://gitcode.net/mirrors/648540858/wvp-GB28181-pro.git3.2 配置文件部署(事先安装好redis,此处不在详细说明)
spring: # REDIS数据库配置 redis: # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 host: 127.0.0.1 # [必须修改] 端口号 port: 6379 # [可选] 数据库 DB database: 6 # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 password: xxx # [可选] 超时时间 timeout: 10000 # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 datasource: # 使用mysql 打开23-28行注释, 删除29-36行 name: wvp url: jdbc:mysql://127.0.0.1:3306/wvp?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai username: root password: 123456 type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.cj.jdbc.Driver # name: eiot # url: jdbc:sqlite::resource:wvp.sqlite # username: # password: # type: com.alibaba.druid.pool.DruidDataSource # driver-class-name: org.sqlite.JDBC max-active: 1 min-idle: 1 # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 server: port: 18080 # 作为28181服务器的配置 sip: # [必须修改] 本机的IP ip: 172.16.1.86 # [可选] 28181服务监听的端口 port: 5060 # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) # 后两位为行业编码,定义参照附录D.3 # 3701020049标识山东济南历下区 信息行业接入 # [可选] domain: 3402000000 # [可选] id: 34020000002000000001 # [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验 password: 12345678 #zlm 默认服务器配置 media: # [可选] zlm服务器唯一id,用于触发hook时区别是哪台服务器,general.mediaServerId # id: vm-windows id: ADGKNQTX036adgjn # [必须修改] zlm服务器的内网IP ip: 172.16.1.86 # [必须修改] zlm服务器的http.port http-port: 8089 # [可选] zlm服务器的hook.admin_params=secret secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 rtp: # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 enable: true # [可选] 在此范围内选择端口用于媒体流传输, port-range: 30000,30500 # 端口范围 # [可选] 国标级联在此范围内选择端口发送媒体流, send-port-range: 30000,30500 # 端口范围 # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 record-assist-port: 18081 # [可选] 日志配置, 一般不需要改 logging: file: name: logs/wvp.log max-history: 30 max-size: 10MB total-size-cap: 300MB # level: # com.genersoft.iot: info # com.genersoft.iot.vmp.storager.dao: info # com.genersoft.iot.vmp.gb28181: info level: com: genersoft: iot: info # [根据业务需求配置] user-settings: # 推流直播是否录制 record-push-live: false auto-apply-play: false # 在线文档: swagger-ui(生产环境建议关闭) swagger-ui: enabled: true # 版本信息, 不需修改 version: version: "@project.version@" description: "@project.description@" artifact-id: "@project.artifactId@"3.3、修改DeviceMapper.java的add方法,不然添加不了设备到数据库
3.4启动服务器:
?4、在启动服务器前,需要配置好流媒体服务器:
在此之前,试过很多版本的流媒体服务器,linux,docker ,windows 的各种都有;
4.1、下载可执行包,配置文件(请提前安装好ffmpeg)
注意:mediaServerId 此ID是一串随机码,而不是IP地址(踩过坑)?
?4.2、启动ZLM
?日志:
2022-01-06 10:15:55.618 W MediaServer.exe[2116-10788] SSLUtil.cpp:98 loadPublicKey | error:02001002:system library:fopen:No such file or directory 2022-01-06 10:15:55.618 W MediaServer.exe[2116-10788] SSLUtil.cpp:126 loadPrivateKey | error:2006D080:BIO routines:BIO_new_file:no such file 2022-01-06 10:15:55.618 D MediaServer.exe[2116-7128] util.cpp:340 operator () | Stamp thread started! 2022-01-06 10:15:55.621 I MediaServer.exe[2116-10788] EventPoller.cpp:467 EventPollerPool | 创建EventPoller个数:12 2022-01-06 10:15:55.621 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:554 2022-01-06 10:15:55.622 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:332 2022-01-06 10:15:55.622 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:1935 2022-01-06 10:15:55.622 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:19350 2022-01-06 10:15:55.622 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:8089 2022-01-06 10:15:55.622 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:8088 2022-01-06 10:15:55.623 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:9000 2022-01-06 10:15:55.623 I MediaServer.exe[2116-10788] TcpServer.h:320 start_l | TCP Server listening on 0.0.0.0:10000 2022-01-06 10:15:55.623 I MediaServer.exe[2116-10788] main.cpp:339 start_main | 已启动http api 接口 2022-01-06 10:15:55.626 I MediaServer.exe[2116-10788] main.cpp:341 start_main | 已启动http hook 接口 2022-01-06 10:16:11.473 T MediaServer.exe[2116-9444] HttpSession.cpp:25 HttpSession | 1808836145552(172.16.1.86:4641)?5、前端UI运行起来(webstorm运行方便npm 直接运行,没有也可)
编译静态页面 cmd 运行: E: cd wvp-GB28181\web_src npm install npm run build 编译如果报错, 一般都是网络问题, 导致的依赖包下载失败 或者采用cnpm编译 编译完成后在src\main\resources下出现static目录运行成功:
?6、访问页面:成功可实时查看视频
?
参考文档博客如下:
1、WVP+ZLMediaKit实现NAT穿透推流播放录制,支持IPC、NVR、DVR等设备接入,支持GB28181国标级联
2、GB28181国标协议通讯流程简析以及NVR注册不上等相关问题点记录
3、WVP+ZLMediaKit+MediaServerUI实现摄像头GB28181推流播放录制??
4、ZLMediaKit配置文件意义?
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。 |
标签: #gb28181 #sip服务器 #描述部署本地GB28181