天天看點

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

繼續閱讀