ffmpeg+nginx视频服务器搭建
ffmpeg视频服务器搭建
ffmpeg安装
https://johnvansickle.com/ffmpeg/
#下载
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
#解压xz
xz -d ffmpeg-git-amd64-static.tar.xz
#解压tar
tar -xvf ffmpeg-git-amd64-static.tar
#进入目录(注意文件夹名称,20210920为版本号)
cd ffmpeg-git-20210920-amd64-static
#编译安装
./ffmpeg
#设置环境变量(注意项目路径)
cd /usr/bin
ln -s /usr/ffmpeg/ffmpeg-git-20210920-amd64-static/ffmpeg ffmpeg
ln -s /usr/ffmpeg/ffmpeg-git-20210920-amd64-static/ffprobe ffprobe
nginx配置nginx-rtmp-module
由于之前已经配置过nginx但没导入rtmp模块,所以要重新编译安装
下载nginx-rtmp-module
https://codechina.youkuaiyun.com/mirrors/arut/nginx-rtmp-module
#注意先备份原来的nginx配置!!!/etc/nginx/nginx.conf
#查看Nginx版本以及配置信息
nginx -V
#加入rtmp模块重新检测并编译(在nginx -V的信息后面加上--add-module=../nginx-rtmp-module-v1.2.2,具体看包路径能否访问到rtmp就行了)
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --