ubuntu18部署wvp-pro国标平台
[TOC]
部署基础服务
安装openjdk等依赖包
apt install -y openjdk-11-jre git maven build-essential cmake ffmpeg libssl-dev libsdl-dev libavcodec-dev libavutil-dev
安装nodejs
#下载nodejs包
root@VM-16-7-ubuntu:~# wget https://nodejs.org/dist/v17.9.1/node-v17.9.1-linux-x64.tar.xz
--2023-12-25 10:10:40-- https://nodejs.org/dist/v17.9.1/node-v17.9.1-linux-x64.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2606:4700:10::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22672072 (22M) [application/x-xz]
Saving to: ‘node-v17.9.1-linux-x64.tar.xz’
node-v17.9.1-linux-x64.tar.xz 100%[=================================================================================================================================================================>] 21.62M 15.5MB/s in 1.4s
2023-12-25 10:10:42 (15.5 MB/s) - ‘node-v17.9.1-linux-x64.tar.xz’ saved [22672072/22672072]
#解压
root@VM-16-7-ubuntu:~# tar xf node-v17.9.1-linux-x64.tar.xz
#移动到指定位置
root@VM-16-7-ubuntu:~# mv node-v17.9.1-linux-x64 /usr/local/node/
#输入环境变量
root@VM-16-7-ubuntu:~# echo "export PATH CLASSPATH" >> /etc/profile
root@VM-16-7-ubuntu:~# echo "export NODE_HOME=/usr/local/node" >> /etc/profile
root@VM-16-7-ubuntu:~# echo "PATH=:$PATH:$NODE_HOME/bin" >> /etc/profile
#重新加载全局环境变量
root@VM-16-7-ubuntu:~# source /etc/profile
#检查node版本
root@VM-16-7-ubuntu:~# node -v
v17.9.1
#检查npm版本
root@VM-16-7-ubuntu:~# npm -v
8.11.0
安装mysql
- 安装mysql
#创建mysql路径
root@VM-16-7-ubuntu:~# mkdir mysql
#下载mysql安装包
root@VM-16-7-ubuntu:~/mysql# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
#解压mysql安装包
root@VM-16-7-ubuntu:~/mysql# tar xf mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
#开始安装MySQL
root@VM-16-7-ubuntu:~/mysql# dpkg -i mysql-common_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package mysql-common.
(Reading database ... 107198 files and directories currently installed.)
Preparing to unpack mysql-common_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (5.7.42-1ubuntu18.04) ...
Setting up mysql-common (5.7.42-1ubuntu18.04) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
root@VM-16-7-ubuntu:~/mysql# dpkg-preconfigure mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb #此处需要输入mysql的密码
root@VM-16-7-ubuntu:~/mysql# dpkg -i libmysqlclient20_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package libmysqlclient20:amd64.
(Reading database ... 107213 files and directories currently installed.)
Preparing to unpack libmysqlclient20_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking libmysqlclient20:amd64 (5.7.42-1ubuntu18.04) ...
Setting up libmysqlclient20:amd64 (5.7.42-1ubuntu18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i libmysqlclient-dev_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package libmysqlclient-dev.
(Reading database ... 107221 files and directories currently installed.)
Preparing to unpack libmysqlclient-dev_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking libmysqlclient-dev (5.7.42-1ubuntu18.04) ...
Setting up libmysqlclient-dev (5.7.42-1ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i libmysqld-dev_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package libmysqld-dev.
(Reading database ... 107341 files and directories currently installed.)
Preparing to unpack libmysqld-dev_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking libmysqld-dev (5.7.42-1ubuntu18.04) ...
Setting up libmysqld-dev (5.7.42-1ubuntu18.04) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package mysql-community-client.
(Reading database ... 107349 files and directories currently installed.)
Preparing to unpack mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (5.7.42-1ubuntu18.04) ...
Setting up mysql-community-client (5.7.42-1ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i mysql-client_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package mysql-client.
(Reading database ... 107406 files and directories currently installed.)
Preparing to unpack mysql-client_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (5.7.42-1ubuntu18.04) ...
Setting up mysql-client (5.7.42-1ubuntu18.04) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i mysql-common_5.7.42-1ubuntu18.04_amd64.deb
(Reading database ... 107412 files and directories currently installed.)
Preparing to unpack mysql-common_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (5.7.42-1ubuntu18.04) over (5.7.42-1ubuntu18.04) ...
Setting up mysql-common (5.7.42-1ubuntu18.04) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package mysql-community-server.
(Reading database ... 107412 files and directories currently installed.)
Preparing to unpack mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server (5.7.42-1ubuntu18.04) ...
Setting up mysql-community-server (5.7.42-1ubuntu18.04) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Processing triggers for systemd (237-3ubuntu10.57) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@VM-16-7-ubuntu:~/mysql# dpkg -i mysql-server_5.7.42-1ubuntu18.04_amd64.deb
Selecting previously unselected package mysql-server.
(Reading database ... 107574 files and directories currently installed.)
Preparing to unpack mysql-server_5.7.42-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (5.7.42-1ubuntu18.04) ...
Setting up mysql-server (5.7.42-1ubuntu18.04) ...
- 配置mysql
# mysql配置文件
root@VM-16-7-ubuntu:~/mysql# cat /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysql]
default-character-set=utf8
[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
ngram_token_size=1
max_connections=2000
wait_timeout=7200
interactive_timeout=300
init_connect='SET NAMES utf8mb4'
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
user = mysql
port = 3306
basedir = /usr
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
group_concat_max_len = 102400
lower_case_table_names=1
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
server-id = 2
log-bin = mysql-bin
gtid_mode = on
enforce_gtid_consistency = on
slow_query_log = 1
long_query_time = 5
log_timestamps=SYSTEM
symbolic-links=0
#创建wvp库
root@VM-16-7-ubuntu:~/mysql# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42-log MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE DATABASE wvp CHARACTER SET utf8 COLLATE utf8_general_ci; #创建数据库并设置字符集
Query OK, 1 row affected (0.00 sec)
mysql> exit
安装redis
- 安装redis
root@VM-16-7-ubuntu:~# apt install -y redis
- 配置redis
注释行:bind 127.0.0.1 ::1
取消注释行:requirepass foobared #foobared为redis密码
- 启动并测试redis
#启动redis
root@VM-16-7-ubuntu:~/mysql# service redis restart
#进入redis控制台
root@VM-16-7-ubuntu:~/mysql# redis-cli
127.0.0.1:6379> auth foobared
OK
127.0.0.1:6379>
ZLMediaKit
部署ZLMediaKit
#进入data路径
root@VM-16-7-ubuntu:~# cd /data
#拉代码
root@VM-16-7-ubuntu:/data# git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
Cloning into 'ZLMediaKit'...
remote: Enumerating objects: 668, done.
remote: Counting objects: 100% (668/668), done.
remote: Compressing objects: 100% (582/582), done.
remote: Total 668 (delta 81), reused 381 (delta 47), pack-reused 0
Receiving objects: 100% (668/668), 21.92 MiB | 2.36 MiB/s, done.
Resolving deltas: 100% (81/81), done.
#进入代码路径
root@VM-16-7-ubuntu:/data# cd ZLMediaKit/
#拉第三方代码
root@VM-16-7-ubuntu:/data/ZLMediaKit# git submodule update --init
Submodule 'ZLToolKit' (https://gitee.com/xia-chu/ZLToolKit) registered for path '3rdpart/ZLToolKit'
Submodule '3rdpart/jsoncpp' (https://gitee.com/mirrors/jsoncpp.git) registered for path '3rdpart/jsoncpp'
Submodule '3rdpart/media-server' (https://gitee.com/ireader/media-server) registered for path '3rdpart/media-server'
Submodule 'www/webassist' (https://gitee.com/victor1002/zlm_webassist) registered for path 'www/webassist'
Cloning into '/data/ZLMediaKit/3rdpart/ZLToolKit'...
Cloning into '/data/ZLMediaKit/3rdpart/jsoncpp'...
Cloning into '/data/ZLMediaKit/3rdpart/media-server'...
Cloning into '/data/ZLMediaKit/www/webassist'...
Submodule path '3rdpart/ZLToolKit': checked out '6a8bdfc80db3930d2ba8067d06db467dad8baddf'
Submodule path '3rdpart/jsoncpp': checked out '69098a18b9af0c47549d9a271c054d13ca92b006'
Submodule path '3rdpart/media-server': checked out 'a8a80e0738b052aa5671ef82a295ef388bd28e13'
Submodule path 'www/webassist': checked out 'b02d2a4c1abf95db45e50bb77d789defa0fcc4b7'
#创建安装路径
root@VM-16-7-ubuntu:/data/ZLMediaKit# mkdir build
#进入安装路径
root@VM-16-7-ubuntu:/data/ZLMediaKit# cd build/
#编译
root@VM-16-7-ubuntu:/data/ZLMediaKit/build# cmake ..
………………………………
-- Build files have been written to: /data/ZLMediaKit/build
#构建
root@VM-16-7-ubuntu:/data/ZLMediaKit/build# make -j4
………………………………
make[2]: Leaving directory '/data/ZLMediaKit/build'
[100%] Built target api_tester_httpclient
make[1]: Leaving directory '/data/ZLMediaKit/build'
/usr/bin/cmake -E cmake_progress_start /data/ZLMediaKit/build/CMakeFiles 0
配置ZLMediaKit
root@VM-16-7-ubuntu:/data/ZLMediaKit/build# cd ..
root@VM-16-7-ubuntu:/data/ZLMediaKit# ls
3rdpart api build cmake conf docker ext-codec LICENSE player README_en.md release sources.list srt tools webrtc www
Android AUTHORS build_docker_images.sh CMakeLists.txt default.pem dockerfile k8s_readme.md package postman README.md server src tests version.h.ini webrtc_player
#进入代码路径
root@VM-16-7-ubuntu:/data/ZLMediaKit# cd release/linux/Debug/
#查看文件
root@VM-16-7-ubuntu:/data/ZLMediaKit/release/linux/Debug# ls
api_tester_h264_media_server api_tester_server config.ini libflv.a libmov.a libzlmediakit.a tab test_bench_pull test_httpApi test_pusherMp4 test_sortor www
api_tester_httpclient api_tester_websocket default.pem libjsoncpp.a libmpeg.a libzltoolkit.a test_bench_forward test_bench_push test_httpClient test_rtp test_wsClient
api_tester_pusher bom libext-codec.a libmk_api.so libsrt.a MediaServer test_bench_proxy test_flv test_pusher test_server test_wsServer
#修改配置文件config.ini的[http]内的port为18080
#http服务器监听端口
port=18080
#修改配置文件config.ini的[general]内的mediaServerId为自定义ID
mediaServerId=test-txu
#启动ZLMediaKit
root@VM-16-7-ubuntu:/data/ZLMediaKit/release/linux/Debug# nohup ./MediaServer -d -m 3 2>&1 &
推流测试
* 上传一个视频"469b14cdf7fa0de2be1bf8bcd6916149.mp4"到服务器的/root下
root@VM-16-7-ubuntu:/data/ZLMediaKit/release/linux/Debug# ffmpeg -re -i "/root/469b14cdf7fa0de2be1bf8bcd6916149.mp4" -vcodec h264 -acodec aac -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/test
ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/root/469b14cdf7fa0de2be1bf8bcd6916149.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:05:19.90, start: 0.000000, bitrate: 735 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x544, 680 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 47 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x55aecffeace0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55aecffeace0] profile High, level 3.1
wvp-pro
部署wvp-pro-assist
- 拉代码
root@VM-16-7-ubuntu:/data# git clone https://github.com/648540858/wvp-pro-assist.git
Cloning into 'wvp-pro-assist'...
remote: Enumerating objects: 882, done.
remote: Counting objects: 100% (398/398), done.
remote: Compressing objects: 100% (181/181), done.
remote: Total 882 (delta 183), reused 331 (delta 147), pack-reused 484
Receiving objects: 100% (882/882), 34.54 MiB | 11.63 MiB/s, done.
Resolving deltas: 100% (334/334), done.
修改配置文件
root@VM-16-7-ubuntu:/data# cd wvp-pro-assist/
root@VM-16-7-ubuntu:/data/wvp-pro-assist# vim src/main/resources/application-dev.yml
spring:
# REDIS数据库配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 127.0.0.1
# [必须修改] 端口号
port: 6379
# [可选] 数据库 DB
database: 8
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
password: foobared
# [可选] 超时时间
timeout: 10000
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server:
port: 28080
# [可选] HTTPS配置, 默认不开启
ssl:
# [可选] 是否开启HTTPS访问
enabled: false
# [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名
key-store: classpath:xxx.jks
# [可选] 证书密码
key-password: password
# [可选] 证书类型, 默认为jks,根据实际修改
key-store-type: JKS
# [根据业务需求配置]
userSettings:
id: 1
# [可选 ] zlm配置的录像路径,
record: /data/wvp-record
# [可选 ] 录像保存时长(单位: 天)每天晚12点自动对过期文件执行清理
recordDay: 30
# [可选 ] 录像下载合成临时文件保存时长, 不配置默认取值recordDay(单位: 天)每天晚12点自动对过期文件执行清理
# recordTempDay: 7
# [必选 ] ffmpeg路径
ffmpeg: /usr/bin/ffmpeg
# [必选 ] ffprobe路径, 一般安装ffmpeg就会自带, 一般跟ffmpeg在同一目录,用于查询文件的信息
ffprobe: /usr/bin/ffprobe
# [可选 ] 限制 ffmpeg 合并文件使用的线程数,间接限制cpu使用率, 默认2 限制到50%
threads: 2
swagger-ui:
# [可选] 日志配置, 一般不需要改
logging:
file:
name: logs/wvp.log
max-history: 30
max-size: 10MB
total-size-cap: 300MB
level:
root: WARN
top:
panll:
assist: info
编译wvp-pro-assist
root@VM-16-7-ubuntu:/data/wvp-pro-assist# mvn package
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:26 min
[INFO] Finished at: 2023-12-25T13:18:03+08:00
[INFO] ------------------------------------------------------------------------
启动wvp-pro-assist
root@VM-16-7-ubuntu:/data/wvp-pro-assist# cd target/
root@VM-16-7-ubuntu:/data/wvp-pro-assist/target# nohup java -jar
classes/ generated-sources/ generated-test-sources/ maven-archiver/ maven-status/ test-classes/ wvp-pro-assist-2.6.8-12250515.jar
root@VM-16-7-ubuntu:/data/wvp-pro-assist/target# nohup java -jar wvp-pro-assist-2.6.8-12250515.jar --spring.config.location=../src/main/resources/application-dev.yml 2>&1 &
[1] 7428
root@VM-16-7-ubuntu:/data/wvp-pro-assist/target# nohup: ignoring input and appending output to 'nohup.out'
root@VM-16-7-ubuntu:/data/wvp-pro-assist/target# netstat -anpt |grep LISTEN|grep java
tcp6 0 0 :::28080 :::* LISTEN 7928/java
部署wvp-GB28181-pro
- 拉代码
root@VM-16-7-ubuntu:/data# git clone https://github.com/648540858/wvp-GB28181-pro.git
Cloning into 'wvp-GB28181-pro'...
remote: Enumerating objects: 35893, done.
remote: Counting objects: 100% (8255/8255), done.
remote: Compressing objects: 100% (1753/1753), done.
remote: Total 35893 (delta 5902), reused 7611 (delta 5583), pack-reused 27638
Receiving objects: 100% (35893/35893), 29.97 MiB | 15.50 MiB/s, done.
Resolving deltas: 100% (19821/19821), done.
编译前端页面
root@VM-16-7-ubuntu:/data/# cd wvp-GB28181-pro/web_src/
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/web_src# ls
build config index.html package.json package-lock.json README.md src static
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/web_src# npm --registry=https://registry.npmmirror.com install
------------------------------------------------------------------------
added 1322 packages in 1m
8 packages are looking for funding
run `npm fund` for details
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/web_src# npm run build
> gb_web@1.0.0 build
> node build/build.js
⠙ building for production...Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Hash: c97dc830b57bf0640cc0
Version: webpack 3.12.0
Time: 47391ms
Asset Size Chunks Chunk Names
static/img/zlm-logo.5f8bbf7.png 49 kB [emitted]
static/fonts/element-icons.535877f.woff 28.2 kB [emitted]
static/fonts/element-icons.732389d.ttf 56 kB [emitted]
static/js/vendor.0096e9b933add0d16e5f.js 3.43 MB 0 [emitted] [big] vendor
static/js/app.aa5e1cd3718a86d7fdfd.js 312 kB 1 [emitted] [big] app
static/js/manifest.2ae2e69a05c33dfc65f8.js 857 bytes 2 [emitted] manifest
static/css/app.e8bfaf0bf95e38540654aed4c131bcbb.css 267 kB 1 [emitted] [big] app
static/css/app.e8bfaf0bf95e38540654aed4c131bcbb.css.map 415 kB [emitted]
static/js/vendor.0096e9b933add0d16e5f.js.map 14.9 MB 0 [emitted] vendor
static/js/app.aa5e1cd3718a86d7fdfd.js.map 1.09 MB 1 [emitted] app
static/js/manifest.2ae2e69a05c33dfc65f8.js.map 4.97 kB 2 [emitted] manifest
index.html 1.06 kB [emitted]
static/images/arrow.png 5.05 kB [emitted]
static/images/zlm-logo.png 49 kB [emitted]
static/css/iconfont.css 24.7 kB [emitted]
static/css/iconfont.woff2 54.9 kB [emitted]
static/css/login.css 8.5 kB [emitted]
static/favicon.ico 9.89 kB [emitted]
static/EasyPlayer.swf 75.3 kB [emitted]
static/file/推流通道导入.zip 15.2 kB [emitted]
static/fonts/poppins/Poppins-Bold.ttf 141 kB [emitted]
static/fonts/poppins/Poppins-Medium.ttf 144 kB [emitted]
static/images/gis/camera-offline.png 8.89 kB [emitted]
static/images/gis/camera.png 10.3 kB [emitted]
static/fonts/poppins/Poppins-Regular.ttf 145 kB [emitted]
static/images/gis/camera1.png 13.1 kB [emitted]
static/images/gis/camera1-offline.png 10.5 kB [emitted]
static/images/gis/camera2-offline.png 10.1 kB [emitted]
static/fonts/poppins/Poppins-SemiBold.ttf 142 kB [emitted]
static/images/gis/camera2.png 12.6 kB [emitted]
static/images/gis/camera3.png 13 kB [emitted]
static/js/config.js 553 bytes [emitted]
static/images/gis/camera3-offline.png 10.5 kB [emitted]
static/js/jessibuca/decoder.js 110 kB [emitted]
static/js/jessibuca/jessibuca.d.ts 19.5 kB [emitted]
static/js/jessibuca/jessibuca.js 206 kB [emitted]
static/js/ZLMRTCClient.js 256 kB [emitted] [big]
static/logo.png 67.1 kB [emitted]
static/js/ZLMRTCClient.js.map 507 kB [emitted]
static/js/jessibuca/decoder.wasm 1.05 MB [emitted] [big]
static/js/EasyWasmPlayer.js 2.31 MB [emitted] [big]
static/libDecoder.wasm 2.39 MB [emitted] [big]
crossdomain.xml 123 bytes [emitted]
liveplayer.swf 75.3 kB [emitted]
static/js/liveplayer-lib.min.js 844 kB [emitted] [big]
Build complete.
Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won't work.
生成jar包
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/web_src# cd /data/wvp-GB28181-pro/
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro# mvn package
------------------------------------------------------------------------
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13:44 min
[INFO] Finished at: 2023-12-25T12:40:13+08:00
[INFO] ------------------------------------------------------------------------
修改配置文件
#redis配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 127.0.0.1
# [必须修改] 端口号
port: 6379
# [可选] 数据库 DB
database: 7
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
password: foobared
# [可选] 超时时间
timeout: 10000
# mysql数据源
#数据库配置
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
#MySQL链接地址
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
#数据库账号
username: root
#数据库密码
password: root
#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server:
port: 18081
# [可选] HTTPS配置, 默认不开启
ssl:
# [可选] 是否开启HTTPS访问
enabled: false
# [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名
key-store: classpath:test.monitor.89iot.cn.jks
# [可选] 证书密码
key-store-password: gpf64qmw
# [可选] 证书类型, 默认为jks,根据实际修改
key-store-type: JKS
# 作为28181服务器的配置
sip:
# [必须修改] 本机的IP,对应你的网卡,监听什么ip就是使用什么网卡,
# 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4
# 如果不明白,就使用0.0.0.0,大部分情况都是可以的
# 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。
ip: 0.0.0.0
# [可选] 28181服务监听的端口
port: 18082
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
# 后两位为行业编码,定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
# [可选]
domain: 4101050000
# [可选]
id: 41010500002000000001
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
password: bajiuwulian1006
# 是否存储alarm信息
alarm: true
#zlm 默认服务器配置
media:
id: test-txu
# [必须修改] zlm服务器的内网IP
ip: 127.0.0.1
# [必须修改] zlm服务器的http.port
http-port: 18080
# [可选] 返回流地址时的ip,置空使用 media.ip
stream-ip: 43.129.237.157
# [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip
sdp-ip: 43.129.237.157
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
hook-ip:
# [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
http-ssl-port:
# [可选] zlm服务器的hook.admin_params=secret
secret: b3D1wDkAyW1KywUb4zhzwvo9yQERVhOU
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
rtp:
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
enable: true
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
port-range: 30000,35000 # 端口范围
# [可选] 国标级联在此范围内选择端口发送媒体流,
send-port-range: 30000,35000 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
record-assist-port: 28080
# [根据业务需求配置]
user-settings:
# 点播/录像回放 等待超时时间,单位:毫秒
play-timeout: 180000
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
auto-apply-play: true
# 设备/通道状态变化时发送消息
device-status-notify: true
# 跨域配置,配置你访问前端页面的地址即可, 可以配置多个
allowed-origins:
- http://localhost:8080
- http://43.129.237.157:18081
导入数据库
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/sql# cd /data/wvp-GB28181-pro/sql/
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/sql# ls
2.6.6-2.6.7更新.sql 2.6.8升级2.6.9.sql 2.6.8补丁更新.sql 2.6.9更新.sql clean.sql 初始化.sql
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/sql# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.42-log MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use wvp;
Database changed
mysql> source /data/wvp-GB28181-pro/sql/初始化.sql;
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 1 row affected (0.00 sec)
Query OK, 1 row affected (0.00 sec)
mysql> exit
Bye
启动wvp-GB28181-pro
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro# cd target/
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/target# nohup java -jar wvp-pro-2.6.9-12250426.jar --spring.config.location=../src/main/resources/application-dev.yml 2>&1 &
[2] 8865
root@VM-16-7-ubuntu:/data/wvp-GB28181-pro/target# tail -f logs/wvp-2023-12-25.0.log
2023-12-25 13:32:50.945 [main] INFO com.genersoft.iot.vmp.VManageBootstrap:55 - Starting VManageBootstrap v2.6.9 using Java 11.0.19 on VM-16-7-ubuntu with PID 11204 (/data/wvp-GB28181-pro/target/wvp-pro-2.6.9-12250426.jar started by root in /data/wvp-GB28181-pro/target)
2023-12-25 13:32:50.949 [main] INFO com.genersoft.iot.vmp.VManageBootstrap:632 - No active profile set, falling back to 1 default profile: "default"
2023-12-25 13:32:56.178 [main] INFO com.genersoft.iot.vmp.conf.ServiceInfo:24 - 项目启动获取启动的端口号: 18081
2023-12-25 13:32:56.747 [main] INFO com.genersoft.iot.vmp.VManageBootstrap:61 - Started VManageBootstrap in 6.477 seconds (JVM running for 6.987)
2023-12-25 13:32:56.759 [main] INFO c.g.i.v.g.t.e.r.i.m.n.c.AlarmNotifyMessageHandler:59 - [SIP日志]已关闭
2023-12-25 13:32:57.048 [main] INFO com.genersoft.iot.vmp.gb28181.SipLayer:80 - [SIP SERVER] tcp://0.0.0.0:18082 启动成功
2023-12-25 13:32:57.066 [main] INFO com.genersoft.iot.vmp.gb28181.SipLayer:97 - [SIP SERVER] udp://0.0.0.0:18082 启动成功
2023-12-25 13:32:57.399 [main] INFO com.genersoft.iot.vmp.media.zlm.ZLMRunner:82 - [zlm] 等待默认zlm中...
2023-12-25 13:32:57.402 [main] INFO c.g.iot.vmp.service.impl.MediaServerServiceImpl:125 - [zlm] 缓存初始化
2023-12-25 13:32:57.875 [main] INFO c.g.iot.vmp.service.impl.MediaServerServiceImpl:383 - [ZLM] 正在连接 : test-txu -> 127.0.0.1:18080
2023-12-25 13:32:58.170 [main] INFO c.g.iot.vmp.service.impl.MediaServerServiceImpl:566 - [ZLM] 正在设置 :test-txu -> 127.0.0.1:18080
2023-12-25 13:32:58.178 [main] INFO c.g.iot.vmp.service.impl.MediaServerServiceImpl:621 - [ZLM] 设置成功,开始重启以保证配置生效 test-txu -> 127.0.0.1:18080
2023-12-25 13:32:58.198 [main] INFO c.g.iot.vmp.service.impl.MediaServerServiceImpl:442 - [ZLM] 连接成功 test-txu - 127.0.0.1:18080
2023-12-25 13:32:58.210 [wvp-1] INFO c.g.iot.vmp.media.zlm.event.ZLMStatusEventListener:42 - [ZLM] 上线 ID:test-txu
2023-12-25 13:32:58.303 [main] INFO com.genersoft.iot.vmp.conf.CivilCodeFileConf:79 - [行政区划] 加载成功,共加载数据3219条
2023-12-25 13:32:58.305 [main] INFO com.genersoft.iot.vmp.VManageBootstrap:37 - 构建版本: 2.6.9
2023-12-25 13:32:58.305 [main] INFO com.genersoft.iot.vmp.VManageBootstrap:38 - 构建时间: 20231225
2023-12-25 13:32:58.306 [main] INFO com.genersoft.iot.vmp.VManageBootstrap:39 - GIT最后提交时间: 20231218
功能测试
页面访问
- 访问服务器外网IP的wvp-GB28181-pro配置文件内的server.port。默认账号密码admin、admin
- 查看节点
推流测试播放
- 登录后点击用户管理获取pushkey
- 使用ffmpeg测试推流
推送链接的格式应该为:rtsp://127.0.0.1/live/test?callId=&sign=。
其中callID可以自定义,sign为callId+pushkey加密为md5,如果我的callId为123456,pushkey为e80d1762a324d5b0ff636e0bd16f1e3,那我应该这么推流
#获取md5字符串
root@VM-16-7-ubuntu:~# echo -n "123456_3e80d1762a324d5b0ff636e0bd16f1e3" | md5sum
51f5e5c90afe80b329edd5735e620853 -
#推流测试
root@VM-16-7-ubuntu:~# ffmpeg -re -i "/root/469b14cdf7fa0de2be1bf8bcd6916149.mp4" -vcodec h264 -acodec aac -f rtsp -rtsp_transport tcp "rtsp://127.0.0.1/live/test?callId=123456&sign=51f5e5c90afe80b329edd5735e620853"
ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/root/469b14cdf7fa0de2be1bf8bcd6916149.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:05:19.90, start: 0.000000, bitrate: 735 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x544, 680 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 47 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x560b25c73ce0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x560b25c73ce0] profile High, level 3.1
[libx264 @ 0x560b25c73ce0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, rtsp, to 'rtsp://127.0.0.1/live/test?callId=123456&sign=51f5e5c90afe80b329edd5735e620853':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Stream #0:0(und): Video: h264 (libx264), yuv420p, 720x544, q=-1--1, 30 fps, 90k tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC), 44100 Hz, mono, fltp, 69 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.107.100 aac
frame= 2572 fps= 30 q=-1.0 Lsize=N/A time=00:01:25.84 bitrate=N/A speed=0.997x
- 在页面的推流列表可以看到推流视频
- 在对应的推流视频点击播放可以播放对应视频
- 在云端录像可以看到推流的录像,也可以下载
扫描二维码,在手机上阅读
收到2条评论
默 6 个月前
按照这个配置,web上点击播放,视频是黑屏的,显示请稍等,视频加载中。录像也是黑屏的。将录像拷贝到本地,是可以播放的,不知道原因出在哪里?
回复

LiHaiYang 6 个月前
@默:F 12看下报错呢?
回复