切记删除原有ffmpeg
1、编译yasm。./configure --prefix=/usr/local/yasmmakemake install2、解压x264,进入目录,输入:./configure --prefix=/usr/local/x264 --enable-shared --enable-static --enable-yasmmakemake install3、解压ffmpeg,进入目录,输入:./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-yasm --enable-libx264 --enable-gpl --enable-pthreads --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/libmakemake install编译完成后,修改环境编译,我在/etc/profile文件下增加如下字段:FFMPEG=/usr/local/ffmpegX264=/usr/local/x264YASM=/usr/local/yasmexport FFMPEG X264 YASMexport PATH=$PATH:$FFMPEG/bin:$X264/bin:$YASM/binexport LD_LIBRARY_PATH=$YASM/lib:$X264/lib:$FFMPEG/lib:$LD_LIBRARY_PATH测试进入/usr/local/ffmpeg/bin目录;./ffmpeg -v如果无异常则安装成功;异常错误信息:ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory此情况是因为ffmpeg未找到相关依赖包,可以通过以下方法解决先 find / -name libavdevice.so.56 得到该文件的目录地址,我找到的是在ffmpeg安装目录的lib目录下;然后 vim /etc/ld.so.conf 将上述目录添加到最后一行并保存退出;再 ldconfig 使配置生效附 ld.son.conf/usr/local/ffmpeg/lib/usr/local/lib辅助http://blog.csdn.net/defonds/article/details/9698959