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
相关推荐
LedgerNinja27 分钟前
WEEX API 自动化交易实践:下单、撤单、订单查询与状态闭环
运维·自动化
山峰哥1 小时前
数据库性能救星:Explain执行计划深度拆解
服务器·开发语言·数据库·sql·启发式算法
执笔画流年呀1 小时前
Linux搭建Java项目部署环境
java·linux·运维
Dory_Youth2 小时前
联想笔记本电脑失灵
运维·笔记·电脑
W.W.H.2 小时前
嵌入式 Linux外接USB/WIFI模块兼容5G频段实战
linux·运维·5g·wifi
运维大师2 小时前
【K8S 运维实战】24-资源优化HPA与VPA
运维·kubernetes·github
GlobalHRTalk2 小时前
埃及名义雇主EOR业务概述与市场发展优势分析
大数据·运维·人工智能
瞬间&永恒~2 小时前
【MySQL】 主从复制多拓扑搭建实验
运维·数据库·mysql·云原生
aramae3 小时前
C++ IO流完全指南:从C标准库到C++流式编程
服务器·c语言·开发语言·c++·后端
星野爱8954 小时前
远程控制哪家安全性更高?ToDesk、UU远程、向日葵隐私屏深度测评!
linux·运维·网络