centos7.9安装ffmpeg6.1和NASM、Yasm、x264、x265、fdk-aac、lame、opus解码器

1. 安装基础依赖

bash 复制代码
sudo yum update -y
sudo yum groupinstall "Development Tools" -y
sudo yum install epel-release -y
sudo yum install cmake3 git wget mercurial -y

2、创建编译目录

bash 复制代码
mkdir -p ~/xsources

3. 安装NASM

bash 复制代码
cd ~/xsources
wget https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/nasm-2.16.01.tar.gz
tar xzf nasm-2.16.01.tar.gz
cd nasm-2.16.01
./autogen.sh
./configure
make -j$(nproc)
sudo make install

4. 安装Yasm

bash 复制代码
cd ~/xsources
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make -j$(nproc)
sudo make install

5. 安装x264(H.264编码器)

bash 复制代码
cd ~/xsources
git clone https://code.videolan.org/videolan/x264.git --depth=1
cd x264
./configure --enable-static --enable-shared
make -j$(nproc)
sudo make install
sudo ldconfig

6. 安装x265(H.265编码器)

踩坑:安装其它版本易报错

bash 复制代码
cd ~/xsources
wget https://download.videolan.org/pub/videolan/x265/x265_3.5.tar.gz
tar xzf x265_3.5.tar.gz
cd x265_3.5/build/linux
cmake3 -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local ../../source
make -j$(nproc)
sudo make install
sudo ldconfig

7. 安装fdk-aac(AAC音频编码器)

bash 复制代码
cd ~/xsources
wget https://downloads.sourceforge.net/opencore-amr/fdk-aac-2.0.3.tar.gz
tar xzf fdk-aac-2.0.3.tar.gz
cd fdk-aac-2.0.3
./configure --disable-shared
make -j$(nproc)
sudo make install

8. 安装LAME(MP3编码器)

bash 复制代码
cd ~/xsources
wget https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
tar xzf lame-3.100.tar.gz
cd lame-3.100
./configure --disable-shared
make -j$(nproc)
sudo make install

9. 安装Opus(音频编码器)

bash 复制代码
cd ~/xsources
wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
tar xvf opus-1.3.1.tar.gz
cd opus-1.3.1
./configure --enable-shared
make -j$(nproc)
sudo make install
sudo ldconfig
ls /usr/local/lib/pkgconfig/opus.pc
echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH' | sudo tee -a /etc/profile
source /etc/profile
pkg-config --libs --cflags opus

10. 安装FFmpeg

bash 复制代码
cd ~/xsources
wget https://ffmpeg.org/releases/ffmpeg-6.1.tar.xz
tar xJf ffmpeg-6.1.tar.xz
cd ffmpeg-6.1
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure \
  --prefix=/usr/local \
  --enable-gpl \
  --enable-nonfree \
  --enable-libfdk-aac \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libx264 \
  --enable-libx265 \
  --extra-cflags="-I/usr/local/include" \
  --extra-ldflags="-L/usr/local/lib"
make -j$(nproc)
sudo make install
sudo ldconfig

11. 验证安装

bash 复制代码
# 查看版本
ffmpeg -version

# 检查编解码器支持
ffmpeg -codecs | grep -E '264|265|fdk|mp3|opus'
相关推荐
Mahut1 天前
我用 Electron + FFmpeg 做了一个本地视频处理工作站 ClipForge
前端·ffmpeg·electron
2601_9618752411 天前
决战申论100题2026|最新|范文
linux·容器·centos·debian·ssh·fabric·vagrant
源之缘-OFD先行者11 天前
破界渲染:WinForm下的FFmpeg+Vortice极速推流引擎
ffmpeg·winform·推流·h264
源来猿往11 天前
记ffmpeg-8.1.1 之Android库编译(window)
android·ffmpeg
wcy1008611 天前
为 CentOS 7.6 (7.6.1810) 配置阿里云 Vault 源
linux·阿里云·centos
Deitymoon11 天前
RV1126+FFMPEG多路码流监控项目
ffmpeg·音视频
芝麻别开门11 天前
GStreamer DASH Demux 知识文档
ffmpeg·dash
ltlovezh11 天前
ROI 编码学习指南:Android 与 FFmpeg 的真实实现边界
android·ffmpeg·音视频开发
狮子再回头12 天前
relhat9.1 yum无法安装问题
linux·运维·centos
IT199512 天前
踩坑实录:CentOS 默认 Fail2Ban 挡不住高频并发攻击,漏洞修复一步到位
linux·运维·centos