ffmpeg2.1 install centos5.1

来源:互联网 发布:徐州网络 编辑:程序博客网 时间:2024/06/11 22:17

在linux 上安装ffmpeg 简直就是一种折磨,它会把你搞的精皮历经,版本高了不行,最关键有时候你还装不上,自己vm安装半天时间,服务器安装用了两天。不说了


1、先把git 工具安装上 ,网上找

2、git clone git://git.videolan.org/ffmpeg.git ffmpeg 源码down 下来

3、ffmpeg 所需包(如果有的链接不能用了,自己在找找)

wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz 
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2 
wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz 
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz 
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz 
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz 
wget http://downloads.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gz 
wget http://downloads.sourceforge.net/project/libdc1394/libdc1394-2/2.1.2/libdc1394-2.1.2.tar.gz 
wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz 
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2 
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz 
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gz

yum install yasm nasm 

注:libvpx1.0.0这个包要安装低版本的,高版本ffmpeg编译不通过(希望你不要挑战它,如果你挑战成功告诉我下怎么搞定@@)


tar -zxf lame-3.98.4.tar.gz 
tar -zxf xvidcore-1.2.2.tar.gz 
tar -jxf ffmpeg-php-0.6.0.tbz2 
tar -zxf a52dec-0.7.4.tar.gz 
tar -zxf faad2-2.7.tar.gz 
tar -zxf faac-1.28.tar.gz 
tar -zxf libraw1394-2.0.5.tar.gz 
tar -zxf libdc1394-2.1.2.tar.gz 
tar -zxf opencore-amr-0.1.2.tar.gz 
tar -jxf essential-20071007.tar.bz2 
tar -jxf libtheora-1.1.1.tar.bz2 
tar -zxf libogg-1.1.4.tar.gz 
tar -zxf libvorbis-1.2.3.tar.gz 

mkdir /usr/local/lib/codecs/ 
cp ./essential-20071007/* /usr/local/lib/codecs/ 
chmod -R 755 /usr/local/lib/codecs/ 
############## 
# For 64 Bit Systems ALSO do this: 

mkdir /usr/local/lib64/codecs/ 
cp ./essential-20071007/* /usr/local/lib64/codecs/ 
chmod -R 755 /usr/local/lib64/codecs/ 
############## 


cd x264 
./configure --enable-shared 
make 
make install 
cd .. 

cd xvidcore/build/generic 
./configure 
make 
make install 
cd ../../../ 

cd lame-3.98.4 
./configure 
make 
make install 
cd .. 

cd a52dec-0.7.4 
./configure --enable-shared=PKGS 
make 
make install 
cd .. 

cd faad2-2.7 
autoreconf -vif 
./configure 
make 
make install 
cd .. 

cd faac-1.28 
./bootstrap 
./configure 
make 
make install 
cd .. 

cd libraw1394-2.0.5 
./bootstrap 
./configure 
make 
make install 
cd .. 

cd libdc1394-2.1.2 
./configure 
make 
make install 
cd .. 

cd opencore-amr-0.1.2 
./configure 
make 
make install 
cd .. 

cd libogg-1.1.4 
./configure 
make 
make install 
cd .. 

cd libvorbis-1.2.3 
./configure 
make 
make install 
cd .. 

cd libtheora-1.1.1 
./configure 
make 
make install 
cd .. 

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

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 --disable-ffplay --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --extra-cflags=-fPIC 
make 
make install 
cd .. 

ldconfig 


//============================在编译过程中遇到问题===========================================

报错:libavcodec/libxvid.c: In function ‘xvid_encode_init’:libavcodec/libxvid.c:362: 错误:‘xvid_plugin_lumimasking_t’ 未声明 (在此函数内第一次使用)libavcodec/libxvid.c:362: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其libavcodec/libxvid.c:362: 错误:所在的函数内只报告一次。)libavcodec/libxvid.c:362: 错误:expected ‘;’ before ‘masking_l’libavcodec/libxvid.c:363: 错误:expected ‘;’ before ‘masking_v’libavcodec/libxvid.c:364: 错误:‘xvid_plugin_ssim_t’ 未声明 (在此函数内第一次使用)libavcodec/libxvid.c:364: 错误:expected ‘;’ before ‘ssim’libavcodec/libxvid.c:365: 警告:ISO C90 不允许混合使用声明和代码libavcodec/libxvid.c:539: 错误:‘masking_l’ 未声明 (在此函数内第一次使用)libavcodec/libxvid.c:550: 错误:‘masking_v’ 未声明 (在此函数内第一次使用)libavcodec/libxvid.c:563: 错误:‘xvid_plugin_ssim’ 未声明 (在此函数内第一次使用)libavcodec/libxvid.c:564: 错误:‘ssim’ 未声明 (在此函数内第一次使用)make: *** [libavcodec/libxvid.o] 错误 1  
 去掉--enable-libxvid 问题就好了




  我希望这篇文章能帮到你,如果你遇到错误把它帖出来,有答案更好

2 0