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
相关推荐
java_logo13 分钟前
QWEN3 企业级 Docker 容器化部署指南
运维·docker·容器·qwen3部署·qwen3部署文档·qwen3部署教程·qwen3部署方案
糖~醋排骨13 分钟前
DHCP服务的搭建
linux·服务器·网络
huohaiyu19 分钟前
网络中的一些基本概念
运维·服务器·网络
Kiyra20 分钟前
虚拟机假死?SSH 能连却卡 Logo 界面
运维·ssh
dust_and_stars33 分钟前
ubuntu24使用apt安装VS-code-server code-server
linux·服务器·windows
tap.AI1 小时前
Deepseek(九)多语言客服自动化:跨境电商中的多币种、多语种投诉实时处理
运维·人工智能·自动化
ling-451 小时前
Linux-day09 11
linux·运维·服务器
202321336054 刘1 小时前
Linux常用命令分类整理
linux·运维·数据库
zbguolei1 小时前
Debian提示:“用户名” 不是 sudoers 文件
linux·服务器·debian
oMcLin1 小时前
如何在 Debian 11 上通过配置 LVM 和 RAID 结合,提升大规模存储系统的性能与冗余性
运维·debian