zl程序教程

您现在的位置是:首页 >  系统

当前栏目

centos编译ffmpeg x264

centos 编译 FFMPEG X264
2023-09-11 14:14:10 时间

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 应该出现以下的画面说明成功安装了。


会在当前文件夹下生成静态库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