感谢支持
我们一直在努力

Ubuntu 16.04下交叉编译FFmpeg

环境:Ubuntu 16.04

交叉编译器版本:4.8.3

依赖x264,lame

x264:

1.wget ftp://ftp.videolan.org/pub/x264/snapshots/last_stable_x264.tar.bz2

2.tar xvf last_stable_x264.tar.bz2

3.cd x264-snapshot-20170903-2245-stable

4.export CC=arm-linux-gnueabi-gcc

5.export AR=arm-linux-gnueabi-ar

6.mkdir build

7.cd build

8. ../configure –enable-static –enable-shared –disable-asm –prefix=$PWD/__install –host=arm-linux-gnueabi

9.make

10.make install

lame:

1.wget https://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz

2.tar xvf lame-3.99.5.tar.gz

3.cd lame-3.99.5
4.mkdir build

5.cd build

6. ../configure –prefix=$PWD/__install –host=arm-linux-gnueabi

7.make

8.make install

ffmpeg:

1.wget www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2

2. tar xvf ffmpeg-snapshot.tar.bz2

3.cd ffmpeg

4.mkdir build

5.cd build

6. ../configure –cross-prefix=/opt/x86-arm/arm-linux/bin/arm-linux-gnueabi- –disable-asm –enable-static –arch=arm –target-os=linux –prefix=$PWD/_install –disable-x86asm –enable-gpl –enable-libx264  –enable-nonfree –enable-cross-compile –extra-cflags=-I/home/jello/x264-snapshot-20170903-2245-stable/build/_install/include –extra-ldflags=-L/home/jello/x264-snapshot-20170903-2245-stable/build/_install/lib –extra-libs=-ldl

7.进过步骤6在当前目录下有ffbuild/config.mak,那么修改此文件

文件中有以下四处需要修改

1.

CFLAGS=  -I/home/jello/x264-snapshot-20170903-2245-stable/build/_install/include -march=armv5te -std=c11 -fomit-frame-pointer -marm -pthread -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized

2.

ASFLAGS=  -I/home/jello/x264-snapshot-20170903-2245-stable/build/_install/include -march=armv5te -g

3.

LDFLAGS= -L/home/jello/x264-snapshot-20170903-2245-stable/build/_install/lib  -march=armv5te -Wl,–as-needed -Wl,-z,noexecstack -Wl,–warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample

4.EXTRALIBS=-lx264 -lm -pthread -pthread -lrt -ldl

将以上四项改动如下:

1.

CFLAGS=  -I/home/jello/x264-snapshot-20170903-2245-stable/build/_install/include -I/home/jello/lame-3.99.5/build/_install/include/lame -march=armv5te -std=c11 -fomit-frame-pointer -marm -pthread -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized

2.

ASFLAGS=  -I/home/jello/x264-snapshot-20170903-2245-stable/build/_install/include -I/home/jello/lame-3.99.5/build/_install/include/lame -march=armv5te -g

3.

LDFLAGS= -L/home/jello/x264-snapshot-20170903-2245-stable/build/_install/lib -L/home/jello/lame-3.99.5/build/_install/lib  -march=armv5te -Wl,–as-needed -Wl,-z,noexecstack -Wl,–warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample

4.EXTRALIBS=-lx264 -lm -pthread -pthread -lrt -ldl -lmp3lame

 

8.make

9.make install

交叉编译完成!!!

Ubuntu 16.04下FFmpeg搭建简易监控环境 http://www.linuxidc.com/Linux/2017-02/141091.htm

Linux 下编译FFmpeg 支持x264, x265  http://www.linuxidc.com/Linux/2016-04/129858.htm

VS2013编译FFmpeg  http://www.linuxidc.com/Linux/2016-08/134102.htm

在 Mac OS X 环境中从源代码编译安装 FFmpeg  http://www.linuxidc.com/Linux/2015-12/126093.htm

FFmpeg安装及encode库的安装说明 http://www.linuxidc.com/Linux/2016-10/136546.htm

Ubuntu 14.04下PPA安装FFmpeg 2.2.2  http://www.linuxidc.com/Linux/2014-05/101322.htm

Linux 下编译FFmpeg 支持x264, x265  http://www.linuxidc.com/Linux/2016-04/129858.htm

FFmpeg常用基本命令  http://www.linuxidc.com/Linux/2016-10/136545.htm

FFmpeg 的详细介绍:请点这里
FFmpeg 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-10/147370.htm

赞(0) 打赏
转载请注明出处:服务器评测 » Ubuntu 16.04下交叉编译FFmpeg
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