How to Compile and Deploy ZLMediaKit for GB28181 Video Services
This guide walks you through installing prerequisites, cloning the ZLMediaKit source, compiling it on Linux, configuring it to work with WVP, and launching the server, plus troubleshooting tips and a Docker deployment alternative for GB28181 video integration.
Introduction
The previous article covered setting up the WVP service, but a complete GB28181 integration also requires a media streaming server. This tutorial explains how to compile, configure, and run ZLMediaKit—a high‑performance C++11 media server—so it can work with WVP.
What Is ZLMediaKit?
ZLMediaKit is a C++11‑based media server framework that supports audio/video processing, stream forwarding, and pulling/pushing. It is compatible with many protocols (GB28181, RTSP, RTMP, HLS, etc.) and is widely used in surveillance, live streaming, and communication scenarios. Its lightweight design makes it suitable for production deployments.
Environment Preparation
Because ZLMediaKit is written in C++, you need cmake (the article uses version 3.23.2). Verify the installation:
cmake --version
If not installed, use the appropriate package manager:
yum install cmake # CentOS or apt install cmake # Ubuntu
Deployment Process (Source‑Build Version)
Step 1: Obtain the Source Code
Clone the repository and initialize submodules:
git clone --depth 1 https://github.com/ZLMediaKit/ZLMediaKit.git cd ZLMediaKit git submodule update --initStep 2: Compile the Program
Create a build directory, generate the Makefile with CMake, and compile using all CPU cores:
mkdir -p build cd build cmake .. cd ../ make -j$(nproc)After compilation, the executable is located at release/linux/Debug/.
Step 3: Configure the Program (Critical for WVP Integration)
Enter the output directory and edit config.ini so that key parameters match the WVP configuration:
cd ZLMediaKit/release/linux/Debug vim config.ini [api]
secret=123456 # must match WVP api.secret
[http]
port=9092 # must match WVP media.httpPort
allow_cross_domains=1
rootPath=./wwwOther settings can remain default unless you need to change ports to avoid conflicts.
Step 4: Start the Service
Run the server in the foreground (logs appear on the console): ./MediaServer Or run it as a background daemon for production: nohup ./MediaServer > zlm.log 2>&1 & Verify the startup by checking the log:
tail -f zlm.logCommon Issues
How to Install FFmpeg (required for audio/video encoding)
yum install ffmpeg ffmpeg-devel -y # CentOS ffmpeg -versionOn Ubuntu, use apt install ffmpeg.
Missing Dependencies During Compilation
Install the following packages before rebuilding:
CentOS: yum install gcc gcc-c++ openssl-devel pkgconfig -y Ubuntu: apt install build-essential libssl-dev pkg-config -y After installing, repeat the compilation steps.
Docker Deployment (Optional)
If you prefer a quicker setup, you can run ZLMediaKit via Docker:
docker run -d --name zlm -p 9092:9092 -p 554:554 -p 1935:1935 zlmediakit/zlmediakit:latestMake sure the network mode allows the WVP service to reach the container ports.
Conclusion
Using the source‑build method gives you full control over configuration and compatibility, which is ideal for deep customization scenarios. After completing the steps above, WVP and ZLMediaKit are fully integrated, enabling GB28181 cameras, NVRs, and other devices to stream video, playback, and preview.
Dunmao Tech Hub
Sharing selected technical articles synced from CSDN. Follow us on CSDN: Dunmao.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
