天天看点

centos编译ffmpeg x264

1、安装汇编编译器(一般系统自带吧),如果没有按照下面的命令安装吧

yum install yasm
           

2、使用最新x264源码编译(只支持编码)

    在x264官网下载最新的代码http://www.videolan.org/developers/x264.html  

git clone git://git.videolan.org/x264.git
	cd x264 
		./configure --enable-static --enable-shared 
		make
		make install
           

注意--enable-static --enable-shared 后面要加上,否则在编译ffmpeg的时候会报错。

make install 应该出现下面的画面说明安装成功了。

centos编译ffmpeg x264

会在当前目录下生成静态库libx264.a,动态库在/usr/local/lib,头文件/usr/local/include目录下。

3、使用最新的ffmpeg源码编译

在ffmpeg官网下载最新的代码https://www.ffmpeg.org/download.html

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
	cd ffmpeg
		#编译成动态库 
		./configure  --enable-shared --disable-static --enable-memalign-hack --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib  --enable-pthreads   
		#编译成静态库
		./configure  --enable-static --disable-shared --enable-memalign-hack --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib  --enable-pthreads   
           

参考资料:

1、http://www.helyar.net/2010/how-to-compile-ffmpeg-from-source/

2、https://help.ubuntu.com/community/FFmpeg#Source_Build

继续阅读