ubuntu22.04搭建RTSP服务器

大致命令如下:

bash 复制代码
git clone --depth 1 git@github.com:ZLMediaKit/ZLMediaKit.git
sudo apt-get install build-essential
sudo apt-get install cmake
#除了openssl,其他其实都可以不安装
sudo apt-get install libssl-dev
sudo apt-get install libsdl-dev
sudo apt-get install libavcodec-dev
sudo apt-get install libavutil-dev
sudo apt-get install ffmpeg
cd ZLMediaKit
vi .git/config
cat .git/config
mkdir build
cd build
#macOS下可能需要这样指定openss路径:cmake .. -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2j/
cmake ..
make -j4

.git/config文件修改后内容如下:

bash 复制代码
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = git@github.com:ZLMediaKit/ZLMediaKit
	fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
	remote = origin
	merge = refs/heads/master
[submodule "ZLToolKit"]
	active = true
	url = git@github.com:ZLMediaKit/ZLToolKit
[submodule "3rdpart/jsoncpp"]
	active = true
	url = git@github.com:open-source-parsers/jsoncpp.git
[submodule "3rdpart/media-server"]
	active = true
	url = git@github.com:ireader/media-server
[submodule "www/webassist"]
	active = true
	url = git@github.com:1002victor/zlm_webassist

运行服务

bash 复制代码
cd ../release/linux/Debug
sudo systemctl stop nginx
# MediaServer绑定了80端口,所以需要先停掉nginx
sudo ./MediaServer -d &

注:服务器需开放554端口才能在本地访问到rtsp流

把mp4文件循环推给media server

bash 复制代码
ffmpeg -re -stream_loop -1 -i test.mp4 -vcodec h264 -acodec aac -f rtsp -rtsp_transport tcp rtsp://0.0.0.0/live/test
相关推荐
小小菜鸡ing3 小时前
pymysql
java·服务器·数据库
Mr. Cao code4 小时前
Docker:颠覆传统虚拟化的轻量级革命
linux·运维·ubuntu·docker·容器
wanhengidc4 小时前
云手机运行流畅,秒开不卡顿
运维·网络·科技·游戏·智能手机
笨小孩@GF 知行合一5 小时前
OSPF实验:外部路由引入
运维·网络·hcip·数通·ospf
asdfg12589635 小时前
为什么要在出口路由器router配置NAT与默认路由
运维·网络·计算机网络
当归10246 小时前
SQL Server死锁排查实战指南
java·服务器·网络
bug攻城狮6 小时前
Skopeo 工具介绍与 CentOS 7 安装指南
linux·运维·centos
宇宙第一小趴菜6 小时前
08 修改自己的Centos的软件源
linux·运维·centos
qinyia6 小时前
用 Wisdom SSH 轻松实现服务器自动化任务调度
服务器·自动化·ssh
bug攻城狮6 小时前
彻底禁用 CentOS 7.9 中 vi/vim 的滴滴声
linux·运维·服务器·centos·vim