Ubuntu/Debian交叉编译安装ARM平台版本的ffmpeg
1 準(zhǔn)備工作
(1)libmp3lame庫
下載:????wget?http://downloads.sourceforge.net/lame/lame-3.99.tar.gz
解壓
編譯:./configure --prefix=/usr/local/arm --host=arm-none-linux-gnueabi
????????????make
????????????make install
編譯ok。
?
(2)libxvid庫(x264庫)
支持xvid x264,現(xiàn)在最流行的兩種高質(zhì)量的壓縮格式,下載地址是:
http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
解壓后參考其readme文件,打開xvidcore/doc/INSTALL文件
基本上還是通常的三步曲,只不過configure文件換了個(gè)目錄,在build\generic路徑下
我們也看到庫支持vs2008編譯
./configure --prefix=/usr/local/arm --host=arm-none-linux-gnueabi
make
sudo make install
?(3)FAAC庫的編譯安裝(貌似不需要)
從網(wǎng)上下載的源碼是faad2-2.0.tar,在Ubuntu上解壓后,由于是DOS格式的,執(zhí)行下面語句會(huì)出錯(cuò)
./bootstrap
我的執(zhí)行步驟是
chmod +x bootstrap
dos2unix bootstrap
./bootstrap
報(bào)錯(cuò):
# ./bootstrap
configure.in:38: warning: underquoted definition of MY_CHECK_TYPEDEF_FROM_INCLUDE
configure.in:38:?? run info '(automake)Extending aclocal'
configure.in:38:?? or see?http://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
./bootstrap: 5: ./bootstrap: libtoolize: not found
#?
# apt-get install -y libtoolize
======================
./configure --prefix=/usr/local/arm --host=arm-none-linux-gnueabi
make
make install
?
?2 配置及編譯安裝相關(guān)的選項(xiàng)有
?--cross-prefix=PREFIX???use PREFIX for compilation tools []
?--enable-cross-compile??assume a cross-compiler is used
?
?--disable-ffserver??????disable ffserver build
?--disable-postproc??????disable libpostproc build
?--disable-ffplay????????disable ffplay build
?--arch=ARCH?????????????select architecture []
?--cpu=CPU???????????????select the minimum required CPU (affects
??????????????????????????instruction selection, may crash on older CPUs)
?--target-os=OS??????????compiler targets OS []??????????????????????????
?--enable-libfaac????????enable FAAC support via libfaac [no]
?--enable-libmp3lame?????enable MP3 encoding via libmp3lame [no]
?--enable-libxvid????????enable Xvid encoding via xvidcore,
?????????????????????????native MPEG-4/Xvid encoder exists [no]
?--host-cc=HOSTCC????????use host C compiler HOSTCC
?--host-cflags=HCFLAGS???use HCFLAGS when compiling for host
?--host-ldflags=HLDFLAGS?use HLDFLAGS when linking for host
?--host-libs=HLIBS???????use libs HLIBS when linking for host
?
?--extra-cflags=ECFLAGS??add ECFLAGS to CFLAGS []
?--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
?--extra-libs=ELIBS??????add ELIBS []
?
?--sysroot=PATH??????????root of cross-build tree
?--sysinclude=PATH???????location of cross-build system headers?
實(shí)際的配置參數(shù)為:
./configure --prefix=/usr/local/arm \
--cross-prefix=arm-none-linux-gnueabi- --enable-cross-compile \
--target-os=linux --arch=armv6j \
--disable-ffserver --disable-postproc --disable-ffplay \
--enable-libmp3lame --enable-libxvid \
--sysinclude=/usr/local/arm/include \
--extra-cflags=-I/usr/local/arm/include \
--extra-ldflags=-L/usr/local/arm/lib \
--enable-gpl
其中要注意--cross-prefix的設(shè)置最后要有符號(hào)- , --arch選項(xiàng)要根據(jù)自己的GCC的選項(xiàng)加,我的編譯的選項(xiàng)有-march=armv6j,不清楚就不要加.
最后加--enable-gpl是因?yàn)?-enable-libxvid選項(xiàng),這造成了與--enable-libfaac選項(xiàng)沖突。
然后
make
以root身份運(yùn)行
make install
?
3 測(cè)試
將安裝目錄中的ffmpeg程序拷貝到設(shè)備上,測(cè)試從視頻中截取一張圖片
ffmpeg -i 12.mp4 -y -f image2 -ss 10.010 -t 0.001 -s 320x240 test.jpg
成功執(zhí)行,說明ffmpeg交叉編譯順利完成。
轉(zhuǎn)載于:https://www.cnblogs.com/prettyshuang/p/5552300.html
總結(jié)
以上是生活随笔為你收集整理的Ubuntu/Debian交叉编译安装ARM平台版本的ffmpeg的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 00030_ArrayList集合
- 下一篇: Java_方法