第一步:安装必要的库
$:sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libMP3lame-dev libsdl1.-dev libtheora-dev libx11-dev zlib1g-dev
第二步:安装SDL(否则可能编译不出ffplay)
$:sudo apt-get install libsdl1.-dev
$:sudo apt-get install libsdl-image1.-dev libsdl-mixer1.-dev libsdl-ttf2.-dev libsdl-gfx1.-dev
第三步:安装YASM(否则不能编译汇编语言)
git clone git://github.com/yasm/yasm.git
cd yasm-1.2.
./configure
make
sudo checkinstall
我用的源码下载地址:http://download.csdn.net/detail/gjianw217/5847841
官网下载:http://yasm.tortall.net/Download.html
第四步:安装X264
$git clone git://git.videolan.org/x264.git
$cd x264
$./configure –enable-shared
$make
$sudo make install
我用的源码下载地址:http://download.csdn.net/detail/gjianw217/5847845
官网下载:http://www.videolan.org/developers/x264.html
第五步:安装FFMpeg
$:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
$:cd ffmpeg.2.0
$:./configure --enable-memalign-hack --enable-static --enable-gpl --enable-libx264 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
$:make
$:make install
注:其中--extra-cflags=-I/home/video/ffmpeg-set/include和--extra-ldflags=-L/home/video/ffmpeg-set/lib/指定x264库的位置
我用的源码下载地址:http://download.csdn.net/detail/gjianw217/5847875
官网下载:http://www.ffmpeg.org/download.html
第六步:通过以上步骤,基本上安装成了带有X264的ffmpeg,但使用过程中会提示
ERROR: libx264 not found
找了很多解决方案:具体有:
http://blog.csdn.net/ljh081231/article/details/7595556
http://blog.csdn.net/webdisk008/article/details/6618777
http://code.google.com/p/x264-ffmpeg-up-to-date/issues/detail?id=13
最好我的解决方法是:将libx264所在的目录,添加到文件ld.so.conf中,就可以了。具体的代码如下:
$:sudo vi /etc/ld.so.conf
.....................
$:sudo ldconfig /etc/ld.so.conf