一、yum安装FFmpeg

1.    最偷懒的方式就是yum安装了,自动解决依赖。不过CentOS系统默认无FFmpeg源,企业版 Linux 附加软件包EPEL源也不包含,需要手动添加yum源配置/etc/yum.repos.d/dag.repo:

 
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=0
enabled=1

2.    在线安装FFmpeg

 
yum -y install ffmpeg

二、编译安装FFmpeg

yum安装FFmpeg比源码编译安装省时省力,但缺点也很明显,版本过老,为0.6.5版,最新版已为2.6.3,新旧版很多参数有所差异,旧版支持的格式也没有新版丰富。

源码编译安装FFmpeg非常需要耐心,每添加一种需要支持的格式就需要有相应的多媒体格式开发库。文中所使用的软件版本皆为最新版。

1.    安装autoconf

 
cd /App/src
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz    
tar xvf autoconf-2.69.tar.xz
cd autoconf-2.69
./configure
make
make install

2.    安装automake

cd /App/src
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz  
tar xvf automake-1.15.tar.xz
cd automake-1.15
./configure
make
make install

3.    安装libtool(FAAC需要)

cd /App/src
wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz
tar xvf libtool-2.4.6.tar.xz
cd libtool-2.4.6
./configure
make
make install

4.    安装yasm支持汇编优化(FFmpeg需要)

cd /App/src
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install

5.    添加动态链接库配置

 
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf

6.    安装MP3支持库LAME

cd /App/src
wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz  
tar xvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make install

7.    安装AAC支持库FAAC

make时报错:mpeg4ip.h:126: 错误:对‘char* strcasestr(const char*, const char*)’的新声明

需要修改common/mp4v2/mpeg4ip.h第123行至129行内容:

#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

修改为:

