CentOS7.8.2003 搭建Nginx-rtmp-ffmpeg流服务器
查看系统版本
[root@VM-0-8-centos ~]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
安装ffmpeg
注: 此 ffmpeg 安装方式适用于CentOS 7
准备环境
安装EPEL Release,因为安装需要使用其他的repo源,所以需要EPEL支持:
[root@VM-0-8-centos nginx-rtmp-ffmpeg]# yum install -y epel-release
...........
Complete!
#如果出现缺少Code提示,可以:
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
安装完成之后,可以查看是否安装成功
[root@VM-0-8-centos /]# yum repolist
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.yun-idc.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10070
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13426
extras/7/x86_64 CentOS-7 - Extras 413
updates/7/x86_64 CentOS-7 - Updates 1125
repolist: 27758
安装Nux-Dextop源
由于CentOS没有官方FFmpeg rpm软件包,所以使用第三方YUM源(Nux Dextop)完成此工作。
#导入一个Code
[root@VM-0-8-centos nginx-rtmp-ffmpeg]# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
#安装nux-dextop 源
[root@VM-0-8-centos nginx-rtmp-ffmpeg]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Retrieving http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:nux-dextop-release-0-5.el7.nux ################################# [100%]
#查看repo源是否安装成功
[root@VM-0-8-centos nginx-rtmp-ffmpeg]# yum repolist
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.yun-idc.com
* extras: mirrors.aliyun.com
* nux-dextop: li.nux.ro
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10070
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13426
extras/7/x86_64 CentOS-7 - Extras 413
nux-dextop/x86_64 Nux.Ro RPMs for general desktop use 2724
updates/7/x86_64 CentOS-7 - Updates 1125
repolist: 27758
安装ffmpeg
#yum安装ffmpeg:
[root@VM-0-8-centos nginx-rtmp-ffmpeg]# yum install ffmpeg ffmpeg-devel -y
#安装完成后检查ffmpeg 版本:
[root@VM-0-8-centos /]# ffmpeg -version
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avre