Centos8下编译安装最新版ffmpeg解决方案(含Centos8换源阿里云)

1、下载FFmpeg源代码

  • FFmpeg官网(https://ffmpeg.org/download.html)
  • git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

在这里插入图片描述

2、安装依赖

  • FFmpeg的编译过程需要依赖一些其他的库文件,例如libx264、libmp3lame、libopus等。
  • sudo yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel

在这里插入图片描述

3、配置编译选项(关键)

  • 启用GPL和非自由许可证,同时启用libx264、libmp3lame、libopus、libvpx和libass等库的支持。

  • ./configure --enable-shared --disable-static --enable-gpl --enable-nonfree --enable-libx264 --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libass

  • 这一步将生成用于下一步编译用的make文件,这一步如果执行失败,是无法进行下一步编译的。
    这是成功的图:
    在这里插入图片描述

linux依赖手动编译安装

  • 提供一些失败的解决方案:
    告诉你缺了xxxx库
手动wget+make安装
wget https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/nasm-2.16.01.tar.gz
tar -xvf nasm-2.16.01.tar.gz
./configure
make
sudo make install

  • 缺少依赖的解决方案
    在这里插入图片描述

sudo find / -name "libavdevice.so.60“
sudo ldconfig
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

另外,装个 EPEL 仓库

  • sudo yum install epel-release

遇到的其他一些包的缺失

  • sudo yum install mercurial
    hg version
  • sudo yum install -y nasm yasm
  • pkg-config --modversion libass
    tar -xvf libass-<version>.tar.gz
    cd libass-<version>
    ./configure
    make
    sudo make install
  • sudo yum update libass
  • luaCopy code
    pkg-config --modversion libass
  • sudo yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel

其他缺失包2

  • sudo yum install libvdpau
  • sudo yum install SDL

可能还有一些,反正缺啥装啥就行
Nux Dextop 软件源仓库一定要装,其他有最好,没有就换阿里云源,再不行官网下载,手动编译安装。

——————————————————————————

centos8换源阿里云

# 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

# 换源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

# 清理缓存
yum clean all

# 生成缓存
yum makecache 

# 更新最新源设置
yum update -y


4、编译源代码

  • make即可
    在这里插入图片描述

5、安装FFmpeg

  • 编译完成后,执行以下命令进行安装:
    sudo make install
    在这里插入图片描述

6、验证安装

  • ffmpeg -version
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_33957603/article/details/130585204