当前位置:网站首页>Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
2022-06-23 12:43:00 【InfoQ】
Introduce
Application scenarios
- Support browser to play camera video without plug-in .
- Support Cameras 、 platform 、NVR And other equipment access . Support national standard cascade .
- Support rtsp/rtmp Wait for the video stream to be forwarded to the national standard platform .
- Support rtsp/rtmp Wait for the streaming to be forwarded to the national standard platform .
Service deployment
ZLMediaKit Deploy
## Prepare the environment
[[email protected] artc]# yum install -y epel-release
## gcc and yasm Need a higher version It's for small knitting gcc4.8.5 yasm1.2.0
[[email protected] artc]# yum -y install yasm gcc*
[[email protected] artc]# yum -y install openssl-devel SDL-devel
## Compilation and installation cmake 3.8.2
[[email protected] ~]# cd /home/artc
[[email protected] artc]# wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
[[email protected] artc]# tar zxvf cmake-3.8.2.tar.gz
[[email protected] artc]# cd cmake-3.8.2
[[email protected] cmake-3.8.2]# ./bootstrap
[[email protected] cmake-3.8.2]# gmake
[[email protected] cmake-3.8.2]# gmake install
## The domestic warehouse is relatively fast
[[email protected] ~]# cd /usr/local/
[[email protected] local]# git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
[[email protected] local]# cd ZLMediaKit
# Don't forget to carry out this command
[[email protected] ZLMediaKit]# git submodule update --init
## Compilation and installation
[[email protected] ZLMediaKit]# mkdir build
[[email protected] ZLMediaKit]# cmake .
[[email protected] ZLMediaKit]# make -j4
## ZLMediaKit Service catalog
[[email protected] ZLMediaKit]# cd release/linux/Debug
The configuration file [general]
mediaServerId=12345678 ## Back and WVP-PRO docking
[hook]
admin_params=secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc ## Back and WVP-PRO docking
## Program started
[[email protected] Debug]# ./MediaServer ## The front desk starts
[[email protected] Debug]# ./MediaServer -d & ## Background start
## Soft connection
[[email protected] Debug]# ln -sf /home/ZLMediaKit/release/linux/Debug/MediaServer /usr/bin/
WVP-PRO Deploy
Project operation depends on redis、jdk1.8, Package dependency git、maven、nodejs、npm.Redis Deploy
## download epel Warehouse
[[email protected] ~]# yum install epel-release -y
## download redis database
[[email protected] ~]# yum install redis -y
## start-up redis And set to turn on auto start
[[email protected] ~]# systemctl start redis
[[email protected] ~]# systemctl enable redis
## Set up redis Remote connection and password ( If they are all on the same machine Don't take this step )
[[email protected] ~]# vim /etc/redis.conf
notes #bind 127.0.0.1
modify protected-mode no
modify daemonize yes
modify requirepass 123456
## Turn off firewall or open 6379 port
[[email protected] ~]# systemctl stop firewalld // Turn off firewall
[[email protected] ~]# firewall-cmd --zone=public --add-port=6379/tcp --permanent // Open ports
[[email protected] ~]# firewall-cmd --reload // After opening the port Need to update
## restart redis
[[email protected] ~]# systemctl restart redis
MySQL Deploy
[[email protected] ~]# yum -y install mariadb mariadb-server
[[email protected] ~]# systemctl enable mariadb
[[email protected] ~]# systemctl start mariadb
[[email protected] ~]# mysql -uroot
mysql> set password = password('123456');
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; // Set up mysql Internet connection password
mysql> flush privileges;
JDK Deploy
[[email protected] ~]# tar zxvf jdk-8u121-linux-x64.tar.gz
[[email protected] ~]# mv jdk1.8.0_121/ /usr/local/jdk
[[email protected] ~]# vim /etc/profile
## Add... At the end
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
[[email protected] ~]# source /etc/profile
[[email protected] ~]# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Maven Deploy
[[email protected] ~]# tar zxvf apache-maven-3.5.0-bin.tar.gz
[[email protected] ~]# mv apache-maven-3.5.0 /usr/local/maven
[[email protected] ~]# vim /etc/profile
## Add... At the end
export MAVEN_HOME=/usr/local/maven
export PATH=$MAVEN_HOME/bin:$PATH
[[email protected] ~]# source /etc/profile
[[email protected] ~]# mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/maven
compile WVP-PRO
## Installation dependency
[[email protected] ~]# yum -y install git nodejs npm
## Download the source code
[[email protected] ~]# cd /usr/local
[[email protected] local]# git clone https://gitee.com/pan648540858/wvp-GB28181-pro.git
## Compile static pages
[[email protected] ~]# cd /usr/local/wvp-GB28181-pro/web_src/
[[email protected] web_src]# npm --registry=https://registry.npm.taobao.org install
[[email protected] web_src]# npm run build
## Packaging project , Generate executable jar
[[email protected] web_src]# cd ..
[[email protected] wvp-GB28181-pro]# mvn package
## When the compilation is complete target Appear under directory wvp-pro-x.x-xxxxxxxx.jar
## Import MySQL file
[[email protected] ~]# cd /usr/local/wvp-GB28181-pro/sql
[[email protected] sql]# mysql -uroot -p123456
MariaDB [(none)]> create database wvp;
MariaDB [(none)]> use wvp;
MariaDB [(none)]> source mysql.sql ## Byte errors may occur take mysql.sql Inside 255 Byte modification dot
## Configuration file modification
[[email protected] wvp-GB28181-pro]# mv src/main/resources/application-dev.yml target/application.yml
[[email protected] wvp-GB28181-pro]# vim target/application.yml
spring:
# [ Optional ] Upload file size limit
servlet:
multipart:
max-file-size: 10MB
max-request-size: 100MB
# REDIS Database configuration
redis:
# [ Must be modified ] Redis The server IP, REDIS Installed on the of this machine , Use 127.0.0.1
host: 127.0.0.1
# [ Must be modified ] Port number
port: 6379
# [ Optional ] database DB
database: 6
# [ Optional ] Access password , If your redis The server doesn't have a password , You don't need a password to connect
password:
# [ Optional ] Timeout time
timeout: 10000
# mysql data source
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
username: root
password: 123456
druid:
initialSize: 10 # Number of connection pool initialization connections
maxActive: 200 # Maximum number of connections in connection pool
minIdle: 5 # The minimum number of free connections in the connection pool
maxWait: 60000 # Maximum wait time when getting a connection , Unit millisecond . Configured with maxWait after , Fair lock is enabled by default , Concurrency efficiency will decrease , If necessary, it can be configured through useUnfairLock The attribute is true Use unfair locks .
keepAlive: true # Connect... In the pool minIdle No more connections , Idle time exceeds minEvictableIdleTimeMillis, Will perform keepAlive operation .
validationQuery: select 1 # Check whether the connection is valid sql, The requirement is a query statement , Commonly used select 'x'. If validationQuery by null,testOnBorrow、testOnReturn、testWhileIdle It doesn't work .
testWhileIdle: true # Recommended configuration is true, No performance impact , And ensure safety . Check when applying for connection , If the free time is greater than timeBetweenEvictionRunsMillis, perform validationQuery Check whether the connection is valid .
testOnBorrow: false # Execute on connection request validationQuery Check whether the connection is valid , This configuration will degrade performance .
testOnReturn: false # Execute... When returning the connection validationQuery Check whether the connection is valid , This configuration will degrade performance .
poolPreparedStatements: false # Whether to open PSCache, And specify each connection PSCache Size
timeBetweenEvictionRunsMillis: 60000 # How often is the configuration interval checked , Detect idle connections that need to be closed , It's in milliseconds
minEvictableIdleTimeMillis: 300000 # Configure the minimum lifetime of a connection in the pool , It's in milliseconds
filters: stat,wall,slf4j # Configure monitoring statistics interception filters, For monitoring statistics filter:sta, It's for the log filter:log4j, defense sql Injected filter:wall
useGlobalDataSourceStat: true # Merge multiple DruidDataSource Monitoring data
# adopt connectProperties Property to open mergeSql function ; slow SQL Record
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=1000
#stat-view-servlet.url-pattern: /admin/druid/*
#[ Optional ] WVP Monitoring HTTP port , This port is used for web pages and interface calls
server:
port: 18080
# As 28181 Server configuration
sip:
# [ Must be modified ] Native IP
ip: 192.168.1.13
# [ Optional ] 28181 The port the service listens on
port: 5060
# According to the national standard 6.1.2 Specified in the ,domain It is advisable to use ID The first ten digits of unified coding . National standard appendix D Before definition in 8 Bit centered coding ( By the provincial level 、 Municipal level 、 District level 、 The basic level is composed of numbers , reference GB/T 2260-2007)
# The last two digits are industry codes , Refer to appendix for definitions D.3
# 3701020049 Logo: Lixia District, Jinan, Shandong Information industry access
# [ Optional ]
domain: 4401020049
# [ Optional ]
id: 44010200492000000001
# [ Optional ] Default device authentication password , Subsequent extensions use the device's separate password , Removing the password will not be verified
password: admin123
#zlm Default server configuration
media:
id: 12345678 ##ZLMediaKit Configured ID
# [ Must be modified ] zlm The intranet of the server IP
ip: 192.168.1.13
# [ Must be modified ] zlm Server's http.port
http-port: 80
# [ Optional ] zlm Server's hook.admin_params=secret
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
# Enable multi port mode , Multiport mode uses ports to distinguish each flow , Better compatibility . Single port uses streaming ssrc distinguish , On demand timeout, it is recommended to use multi port test
rtp:
# [ Optional ] Whether to enable multi port mode , After opening, it will be in portRange Select the port within the range for media streaming
enable: true
# [ Optional ] Select ports within this range for media streaming , Must be in advance at zlm Configure this property on , Otherwise, automatic configuration of this property may not succeed
port-range: 30000,30500 # Port range
# [ Optional ] GB cascade selects ports within this range to send media streams ,
send-port-range: 30000,30500 # Port range
# Video assisted Services , Deploying this service can achieve zlm Video management and download , 0 No use
record-assist-port: 18081
# [ Optional ] Log configuration , Generally, there is no need to change
logging:
config: classpath:logback-spring-local.xml
# Version information , Don't need to modify
version:
version: "@[email protected]"
description: "@[email protected]"
artifact-id: "@[email protected]"
## start-up WVP
[[email protected] wvp-GB28181-pro]# cd target
[[email protected] target]# java -jar wvp-pro-2.3.1-06151618.jar
## Access management page
http://192.168.1.13:18080
Default user name :admin, password :admin
Click on the console --》 Media server configuration --》 Relevant information is enough
Self starting script [[email protected] target]# cat wvp-pro.sh
#!/bin/sh
##
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "\aJnice: unable to locate functions lib. Cannot continue."
exit 0
fi
ulimit -n 65000
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
## jar File name
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
JAR_HOME=/usr/local/wvp-GB28181-pro/target
JAR_NAME=wvp-pro-2.3.1-06151618.jar
## Filter pid Process number
wvp_pro=`ps -ef|grep $JAR_NAME | grep -v grep | grep -v kill | awk '{print $2}'`
#---------------------------------------------------------------------------
# START
#---------------------------------------------------------------------------
Start()
{
if [ $tpid ]; then
echo -n "wvp_pro process [${prog}] already running"
echo_failure
echo
return 1
fi
if [ ! -f ${JAR_HOME}/${JAR_NAME} ]; then
echo -n "wvp_pro binary [${prog}] not found."
echo_failure
echo
return 1
fi
echo -n "starting service (wvp_pro): "
cd ${JAR_HOME}
nohup java -jar ${JAR_HOME}/${JAR_NAME} > /dev/null 2>&1 &
retval=$?
if [ ${retval} == 0 ]; then
echo_success
echo
else
echo_failure
echo
break
fi
sleep 1
return 0
}
#---------------------------------------------------------------------------
# STOP
#---------------------------------------------------------------------------
Stop()
{
echo -n "stopping service (wvp_pro): "
kill -9 $wvp_pro
echo
return 0
}
#---------------------------------------------------------------------------
# MAIN
#---------------------------------------------------------------------------
case "$1" in
start)
Start
;;
stop)
Stop
;;
restart)
Stop
sleep 3
Start
;;
*)
echo "please use : $0 {start|stop|restart}"
esac
exit
[[email protected] target]# crontab -l
*/1 * * * * sh /usr/local/wvp-GB28181-pro/target/wvp-pro.sh start >/dev/null 2>&1

