参考文档:http://blog.chinaunix.net/uid-23069658-id-4018842.html下载所需解码器:lame:wget http://nchc.dl.sourceforge.net/PRoject/lame/lame/3.99/lame-3.99.5.tar.gzlibogg:wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gzlibvorbis:wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gzfaad2:wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gzfaac:wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gzlibtheora:wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xzvo-aacenc:wget http://mirrors.oschina.net/Ubuntu/pool/universe/v/vo-aacenc/vo-aacenc_0.1.3.orig.tar.gz xvid-core1.3.3:wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gzyasm1.2.0:wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gzx264:wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2libraw1394:wget http://ncu.dl.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gzlibdc1394:wget http://ncu.dl.sourceforge.net/project/libdc1394/libdc1394-2/2.2.1/libdc1394-2.2.1.tar.gzfribidi:wget wget http://fribidi.org/download/fribidi-0.19.6.tar.bz2fontconfig:wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.1.tar.gzlibass:wget https://libass.googlecode.com/files/libass-0.10.2.tar.xzlibrtmp:wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgzspeex:wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gztwolame:wget http://downloads.sourceforge.net/twolame/twolame-0.3.13.tar.gzlibdts:wget http://down1.chinaunix.net/distfiles/libdts-0.0.2.tar.gza52:wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gzfdk-aac:wget http://superb-dca3.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.3.tar.gzopencore-amr:wget http://hivelocity.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gzffmpeg 2.2.3:wget http://ffmpeg.org/releases/ffmpeg-2.2.3.tar.gz配置PKG CONFIG路径,主要是安装libass时会出现Package libass was not found in the pkg-config search path.Perhaps you should add the directory containing `libass.pc'to the PKG_CONFIG_PATH environment variable的错误。[root@localhost ffmpeg]#vi /etc/profile添加下面几行:PKG_CONFIG=/usr/bin/pkg-configPKG_CONFIG_PATH=/usr/local/lib/pkgconfigexport PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL java_HOME JRE_HOME CLASSPATH PKG_CONFIG PKG_CONFIG_PATH #注:后面两个变量是新添加的保存退出。[root@localhost ffmpeg]#source /etc/profile[root@localhost ffmpeg]#cd faac-1.28[root@localhost ffmpeg]#./bootstrap[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install出现错误: g++: not found解决方法:yum install gcc+ gcc-c++make出现错误:mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’解决方法:vim faac-1.28/common/mp4v2/mpeg4ip.h从123行开始修改此文件mpeg4ip.h,到129行结束。修改前:#ifdef __cplusplusextern "C" {#endifchar *strcasestr(const char *haystack, const char *needle);#ifdef __cplusplus}#endif修改后:#ifdef __cplusplusextern "C++" {#endifconst char *strcasestr(const char *haystack, const char *needle);#ifdef __cplusplus}#endif接着安装[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd lame-3.99.5[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libogg-1.3.2[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libtheora-1.1.1[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared*** Could not run Ogg test program, checking why...*** The test program compiled, but did not run. This usually means*** that the run-time linker is not finding Ogg or finding the wrong*** version of Ogg. If it is not finding Ogg, you'll need to set your*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point*** to the installed location Also, make sure you have run ldconfig if that*** is required on your system****** If you have an old version installed, it is best to remove it, although*** you may also be able to get things to work by modifying LD_LIBRARY_PATHconfigure: error: libogg is required to build this package! please see http://www.xiph.org/ for how to obtain a copy. 明明安装了ogg但theora却认为咱们没安装。原因在哪里,当然是动态库的查找路径了,我的解决办法是在 /etc/ld.so.conf.d/目录下创建一个名为local-libraries.conf的文件,内容很简单,只有一行:/usr/local/lib然后执行ldconfig -v [root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libvorbis-1.3.4[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd vo-aacenc-0.1.3[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd xvidcore-1.3.3/build/generic[root@localhost ffmpeg]#./configure --prefix=/usr/local/[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ../../../[root@localhost ffmpeg]#cd yasm-1.2.0[root@localhost ffmpeg]#./configure --prefix=/usr/local/[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd x264-snapshot-20140618-2245[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared --enable-pic[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libraw1394-2.0.5[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libdc1394-2.2.1[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libfreetype2-master[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd fribidi-0.19.6[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd fontconfig-2.11.1[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared --enable-libxml2[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libass-0.10.2[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install如果出现下面的错误:../libass/.libs/libass.so: undefined reference to `libiconv'../libass/.libs/libass.so: undefined reference to `libiconv_close'../libass/.libs/libass.so: undefined reference to `libiconv_open'collect2: ld returned 1 exit statusmake[2]: *** [test] Error 1make[2]: Leaving directory `/root/tools/ffmpeg/libass-0.10.2/test'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/root/tools/ffmpeg/libass-0.10.2'make: *** [all] Error 2执行下面的配置命令[root@localhost ffmpeg]#PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd rtmpdump-2.3[root@localhost ffmpeg]#make SYS=posix[root@localhost ffmpeg]#make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd speex-1.2rc1[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared --enable-sse[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd twolame-0.3.13[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd libdts-0.0.2[root@localhost ffmpeg]#./configure --prefix=/usr/local --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd a52dec-0.7.4[root@localhost ffmpeg]#./configure --prefix=/usr/local[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd faad2-2.7[root@localhost ffmpeg]#./configure --prefix=/usr/local --with-mp4v2 --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd amrwb-11.0.0.0[root@localhost ffmpeg]#./configure --prefix=/usr/local --enable-shared如果配置时出现:configure: error: You need patch utility to prepare sources.执行下面命令yum -y install patch然后重新执行./configure --prefix=/usr/local --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd amrnb-11.0.0.0[root@localhost ffmpeg]#./configure --prefix=/usr/local --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd opencore-amr-0.1.3[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]# make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd fdk-aac-0.1.3[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-shared[root@localhost ffmpeg]#make && make install[root@localhost ffmpeg]#cd ..[root@localhost ffmpeg]#cd ffmpeg-2.2.3[root@localhost ffmpeg]#LD_LIBRARY_PATH=/usr/local/include[root@localhost ffmpeg]#./configure --prefix=/usr/local/ --enable-gpl --enable-version3 --enable-nonfree /--enable-shared --enable-zlib --enable-bzlib --enable-libfaac --enable-libmp3lame /--enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libx264 /--enable-libxvid --enable-pthreads --enable-libdc1394 --enable-libass --enable-pic /--enable-openssl --enable-libtwolame --enable-libspeex --enable-librtmp --enable-libfreetype /--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-avisynth --enable-fontconfig /--enable-libfdk-aac --enable-rpath --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-liconv--extra-libs=-liconv是在出现找不到libiconv库错误时加上去的[root@localhost ffmpeg]#make && make install
所需包可以到这里下载http://www.kuaipan.cn/file/id_157354068283490498.htm
新闻热点
疑难解答