Use SIP (wvp) + streaming media server (ZLMediaKit) to implement gb28181 rtp streaming and playback

 

Use SIP (wvp) + streaming media server (ZLMediaKit) to realize gb28181 rtp streaming and playback, realize camera monitoring and playback through gb28181, and PTZ control experience case!

Preparation content

1. Operating system environment, I use Aliyun centos 7.7 here

2. One Haikang PTZ camera and one NVR

3. Environment specific cmake 3.1.3 conditions, ZLMediaKit build needs to be used

4. Download the Java open source project WVP for SIP

5. Download redies to support SIP services

6. Download the streaming media server ZLMediaKit

The steps are as follows:

1. Install cmake version 3.1.3 and above

Installation method source: https://www.cnblogs.com/zychengzhiit1/p/5628711.html

Install the tools and libraries needed to compile the source code

yum install gcc gcc-c++ ncurses-devel perl  

Download cmake

 wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz

Move tar.gz to the /usr/local/ directory

Unzip and view:

tar zxvf cmake-3.3.2.tar.gz
cd cmake-3.3.2 
ls 查看

Compile and install

./configure
make
make install

Set global variables

 Use vi to add variables to the file /etc/profile to make it permanent:

vi /etc/profile   // 修改环境变量

Append the following two lines of code at the end of the file: 

PATH=/usr/local/cmake/bin:$PATH
export PATH

Then do the following:

source /etc/profile   //使修改生效 
echo $PATH  //查看PATH值

Check cmake installation

cmake --version

 

Two, install ZLMediaKit

Open source address: https://github.com/linyihong-git/ZLMediaKit

#国内用户推荐从同步镜像网站gitee下载 
git clone --depth 1 https://gitee.com/xiahcu/ZLMediaKit
cd ZLMediaKit
git submodule update --init

Build and compile the project

Under linux or macOS, you should do this:

cd ZLMediaKit
mkdir build
cd build
#macOS下可能需要这样指定openss路径:cmake .. -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2j/
cmake ..
make -j4

Start under linux:

cd ZLMediaKit/release/linux/Debug
#通过-h可以了解启动参数
./MediaServer -h
#以守护进程模式启动
./MediaServer -d &

 

Three, redies installation

Reference: https://www.cnblogs.com/autohome7390/p/6433956.html

Need to change bind 127.0.0.1 to bind 0.0.0.0 to access the Internet

 

Fourth, download the SIP project source code

Open source address: https://github.com/swwheihei/wvp

Modify configuration file parameters, run wvp project

 

Five, push and play

Configure the gb28181 parameters and sip address of the camera, SIP ID

1. Push streaming execution

http://127.0.0.1:8080/api/play/34020000001110000001/78978201001320000025

Return ssrc{"ssrc":"0200004754"}

ssrc converted to 16 after proceeding = 0BEBD193

View zlmk push streaming

The playback address is played in vlc as follows:

rtsp://147.15.1.118:554/rtp/0BEBD4F4?token=abcdefg&field=value
rtmp://147.15.1.118/rtp/0BEBD4F4
http://147.15.1.118/rtp/0BEBD4F4.flv
http://147.15.1.118/rtp/0BEBD4F4/hls.m3u8

The rules of the playback address are as follows:

https://github.com/xiongziliang/ZLMediaKit/wiki/%E6%92%AD%E6%94%BEurl%E8%A7%84%E5%88%99

2. PTZ control execution

http://127.0.0.1:8080/api/ptz/34020000001110000001/78978201001320000025?leftRight=1&upDown=0&inOut=0&moveSpeed=50&zoomSpeed=1

The number of zoomSpeed cannot be too large, otherwise it won’t work and it’s invalid

3. Check the streaming status of the streaming server

http://47.115.1.118/index/api/getMediaList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc

Guess you like

Origin blog.csdn.net/qq_16005627/article/details/106156444