#ifdef __cplusplus
extern "C++" {
#endif
const char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
cd /App/src
wget http://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2 
tar xvf faac-1.28.tar.bz2
cd faac-1.28
./bootstrap
./configure --with-mp4v2 
#按前文修改mpeg4ip.h内容
make
make install

8.    安装AMR支持库opencore-amr

cd /App/src
wget http://jaist.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar xvf opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure
make
make install

9.    安装通用音乐音频编码格式支持库libvorbis

# libvorbis需要libogg,先安装libogg库
cd /App/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz
tar xvf libogg-1.3.2.tar.xz
cd libogg-1.3.2
./configure
make
make install
 
cd /App/src
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz
tar xvf libvorbis-1.3.5.tar.xz
cd libvorbis-1.3.5
./configure
make
make install

10.    安装x264库支持H.264视频转码

cd /App/src
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-shared
make
make install

11.    安装Xvid库支持MPEG-4转码

cd /App/src
wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.bz2
tar xvf xvidcore-1.3.3.tar.bz2
cd xvidcore/build/generic
./configure
make
make install

12.    安装Theora视频压缩支持库

cd /App/src
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xz
tar xvf libtheora-1.1.1.tar.xz
cd libtheora-1.1.1
./configure
make
make install

13.    安装NUT支持库

安装时64位Linux系统需要修改文件config.mak

在最后一个CFLAGS下一行增加:

CFLAGS += -fPIC

否则安装FFmpeg make时报错:

/usr/local/lib/libnut.a: could not read symbols: Bad value

 
cd /App/src
svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut
cd libnut
./configure
make
make install

14.    安装VP8/VP9编解码支持库

 
cd /App/src
git clone http://git.chromium.org/webm/libvpx.git 
cd libvpx
./configure --enable-shared
make
make install

15.    安装FFmpeg最新版

cd /App/src
wget http://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2
tar xvf ffmpeg-2.6.3.tar.bz2
cd ffmpeg-2.6.3
./configure --enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libnut --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared
make
make install
ldconfig

16.    安装segmenter

git clone https://github.com/johnf/m3u8-segmenter
cd m3u8-segmenter
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure
make
make install
ln -s /usr/local/bin/m3u8-segmenter /usr/local/bin/segmenter

三、    编译安装注意事项

1.    可能发现编译FFmpeg或者其他支持库时,即使相关的所有依赖也编译安装上了,仍然make报错,主要的原因还是由于依赖的库版本冲突,编译时调用的是yum安装时自动下载安装的旧版本依赖库。此时的方法就是卸掉所有yum安装的旧版本FFmpeg和相关的依赖软件包或者重新找台新的纯净的系统重新开始安装,或者使用Ubuntu Server最新版,一般Ubuntu Server最新版FFmpeg版本还是比较新的,直接执行命令 sudo apt-get install ffmpeg会自动安装FFmpeg和相关依赖。

2.    有爱专研的或者受制于手头无多余机器的,只能老老实实得卸载旧软件,从头开始编译安装。如何去除旧版本yum安装的相关软件。我们可以借助yum deplist命令先找出所有相关软件包,然后卸载除了公共软件包外的所有软件包。此方法也适用于安装其它软件时遇到类似同样的问题。

 
yum deplist ffmpeg | grep -v ffmpeg | grep provider | awk '{print $2}' sort -u

图示:

从中挑出非公共软件包的软件包名卸载:

rpm -e --nodeps a52dec dirac dirac-libs faac gsm lame libtheora opencore-amr SDL x264
rpm -e --nodeps $(rpm -qa | grep -i ffmpeg)

CentOS下yum安装FFmpeg的更多相关文章

  1. centOS下yum安装配置samba

     centOS下yum安装配置samba 2010-03-29 15:46:00 标签:samba yum centOS 安装 休闲 注意:本文的原则是只将文件共享应用于内网服务器,并让将要被共享的目 ...

  2. centos下yum安装crontab+mysql自动备份

    参考博文: centos下yum安装crontab yum install vixie-cron crontabs      //安装 chkconfig crond on               ...

  3. <亲测>CentOS中yum安装ffmpeg

    CentOS中yum安装ffmpeg 1.升级系统 sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now 2 ...

  4. [转载]centos下yum安装samba及配置

    centos下yum安装samba及配置 在我们使用 Windows 作为客户机的时候,通常有文件.打印共享的需求.作为Windows 网络功能之一,通常可以在 Windows 客户机之间通过Wind ...

  5. centos下yum安装lamp和lnmp轻松搞定

    centos下yum安装lamp和lnmp轻松搞定.究竟多轻松你看就知道了.妈妈再也不操心不会装lamp了. 非常辛苦整理的安装方法,会持续更新下去.凡无法安装的在评论里贴出问题来,会尽快解决.共同维 ...

  6. centos 下yum 安装nginx

    centos 下yum 安装nginx 1. 直接yum install nginx不行,要先处理下源: rpm -ivh http://nginx.org/packages/centos/6/noa ...

  7. Linux下yum安装ffmpeg和使用

    本文属于转载文章:转载地址是http://www.cnblogs.com/dennisit/archive/2012/12/27/2835089.html 使用Yum安装ffmpeg 打开 vi /e ...

  8. CentOS中yum安装ffmpeg

    1.升级系统 sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now 2.安装Nux Dextop Yum 源 ...

  9. CentOS下yum安装

    centos最小化安装不会装yum,以下是安装方法:(所有操作均在ROOT用户下,系统版本是centos7) 一.删除原有YUM # rpm -aq|grep yum|xargs rpm -e --n ...

随机推荐

  1. JSP内置对象——response

    response对象response对象包含了响应客户端的有关信息,但在JSP中很少使用它.它是HttpServletResponse类的实例.response对象具有页面作用域,即访问一个页面时,该 ...

  2. Socket通信编程实例(SIB和SS'SOB)

    客户端: package socket; import java.io.BufferedReader; import java.io.IOException; import java.io.Input ...

  3. DistroWatch评估XStream桌面153版本

    导读 XStreamOS是一个由Sonicle创建的Solaris的一个版本.XStream桌面将Solaris的强大带给了桌面用户,同时新手用户很可能有兴趣体验一下.DistroWatch对于XSt ...

  4. SQL ALTER TABLE 命令

    SQL ALTER TABLE 命令 SQL ALTER TABLE 命令用于添加.删除或者更改现有数据表中的列. 你还可以用 ALTER TABLE 命令来添加或者删除现有数据表上的约束. 语法: ...

  5. 【黑金原创教程】【TimeQuest】【第四章】内部延迟与其他

    声明:本文为黑金动力社区(http://www.heijin.org)原创教程,如需转载请注明出处,谢谢! 黑金动力社区2013年原创教程连载计划: http://www.cnblogs.com/al ...

  6. java中的最重要的 集合框架

    java.util这个重要的包包含大量的类和接口,支持很多的功能.例如,java.util具有能产生伪随机数的类,还包括可以管理日期和时间.观察事件.操作位集合.标记字符串.处理格式化数据等的类.ja ...

  7. 参数估计(1):从最小二乘到最小b乘

    机器学习到底学习到了什么,或者说“训练”步骤到底在做些什么?在我看来答案无非是:所谓的“学习”就是把大量的数据归纳到少数的参数中,“训练”正是估计这些参数的过程.所以,除了“参数估计”, 我想不到还有 ...

  8. 170310、Jenkins部署Maven多环境项目(dev、beta、prod)的参数设置

    使用Jenkins配置Git+Maven的自动化构建: http://blog.csdn.net/xlgen157387/article/details/50353317 在一个多开发和生产环境的项目 ...

  9. java项目规范

    一.命名规范 1. 项目名全部小写 2. 包名全部小写 3. 类名首字母大写,如果类名由多个单词组成,每个单词的首字母都要大写. 如:public class MyFirstClass{} 4. 变量 ...

  10. Storm-源码分析- Disruptor在storm中的使用

    Disruptor 2.0, (http://ifeve.com/disruptor-2-change/) Disruptor为了更便于使用, 在2.0做了比较大的调整, 比较突出的是更换了几乎所有的 ...