在CentOS-4.4 x86_64安装FFmpeg

本文提到的在CentOS安装方式基本都是采用源代码编译的方式,非RPM包安装,请读者注意。
FFmpeg软件只是个解码编码软件,如果支持多种格式必须先安装好对应的库,下面就说下我装的库:
1. 安装faad2
# wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
# tar xvfz faad2-2.6.1.tar.gz
# cd faad2
# ./bootstrap
# ./configure
# make
# make install2. 安装liba52
# wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
# tar xvfz a52dec-0.7.4.tar.gz
# cd a52dec-0.7.4
# ./configure
# make
# make install3. 安装libdirac
# wget http://downloads.sourceforge.net/dirac/dirac-0.10.0.tar.gz
# tar xvfz dirac-0.10.0.tar.gz
# cd dirac-0.10.0
# ./configure
# make
# make install4. 安装faac2
# wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
# tar xvfz faac-1.26.tar.gz
# cd faac
# ./bootstrap
# ./configure
# make
# make install5. 安装libamrnb
# wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
# tar xvfj amrnb-7.0.0.2.tar.bz2
# cd amrnb-7.0.0.2
# ./configure
# make
# make install6. 安装libamrwb
# wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.3.tar.bz2
# tar xvfj amrwb-7.0.0.3.tar.bz2
# cd amrwb-7.0.0.3
# ./configure
# make
# make install7. 安装libmp3lame
# wget http://downloads.sourceforge.net/lame/lame-3.97.tar.gz
# tar xzf lame-3.97.tar.gz
# cd lame-3.97
# ./configure
# make
# make install8. 安装libx264
此软件包需要用git来获取,所以要先安装git:
# wget http://kernel.org/pub/software/scm/git/git-1.6.2.tar.gz (地址要确认)
# tar zxvf git-1.6.2.tar.gz
# cd git-1.6.2
# ./configure
# make
# make install然后安装libx264
# /usr/local/bin/git clone git://git.videolan.org/x264.git x264
# cd x264
# ./configure --enable-pthread --enable-shared --disable-asm
# make
# make install8. 安装libnut,该软件需要用svn获取源代码,svn可以直接用yum install svn来装。先下载:
# svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut
下载后代码保存在新建立的libnut目录下,对于64位Linux需要修改配置文件:
# cd libnut
# vi config.mak在最后一个CFLAGS下一行增加:
CFLAGS += -fPIC然后编译安装:
# make
# make install9. 安装libogg
# wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
# tar xvf libogg-1.1.3.tar.gz
# cd libogg-1.1.3
# ./configure
# make
# make install10. 安装libtheora (svn获取)
# svn co http://svn.xiph.org/trunk/theora theora
# cd theora
# ./autogen.sh
# ./configure
# make
# make install11. 安装libvorbis
# wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
# tar xvfz libvorbis-1.2.0.tar.gz
# cd libvorbis-1.2.0
# ./configure
# make
# make install12. 安装libxvid
# wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz
# tar xvf xvidcore-1.2.1.tar.gz
# cd xvidcore-1.2.1/build/generic
# ./bootstrap.sh
# ./configure --disable-assembly
# make
# make install
上面的媒体支持库安装完后,可以设置下环境准备编译FFmpeg了!
13. 修改环境变量
# vi /etc/ld.so.conf在文件末增加一行:
/usr/local/lib然后生效之:
# ldconfig14. 安装FFmpeg
可以通过svn获取,不过文件比较大,所以特别慢:
# svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
# cd ffmpeg也可以自己下载:
# http://www.ffmpeg.org/releases/ffmpeg-0.5.tar.bz2
# bzip2 -d ffmpeg-0.5.tar.bz2
# tar -xf ffmpeg-0.5.tar
# cd ffmpeg-0.5编译(64位系统需要设置PKG_CONFIG_PATH参数):
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig CFLAGS="-fPIC -m64"
# ./configure --enable-shared \
--enable-gpl \
--enable-nonfree \
--enable-postproc \
--enable-avfilter \
--enable-avfilter-lavf \
--enable-pthreads \
--enable-libamr-nb \
--enable-libamr-wb \
--enable-libdirac \
--enable-libfaac \
--enable-libfaad \
--enable-libfaadbin \
--enable-libmp3lame \
--enable-libnut \
--enable-libtheora \
--enable-libvorbis \
--enable-libx264 \
--enable-libxvid \
--enable-decoder=libx264 \
--enable-encoder=libx264
# make
# make install