|
|
|
# 前提
|
|
|
|
1. 横琴海关处通过光纤连往公安处
|
|
|
|
2. 流媒体服务器 44.49.76.117
|
|
|
|
|
|
|
|
# 问题
|
|
|
|
1. 视频点播花屏
|
|
|
|
2. 视频点播超过三四路后点播失败
|
|
|
|
|
|
|
|
|
|
|
|
## 调整摄像头参数(解决花屏)
|
|
|
|
```
|
|
|
|
码流类型:主码流
|
|
|
|
视频类型:复合流 => 视频流
|
|
|
|
分辨率:1080P
|
|
|
|
码率类型:编码率 => 定码率
|
|
|
|
图像质量:中
|
|
|
|
视频帧率:15/20/25
|
|
|
|
码率上限:1080P(2048* or 4096),720P(1024* or 2048)
|
|
|
|
视频编码:H.264
|
|
|
|
Smart264:关闭
|
|
|
|
编码复杂度:高 => 低(能关闭最好关闭)
|
|
|
|
I帧间隔:视频帧率*2
|
|
|
|
SVC:关闭
|
|
|
|
```
|
|
|
|
|
|
|
|
## 修改 ffmpeg 参数(需要重新编译)
|
|
|
|
```
|
|
|
|
# https://blog.csdn.net/my_name_is_learn/article/details/107408551
|
|
|
|
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
|
|
|
|
# or
|
|
|
|
git clone -b release/5.0 https://github.com/FFmpeg/FFmpeg ffmpeg
|
|
|
|
cd ffmpeg
|
|
|
|
|
|
|
|
# 修改 udp.c 内的 UDP_MAX_PKT_SIZE 大小x10
|
|
|
|
#define UDP_MAX_PKT_SIZE (65536 * 10)
|
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
sudo apt install yasm
|
|
|
|
../configure
|
|
|
|
make -j4
|
|
|
|
sudo make install
|
|
|
|
```
|
|
|
|
|
|
|
|
## jemalloc
|
|
|
|
```
|
|
|
|
# https://github.com/jemalloc/jemalloc
|
|
|
|
# https://github.com/aerospike/jemalloc/blob/master/INSTALL
|
|
|
|
|
|
|
|
wget https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2
|
|
|
|
tar -xvf jemalloc-5.3.0.tar.bz2
|
|
|
|
cd jemalloc-5.3.0/
|
|
|
|
sudo apt -y install autogen autoconf
|
|
|
|
./autogen.sh
|
|
|
|
make -j4
|
|
|
|
sudo make install
|
|
|
|
sudo ldconfig
|
|
|
|
ldconfig -v | grep jemalloc
|
|
|
|
```
|
|
|
|
|
|
|
|
## 调整 ZLMediaKit 参数
|
|
|
|
```
|
|
|
|
git clone https://github.com/ZLMediaKit/ZLMediaKit
|
|
|
|
cd ZLMediaKit
|
|
|
|
git submodule update --init
|
|
|
|
sudo apt install -y build-essential cmake
|
|
|
|
mkdir build-debug build-release
|
|
|
|
cd build-debug
|
|
|
|
# 调试过程使用 Debug 版本,正式使用最好使用 Release 版本(默认 Debug)
|
|
|
|
cmake -DCMKAE_BUILD_TYPE=Debug ..
|
|
|
|
cmake -DCMKAE_BUILD_TYPE=Release ..
|
|
|
|
# or
|
|
|
|
vim CMakeLists.txt
|
|
|
|
SET(CMAKE_BUILD_TYPE "Debug”)
|
|
|
|
SET(CMAKE_BUILD_TYPE "Release")
|
|
|
|
cmake ..
|
|
|
|
make -j4
|
|
|
|
|
|
|
|
[api]
|
|
|
|
apiDebug=1 => 0
|
|
|
|
|
|
|
|
[general]
|
|
|
|
wait_track_ready_ms=3000 => 30000
|
|
|
|
wait_track_ready_ms=3000 => 30000
|
|
|
|
# 按需取流,按需求配置
|
|
|
|
|
|
|
|
[rtc]
|
|
|
|
externIP= => 对接网卡ip
|
|
|
|
```
|
|
|
|
|
|
|
|
## 调整 linux 参数
|
|
|
|
```
|
|
|
|
# https://github.com/ZLMediaKit/ZLMediaKit/issues/1221
|
|
|
|
# https://www.cnblogs.com/yorkyang/p/7689096.html
|
|
|
|
# https://github.com/ZLMediaKit/ZLMediaKit/issues/961
|
|
|
|
# https://codeantenna.com/a/GVZDrrzWI5
|
|
|
|
|
|
|
|
# 调整内核参数
|
|
|
|
cat /proc/sys/net/core/rmem_max
|
|
|
|
cat /proc/sys/net/core/wmem_max
|
|
|
|
## 212992(208KB)
|
|
|
|
## 从 208KB 调整至 1MB
|
|
|
|
## 临时修改
|
|
|
|
su
|
|
|
|
echo 1048576 > /proc/sys/net/core/rmem_max
|
|
|
|
echo 1048576 > /proc/sys/net/core/wmem_max
|
|
|
|
## 永久修改
|
|
|
|
sudo vim /etc/sysctl.conf
|
|
|
|
net.core.rmem_max = 1048576
|
|
|
|
net.core.wmem_max = 1048576
|
|
|
|
|
|
|
|
# 修改文件句柄数,添加参数
|
|
|
|
## 临时修改
|
|
|
|
ulimit -a
|
|
|
|
ulimit -n 65536
|
|
|
|
## 永久修改
|
|
|
|
sudo vim /etc/security/limits.conf
|
|
|
|
* soft nofile 32768
|
|
|
|
* hard nofile 65536
|
|
|
|
reboot
|
|
|
|
ulimit -a
|
|
|
|
```
|
|
|
|
|
|
|
|
# 调试工具
|
|
|
|
```
|
|
|
|
# 安装调试工具
|
|
|
|
sudo apt install -y linux-tools-common htop iftop
|
|
|
|
sudo add-apt-repository ppa:wireshark-dev/stable
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install wireshark
|
|
|
|
|
|
|
|
# 查看系统信息
|
|
|
|
top or htop
|
|
|
|
|
|
|
|
# 查看网络连接
|
|
|
|
netstat -tunlp
|
|
|
|
|
|
|
|
# 查看带宽
|
|
|
|
iftop
|
|
|
|
|
|
|
|
# 查看 udp 丢包
|
|
|
|
cat /proc/net/snmp | grep -w Udp
|
|
|
|
|
|
|
|
# 网络抓包
|
|
|
|
tcpdump #https://blog.csdn.net/weixin_36338224/article/details/107035214
|
|
|
|
wireshark
|
|
|
|
|
|
|
|
# 性能测试
|
|
|
|
# https://github.com/zlmediakit/ZLMediaKit/wiki/Benchmark
|
|
|
|
|
|
|
|
```
|
|
|
|
|