Building a Video Surveillance System with GB28181-WVP
Creating a video surveillance system remains highly relevant across various sectors including railways, manufacturing plants, and retail stores. This guide walks through setting up such a system using the open-source GB28181-WVP project.
The required setup includes Ubuntu 20 or higher, JDK 8 or newer, Maven 3.3 or above, MySQL 8 or later, Redis 5 or greater, and a camera compliant with the GB28181 standard. All components must reside within the same local network.
For installation steps, root privileges are necessary; it's advisable to switch to the root user before proceeding.
Compiling and Running ZLMediaKit
- Install dependencies:
apt-get install build-essential
cmake
libssl-dev
- Fetch ZLMediaKit source:
cd /usr/local/
git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
cd ZLMediaKit
git submodule update --init
- Compile ZLMediaKit:
mkdir build
cd build
cmake ..
make -j4
- Launch ZLMediaKit:
cd ./release/linux/Debug
# Start as daemon
./MediaServer -d &
Once completed, ZLMediaKits ready for use. Proceed with compiling and launching WVP.
Building GB28181-WVP-PRO
- Retrieve WVP source:
cd /usr/local
git clone https://gitee.com/pan648540858/wvp-GB28181-pro.git
- Build frontend web application:
cd wvp-GB28181-pro/web_src/
npm --registry=https://registry.npm.taobao.org install
npm run build
- Compile WVP backend:
cd ../
mvn package
After successful compilation, a JAR file named wvp-pro-*.jar will appear in the target directory.
Setting Up MySQL Database
Create a database named wvp in MySQL and execute the SQL script located at wvp-GB28181-pro/sql/mysql.sql to initialize table structures.
Starting Redis
Simply initiate Redis service without further configuration.
Configuring WVP
- Modify configuration settings
Copy wvp-GB28181-pro/src/main/resources/application-dev.yml to the target directory.
Open application-dev.yml and adjust the following parameters:
Update Redis host addres to match your Redis server IP:
redis:
host: 127.0.0.1
Adjust MySQL connection details:
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
Set SIP IP to your WVP server’s IP address:
sip:
ip: 192.168.31.206
Define ZLMediaKit server IP:
media:
id: FQ3TF8yT83wh5Wvz
zlm:
ip: 192.168.31.69
Launching WVP
Start the WVP service with:
java -jar -Dspring.config.location=/usr/local/wvp-GB28181-pro/target/application-dev.yml wvp-pro-*.jar
Integrating a GB28181 Camera
Ensure the camera supports GB28181 protocol and configure its SIP settings according to the WVP server's IP address and port.
CentOS Installation
For CentOS 7.7 environments:
- Install CMake version 3.1.3 or newer
Install required tools:
yum install gcc gcc-c++ ncurses-devel perl
Download and compile CMake:
yum install wget -y
wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
mv cmake-3.3.2.tar.gz /usr/local/
tar zxvf cmake-3.3.2.tar.gz
cd cmake-3.3.2
./configure --prefix=/usr/local/
make
make install
mv cmake-3.3.2 cmake
Add to environment variables:
vi /etc/profile
Append these lines:
PATH=/usr/local/bin:$PATH
export PATH
Reload profile:
source /etc/profile
echo $PATH
Verify installation:
cmake --version
- Install ZLMediaKit:
git clone --depth 1 https://gitee.com/xiahcu/ZLMediaKit
cd ZLMediaKit
git submodule update --init