日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ffmpeg库编译加文字_ffmpeg第三方库编译记录

發布時間:2025/3/20 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ffmpeg库编译加文字_ffmpeg第三方库编译记录 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最近在研究ffmpeg的編譯,之前使用的Ubuntu,需要安裝虛擬機,非常麻煩,所以后來改研究在Windows平臺編譯。

一開始遇到很多挫折,參考了網上很多的帖子,但要么不全要么內容已過期,經過我的反復試驗或研究,最終搞定了。在此記錄一下,也希望能對編譯ffmpeg的朋友們有所幫助。

首先安裝Mingw和Msys平臺,可以參考我其他幾篇轉載的帖子,基本都不會有問題

然后從ffmpeg官網下載源碼,可以選擇最新的Git測試版或穩定版(我下載的是ffmpeg-1.1),編譯方式都大同小異,如果不需要第三方庫的話,編譯選項如下(shared和static只能有一個為enable):

./configure --enable-static --disable-shared --enable-memalign-hack --arch=x86 --target-os=mingw32 --pkg-config=pkg-config --enable-runtime-cpudetect --disable-debug --enable-pthreads

make

make install

下面介紹各種第三方庫的編譯。為了方便編譯,所有庫均先解壓到[mingw]/msys/1.0/home/[username]根目錄,然后在mingw shell中cd命令定位到庫文件夾下。

X264

編譯安裝:

./configure --enable-win32thread

make

make install

cp?-iv?x264.h?x264_config.h?/mingw/include

cp?-iv?libx264.a?/mingw/lib

cp?-iv?x264.pc?/mingw/lib/pkgconfig

ffmpeg編譯參數:--enable-gpl --enable-libx264

LAME 3.99.5

編譯安裝:

./configure --enable-export=full --enable-static --disable-shared --disable-frontend

make

make install

ffmpeg編譯參數:--enable-libmp3lame

librtmp 2.3

http://rtmpdump.mplayerhq.hu/,下載rtmpdump-2.3.tgz(網上有帖子說是rtmpdump-2.3-windows.zip,但我下載了,里面都沒有makefile)

librtmp依賴于zlib和openssl,所以要先編譯兩個庫,見下面:

Zlib 1.2.7

http://zlib.net/,下載zlib-1.2.7.tar.gz

make -f win32/Makefile.gcc

cp?-iv?zlib1.dll?/mingw/bin

cp?-iv?zconf.h?zlib.h?/mingw/include

cp?-iv?libz.a?/mingw/lib

cp win32/Makefile.gcc Makefile.gcc

ffmpeg編譯參數:--enable-zlib

OpenSSL 1.0.1

http://www.openssl.org/,下載openssl-1.0.1c.tar.gz

./configure mingw --prefix=`pwd`/win32libs -DL_ENDIAN -DOPENSSL_NO_HW

make

make install

編譯完成后,把當前目錄的win32libs子文件夾下的include和lib分別拷貝到mingw32,以供后面librtmp使用

注意:openssl的編譯需要在安裝Mingw時包含Perl 5環境,如果沒有的話,可到網上下載(我用的是5.16.2版,見http://www.cpan.org/src/README.html),下載后編譯參數如下:

./Configure -des -Dprefix=$HOME/localperl

make

make test

make install

ffmpeg編譯參數:--enable-nonfree --enable libopenssl

librtmp的編譯命令如下:

make SYS=mingw

make SYS=mingw install

注意:編譯ffmpeg時會提示“ERROR: ? librtmp not found”錯誤,主要是因為一些library沒鏈接好,不知道是否為ffmpeg的Bug。解決辦法是在configure文件中“enabled librtmp”一行最后要添加“?-lwinmm -lwsock32 -lgdi32”

ffmpeg編譯參數:--enable-librtmp

xvidcore?1.3.2

http://www.xvid.org,下載xvidcore-1.3.2.tar.gz

編譯安裝:

cd?xvidcore/build/generic

./configure?--prefix=/mingw

執行到這里后,搜索xvidcore/build/generic?目錄下面所有文件(我的版本是platform.inc中有兩處)中的?-mno-cygwin?這個選項, 這個選項已經不被GCC支持,全部刪除后繼續。

make

make install

cp?-iv?\=build/xvidcore.dll.a?/mingw/lib/libxvidcore.dll.a

ffmpeg編譯參數:--enable-libxvid

libgsm?1.0.13-3

編譯安裝:

make

mkdir /mingw/include/gsm

cp inc/gsm.h /mingw/include/gsm

cp lib/libgsm.a /mingw/lib

ffmpeg編譯參數:--enable-libgsm

libogg

供libvorbis和libtheora用

解壓,編譯安裝:

./configure –prefix=/olibs –disable-shared

make

make install

LIBVorbis 1.3.3

編譯安裝:

./configure

make

make install

ffmpeg編譯參數:--enable-libvorbis

LIBTheora?1.1.1

http://xiph.org/downloads/,下載libtheora-1.1.1.tar.bz2

編譯安裝:

./configure

make

make install

ffmpeg編譯參數:--enable-libtheora

LIBSpeex 1.2rc1

./configure

make

make install

ffmpeg編譯參數:--enable-libspeex

加入以上第三方庫以后,在ffmpeg中就可以下面的參數進行編譯:

./configure --enable-static --disable-shared --enable-memalign-hack --arch=x86 --target-os=mingw32 --pkg-config=pkg-config --enable-runtime-cpudetect --disable-debug --enable-pthreads?--enable-gpl?--enable-bzlib --enable-libx264?--enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libxvid --enable-zlib--enable-openssl --enable-librtmp --enable-nonfree --enable-libspeex

make

make install

總結

以上是生活随笔為你收集整理的ffmpeg库编译加文字_ffmpeg第三方库编译记录的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。