添加RPMfusion仓库
yum install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
安装SDL
yum install http://rpmfind.net/linux/epel/7/x86_64/Packages/s/SDL2-2.0.14-2.el7.x86_64.rpm
安装FFmpeg
yum install ffmpeg
执行命令测试
[root@VM-0-2-centos /]# ffmpeg ffmpeg version 4.2.8 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 8 (GCC)
使用ffmpeg推流:
ffmpeg -re -stream_loop -1 -i "videoname.mp4" -c copy -f flv "${rtmp}"
将rtmp替换为推流地址即可;
让命令后台运行:
将推流命令写入sh文件,执行如下命令
nohup push.sh &