FFmpeg 是一个非常热门的开源项目,用来编解码音频视频流,被广泛用于各种流服务中。本教程在 CentOS 6、7、8 上面都可以使用,用来安装 FFmpeg 软件。
文章源自国外主机测评-https://www.zjcp.org/14688.html
一、安装前需求
- 一台安装了 CentOS 系统的 Linux VPS
- 一个 sudo 账户,一般都是默认 root 账户即可。
- 更新系统
二、CentOS 安装 FFmpeg 教程
1、CentOS 8文章源自国外主机测评-https://www.zjcp.org/14688.html
安装所需依赖:文章源自国外主机测评-https://www.zjcp.org/14688.html
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo yum install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
$ sudo yum install http://rpmfind.net/linux/epel/7/x86_64/Packages/s/SDL2-2.0.10-1.el7.x86_64.rpm
安装 FFmpeg:文章源自国外主机测评-https://www.zjcp.org/14688.html
# sudo yum install ffmpeg ffmpeg-devel
2、CentOS 7文章源自国外主机测评-https://www.zjcp.org/14688.html
安装 Nux Desktop:文章源自国外主机测评-https://www.zjcp.org/14688.html
$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
安装 FFmpeg:文章源自国外主机测评-https://www.zjcp.org/14688.html
$ sudo yum install ffmpeg ffmpeg-devel -y
3、CentOS 6文章源自国外主机测评-https://www.zjcp.org/14688.html
安装 Nux Desktop:文章源自国外主机测评-https://www.zjcp.org/14688.html
$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
安装 FFmpeg:文章源自国外主机测评-https://www.zjcp.org/14688.html
$ sudo yum install ffmpeg ffmpeg-devel -y
三、测试安装是否成功
1、查看版本
$ ffmpeg -version
2、测试样例(MP3 -> OGG)
$ cd
$ wget https://archive.org/download/MLKDream/MLKDream_64kb.mp3
$ ffmpeg -i MLKDream_64kb.mp3 -c:a libvorbis -q:a 4 MLKDream_64kb.ogg
3、测试样例(MP4 -> OGG)
$ cd
$ wget https://archive.org/30/items/I_Have_A_Dream_Speech_excerpt/I_Have_A_Dream_Speech_excerpt.mpeg4 -O MLKDream.mpeg4
$ ffmpeg -i MLKDream.mpeg4 -codec:v libtheora -qscale:v 3 -codec:a libvorbis -qscale:a 3 -f ogv MLKDream.ogv