安装 MediaMTX
下载
wget https://github.com/bluenviron/mediamtx/releases/download/v1.9.1/mediamtx_v1.9.1_linux_amd64.tar.gz
解压
mkdir -p ~/mediamtx
tar -xvzf mediamtx_v1.9.1_linux_amd64.tar.gz -C ~/mediamtx
设置可执行权限
cd ~/mediamtx
chmod +x mediamtx
设置环境变量
echo 'export PATH=$PATH:$(pwd)' >> ~/.bashrc
source ~/.bashrc
启动
mediamtx
安装 FFmpeg
下载
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
解压
tar -xvJf ffmpeg-release-amd64-static.tar.xz
设置可执行权限,注意解压出来的可能不是【ffmpeg-7.0.2-amd64-static】,版本可能不一样
cd ~/ffmpeg-7.0.2-amd64-static
chmod +x ffmpeg
设置环境变量
echo 'export PATH=$PATH:$(pwd)' >> ~/.bashrc
source ~/.bashrc
使用
ffmpeg
模拟 RTSP
ffmpeg 参数看着调,参考:ffmpeg.org/ffmpeg.html…
ffmpeg -re -stream_loop -1 -i ~/m2inf.mp4 -preset veryfast -r 24 -vf scale=-1:720 -b:v 1000k -an -f rtsp rtsp://127.0.0.1:8554/m2inf