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'
相关推荐
何中应6 小时前
CentOS 7安装、卸载MySQL数据库(二)
数据库·mysql·centos
luoqice10 小时前
RTMP视频流的帧格式分析
网络·ffmpeg
idolao1 天前
CentOS 7 安装 jakarta-tomcat-connectors-jk2-src-current.tar.gz 详细步骤(解压、编译、配置)
linux·centos·tomcat
老姚---老姚1 天前
编译支持HEVC/H.265 over RTMP / Enhanced RTMP 的 ffmpeg
ffmpeg·h.265·hevc·rtmp·enhanced
HABuo2 天前
【linux(四)】套接字编程--基于UDP协议的客户端服务端
linux·服务器·c++·网络协议·ubuntu·udp·centos
fred_kang2 天前
firewalld 防火墙操作手册
centos
__beginner__2 天前
CentOS 磁盘占用异常排查与处理手册(df 高、du/ncdu 低)
linux·运维·centos
码流怪侠2 天前
FFmpeg 开发实战全解析:从入门到精通(附完整代码示例)
ffmpeg·音视频开发·视频编码
tianyuanwo2 天前
CentOS 7 使用 CentOS 8 YUM 源报错 “Invalid version flag: if” 深度解析
python·centos·yum
圆弧YH2 天前
FFmpeg
ffmpeg