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
相关推荐
鸠摩智首席音效师5 小时前
linux 系统中 Shutting Down, Restarting, Halting 有什么区别 ?
linux·运维·服务器
CIb0la5 小时前
Linux 将继续不支持 HDMI 2.1 实现
linux·运维·服务器
吕了了6 小时前
85 微PE吕了了修改版--更新!
运维·windows·电脑·系统
鹿鸣天涯6 小时前
Kali Linux 2025.4 发布:桌面环境增强,新增 3 款安全工具
linux·运维·安全
峥嵘life7 小时前
Android16 EDLA 认证测试CTS问题分析解决
android·java·服务器
学习&笔记7 小时前
MTK(系统篇)user版本无法使用setenforce 0命令关闭selinux权限
linux·运维·服务器
Bdygsl7 小时前
Linux(8)—— 进程优先级与环境变量
linux·运维·服务器
吕了了8 小时前
87 Windows 系统安装的本质是什么?
运维·windows·电脑·系统
阿里巴巴P8资深技术专家9 小时前
docker容器启动报错
运维·docker·容器
杨云龙UP9 小时前
MySQL 8.0.x InnoDB 写入链路优化:Redo Log 与 Buffer Pool 扩容与缓冲区调优实战记录-20251029
linux·运维·数据库·sql·mysql