您的位置:首页 > 运维架构 > Linux

Linux下编译带x264的ffmpeg的方法

2016-07-17 23:04 399 查看
原:http://blog.csdn.net/season_hangzhou/article/details/24399371

一、环境准备

ffmpeg下载:http://www.ffmpeg.org/download.html

x264下载:http://download.videolan.org/x264/snapshots/

yasm下载:http://yasm.tortall.net/Download.html

二、编译

1、编译yasm。

./configure --prefix=/usr/local/yasm

make

make install

2、解压x264,进入目录,输入:

./configure --prefix=/usr/local/x264 --enable-shared --enable-static --enable-yasm

make

make install

3、解压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/lib

make

make install

注意:

①在编译ffmpeg时,我是在vmware虚拟机下共享的windows目录下编译的,出现不支持ln操作的错误,解决办法是将ffmpeg在linux系统文件格式下解压编译。

②需要增加x264头文件及库的目录的字段。

三、编译完成后,修改环境编译,我在/etc/profile文件下增加如下字段:
FFMPEG=/usr/local/ffmpeg
X264=/usr/local/x264

YASM=/usr/local/yasm

export FFMPEG X264 YASM

export PATH=$PATH:$FFMPEG/bin:$X264/bin:$YASM/bin

export LD_LIBRARY_PATH=$YASM/lib:$X264/lib:$FFMPEG/lib:$LD_LIBRARY_PATH

这样ffmpeg就能在linux环境下使用了。

运行ffmpeg时,如果显示没有找到xxx.so库,修改/etc/ld.so.conf文件,动态链接库
vi /etc/ld.so.conf

加入:/usr/local/ffmpeg/lib

执行ldconfig
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: