* 下载ffmpeg和x264的源码
这个自己google
* 配置文件选项
./configure --enable-shared --enable-shared --enable-gpl --enable-nonfree --enable-x11grab --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
错误列表及解决:
* 缺少libXXX的错误
查找并安装apt-get install libXXX
* 更新libx264的版本
Ubuntu默认安装的libx264-dev的版本不能在最新的ffmpeg中使用,因此需要更新libx264的版本。
** 删除libx264-dev
sudo apt-get remove x264 libx264-dev
** 下载最新的x264源代码并编译
./configure --enable-static
make
** 安装x264的过程将会安装相应的库
make install
* 其他错误
** error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
this error usually comes when ldconfig does not know where to search for the libraries, so, in order to help it out, on my fedora/centos systems, i did the following:
cd /etc/ld.so.conf.d
add another file: custom-libs.conf
inside, put :
/usr/local/lib
save,
then do ldconfig
** "ffmpeg: relocation error: /usr/local/lib/libswresample.so.0: symbol av_get_default_channel_layout, version LIBAVUTIL_51 not defined in file libavutil.so.51 with link time reference"
通过locate libavutil.so.51可以知道系统中不止存在一个此库,并使用ldd `which ffmpeg`查看ffmpeg使用了哪一个库文件,猜想是由于没有加载正确的库文件造成的,因此采用上一个错误的解决方法,问题解决。