CentOS 编译安装 FFmpeg 并启用 lib264 库

7人浏览 / 0人评论

参考:

https://blog.csdn.net/weixin_38022219/article/details/113916890

https://blog.csdn.net/DlongG/article/details/155860720

https://developer.aliyun.com/article/1600043

FFmpeg下载地址:https://ffmpeg.org//download.html#releases

x264

git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-shared --enable-static --prefix=/usr/local/x264
make && make install

vim /etc/profile
# 追加:
export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig:$PKG_CONFIG_PATH

# 执行刷新:
source /etc/profile

FFmpeg

# 安装 EPEL 仓库(基础依赖)
sudo yum install -y epel-release
 
# 安装 RPM Fusion Free 仓库(FFmpeg 核心依赖)
sudo rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
 
# (可选)安装 RPM Fusion Nonfree 仓库(如需支持非免费编码,如 h264 等)
sudo rpm -Uvh https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm

cd /home
wget https://ffmpeg.org//releases/ffmpeg-8.1.tar.gz
tar -zxvf ffmpeg-8.1.tar.gz
cd ffmpeg-8.1
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264
make && make install 

# 如果报错:
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
# 执行:
yum install -y yasm
# 或
yum install -y nasm

vim /etc/ld.so.conf
# 追加一行:
/usr/local/ffmpeg/lib/

# 执行刷新:
ldconfig

全部评论