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
相关推荐
Sinclair2 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
Rockbean3 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪3 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩3 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
海天鹰4 天前
【免费】PHP主机=域名+解析+主机
服务器
DianSan_ERP4 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅4 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒4 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
芝士雪豹只抽瑞克五4 天前
Nginx 高性能Web服务器笔记
服务器·nginx
失重外太空啦4 天前
Tomcat
java·服务器·tomcat