AI Summary 11.11757.8 centos ffmpeg摘要 2026-07-25
centos ffmpeg

centos ffmpeg

FFmpeg is a powerful open-source tool for handling multimedia files. Below are common methods to install FFmpeg on CentOS.

Method 1:

方法三:使用静态二进制文件(免安装)
# 1. 下载预编译静态二进制文件(来自官方推荐)
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz

# 2. 解压
tar xvf ffmpeg-release-amd64-static.tar.xz
cd ffmpeg-*-static

# 3. 复制到系统路径
sudo cp ffmpeg ffprobe /usr/local/bin/

# 4. 验证安装
ffmpeg -version



Method 2:
Install via RPM Fusion Repository This method is straightforward and uses pre-built packages.
Steps:
Enable EPEL Repository Run the following command to enable the EPEL repository:

# 1. 安装 EPEL 仓库
sudo yum install epel-release

# 2. 启用 RPM Fusion 仓库
# CentOS 7:
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm

# CentOS 8:
sudo dnf install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
sudo dnf install --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm

# 3. 安装 FFmpeg
# CentOS 7:
sudo yum install ffmpeg ffmpeg-devel

# CentOS 8:
sudo dnf install ffmpeg ffmpeg-devel

# 4. 验证安装
ffmpeg -version


Method 3:
Compile from Source
This method provides the latest version but requires more steps.

Steps:
Install Dependencies Install required tools and libraries:

# 安装常见依赖
sudo yum install autoconf automake bzip2 cmake gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel


Download FFmpeg Source Code Clone the FFmpeg repository:

# 1. 安装开发工具和依赖库

sudo yum groupinstall "Development Tools"

sudo yum install yasm-devel libass-devel freetype-devel libmp3lame-devel libtheora-devel libvorbis-devel opus-devel libvpx-devel x264-devel x265-devel


# 2. 下载 FFmpeg 源码

wget https://ffmpeg.org/releases/ffmpeg-latest.tar.gz

tar xvf ffmpeg-latest.tar.gz

cd ffmpeg-*


# 3. 配置和编译

./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265



make -j$(nproc)

sudo make install


# 4. 添加库路径

echo '/usr/local/lib' | sudo tee /etc/ld.so.conf.d/ffmpeg.conf

sudo ldconfig


# 5. 验证安装

/usr/local/bin/ffmpeg -version


Usage Example
Convert an MP4 file to WebM format:

ffmpeg -i input.mp4 output.webm


Use Method 1 for simplicity and Method 2 for customization or newer versions.
Always verify dependencies when compiling from source to avoid errors.