边栏推荐
- 跟循泰国国内游宣传曲MV,像本地人一样游曼谷
- Photon network framework
- Ros2 knowledge (6): principle and practice of coordinate object TF
- 简历的项目经历,测试人员书写要注意的几个问题
- Oracle数据库的主导地位被云竞争对手逐渐侵蚀
- What should I do if a serious bug occurs within the scope of my own test and I am about to go online?
- Network foundation and framework
- How to uninstall and reinstall gazebo
- Linked list 5 - 234 Palindrome linked list
- AssetBundle资源管理
猜你喜欢
![Halcon principle: one dimensional function_ 1D type [1]](/img/ab/c0aee923fd0a9dd8a52b8cf31a6cd7.png)
Halcon principle: one dimensional function_ 1D type [1]

Deveco device tool helps openharmony device development

mysql innodb的redo log buffer中未commit的事务持久化到redo log后,万一事务rollback了怎么办?

Oracle数据库的主导地位被云竞争对手逐渐侵蚀

New project, how to ensure the coverage of the test?

二维激光SLAM( 使用Laser Scan Matcher )

Ablebits Ultimate Suite for Excel

The median annual salary exceeds 300000, and the salary of the first AI major graduate of Nanjing University is exposed

MySQL使用ReplicationConnection导致的连接失效分析与解决

User behavior modeling
随机推荐
全新项目,如何保证测试的覆盖率?
mysql中innodb下的redo log什么时候开始执行check point落盘的?
生态 | 万里数据库与卫士通完成兼容认证 共筑网络安全生态体系
用户行为建模
深入思考:《盖亚奥特曼》中部分情景深度分析及反射出的哲理与感悟
Chinatown hiking: feel the strong Chinese flavor in the exotic New York
An idea of using keep alive to cache data in vue3 form pages
面试题:举例说一下工作中你的接口测试是怎么做的?
Stimulsoft Ultimate Reports 2022.3.1
QT5知识:字符串列表QStringListModel
Runtime application self-protection (rasp): self-cultivation of application security
Oracle数据库的主导地位被云竞争对手逐渐侵蚀
Slam Laser 2D (en utilisant Laser Scan matcher)
小众浏览器出现问题,需不需要做兼容性测试?
Synergetic process
Photon network framework
What are the criteria for judging the end of the test?
国产化信息 | 爱可生与中科方德完成产品兼容互认证
[system architecture] - five styles of software architecture
QT knowledge: detailed explanation of view frame qgraphicswidget