Ubuntu 12.04交叉编译安装arm版本的ffmpeg

1 准备工作

(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,现在最流行的两种高质量的压缩格式,下载地址是:

http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz

解压后参考其readme文件,打开xvidcore/doc/INSTALL文件
基本上还是通常的三步曲,只不过configure文件换了个目录,在build\generic路径下
我们也看到库支持vs2008编译

./configure --prefix=/usr/local/arm --host=arm-none-linux-gnueabi

make

sudo make install

 (3)FAAC库的编译安装(貌似不需要)
从网上下载的源码是faad2-2.0.tar,在Ubuntu上解压后,由于是DOS格式的,执行下面语句会出错
./bootstrap

我的执行步骤是
chmod +x bootstrap

dos2unix bootstrap

./bootstrap

报错:

# ./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 配置及编译安装相关的选项有
 --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 

实际的配置参数为:

./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的设置最后要有符号- , --arch选项要根据自己的GCC的选项加,我的编译的选项有-march=armv6j,不清楚就不要加.
最后加--enable-gpl是因为--enable-libxvid选项,这造成了与--enable-libfaac选项冲突。

然后
make

以root身份运行
make install

 

3 测试
将安装目录中的ffmpeg程序拷贝到设备上,测试从视频中截取一张图片
ffmpeg -i 12.mp4 -y -f image2 -ss 10.010 -t 0.001 -s 320x240 test.jpg

成功执行,说明ffmpeg交叉编译顺利完成。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值