FFmpeg安装,AAC编码器安装

本指南详细介绍了如何在CentOS/RHEL系统上安装FFmpeg、x264和其他音视频编码库,适用于购买VPS或搭建CumulusClips基础设施。

Intro

This guide is meant to walk system administrators through the process of setting up ffmpeg, x264, and the codecs & libraries required to run the CumulusClips on CentOS 5.5 (or higher) and Red Hat (RHEL) Linux. This is helpful if you purchased a VPS or dedicated server to run CumulusClips, or if you’re a hosting company setting up your infrastructure to support CumulusClips. This guide was adapted from the following two guides:

http://www.pawprint.net/news/article/105/Compiling-FFMpeg-on-Centos-5/
http://ubuntuforums.org/showthread.php?t=786095

The version numbers of the various downloads were the latest at the time of this writing (9/17/2011). Please check the respective vendors’ sites to ensure you obtain the latest stable version of each library

Prepare Your System

Add EPEL Repository to CentOS / RHEL. Only the core and EPEL repositories are required for this guide. This is to obtains the necessary tools for the install process, not the actual codecs & libraries themselves. Those will be compiled from source.

Remove any of the codecs that were pre-installed.

1
yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg

Update your system and install the tools required for compiling and installing all the codecs.

1
2
yum update
yum install gcc gcc-c++ automake autoconf libtool yasm nasm git subversion

Temporarily disable your firewalls and SELinux

1
2
3
iptables -F
service iptables save
vi /etc/selinux/config

Set the SELinux value to disabled. Make sure your shared library paths are in order

1
2
3
export LD_LIBRARY_PATH=/usr/local/lib/
echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf
ldconfig

Codecs

Xvid Codec

Visit the Xvid site to retrieve the latest version of the codec.

1
2
3
4
5
6
7
tar -zxf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure
make && make install
ldconfig
cd

Lame Codec

Visit the LAME MP3 Encoder project to obtain their latest version.

1
2
3
4
5
6
7
tar -zxf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure
make && make install
ldconfig
  cd

Faac Codec

Visit the AudioCoding site for the latest version of the codec.

1
2
3
4
5
6
7
8
tar -xzf faac-1.28.tar.gz
cd faac-1.28
./bootstrap
./configure
make && make install
ldconfig
cd

OpenCore AMR Codec

Get the latest version of OpenCore AMR from their repository at SourceForge.

1
2
3
4
5
6
7
tar -xzf opencore-amr-0.1.2.tar.gz
cd opencore-amr-0.1.2
./configure
make && make install
ldconfig
cd

OGG Codec

Visit Xiph.org for the latest version of libogg.

1
2
3
4
5
6
7
tar -xzf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure
make && make install
ldconfig
cd

Vorbis Codec

Visit Xiph.org for the latest version of Vorbis (libvorbis).

1
2
3
4
5
6
7
tar -xjf libvorbis-1.3.2.tar.bz2
cd libvorbis-1.3.2
./configure
make && make install
ldconfig
  cd

Theora Codec

Visit Theora.org for the latest version of Theora (libtheora).

1
2
3
4
5
6
7
tar -xjf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure
make && make install
ldconfig
  cd

x264

1
2
3
4
5
6
cd x264
./configure --enable-static
make && make install
ldconfig
cd

FFMPEG

1
2
3
4
5
6
7
8
9
cd ffmpeg
./configure --enable-version3 --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libvpx --enable-libfaac \
--enable-libmp3lame --enable-libtheora --enable-libvorbis \
--enable-libx264 --enable-libxvid --enable-gpl --enable-postproc \
--enable-nonfree
make && make install
ldconfig

qt-faststart

qt-faststart ships with FFMPEG. No seprate download is required for it. At this point you should still be in the ffmpeg directory.

1
2
3
4
5
cd tools
make qt-faststart
cp qt-faststart /usr/local/bin
ldconfig
cd
### 安装 FFmpeg 及其编码器 #### 使用包管理器安装 FFmpeg 对于基于 Debian 的 Linux 发行版,如 Ubuntu,可以通过 `apt-get` 来轻松安装 FFmpeg 和它的依赖项。执行以下命令可以完成这一过程: ```bash sudo apt-get update && sudo apt-get install ffmpeg ``` 这条命令不仅会更新软件源列表以获取最新的可用版本信息,还会下载并安装 FFmpeg 软件包以及任何必要的依赖库[^1]。 为了验证安装是否成功,可以在终端输入 `ffmpeg -version` 并查看是否有返回 FFmpeg 版本号的信息。如果有显示具体的版本号码,则说明 FFmpeg 已经正确安装;如果没有输出或提示找不到命令,则可能意味着安装过程中出现了某些问题[^2]。 #### 编译安装 FFmpeg (含特定编码器) 有时默认通过包管理器提供的 FFmpeg 可能不包含所有期望的功能或是最新特性。此时可以选择自行编译 FFmpeg,并加入所需的外部编码器支持,比如 libfdk_aac 或者其他专有的音频/视频编码工具。以下是简化后的步骤概述: - 获取 FFmpeg 源代码; - 下载额外的第三方库(例如 fdk-aac, x264/x265 等); - 配置构建选项来启用这些附加功能; - 进行实际编译工作; - 将新编译好的二进制文件复制到适当位置以便全局访问。 请注意,这种方法通常适用于高级用户或者是有特殊需求的情况,在大多数情况下推荐使用官方预编译版本即可满足日常开发测试的需求。 #### 提取 MP4 文件中的音频并转换成 AAC 格式 假设有一个名为 `a.mp4` 的视频文件想要从中抽取音频流并转码为 AAC 格式的音频文件,那么可以利用下面给出的 FFmpeg 命令实现此目的: ```bash ffmpeg -i a.mp4 -vn -c:a aac -ar 44100 -ac 2 -profile:a aac_low output.aac ``` 这里 `-vn` 参数用于忽略视频轨道而只保留音频部分,`-c:a aac` 设置目标音频编解码器为 AAC,同时指定了采样率 (`-ar`)、声道数目 (`-ac`) 和编码质量等级 (`-profile:a`)[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值