1 获取源代码

git clone -b "branch" https://git.ffmpeg.org/ffmpeg.git

“branch” 可以是以下的masterrelease/3.1等等,具体看需要使用哪个分支。

5 hours ago master shortlog | log | tree
4 days ago release/3.1 shortlog | log | tree
4 days ago release/3.2 shortlog | log | tree
4 days ago release/3.3 shortlog | log | tree
3 weeks ago release/3.0 shortlog | log | tree
2 months ago release/2.8 shortlog | log | tree
12 months ago release/2.7 shortlog | log | tree
12 months ago release/2.6 shortlog | log | tree
12 months ago release/2.5 shortlog | log | tree

2 Configure配置

在源码的目录下调用configure脚本,通过 -h 查看相应的帮助,这里写了一个简单的脚本build-ffmpeg.sh;

#!/bin/bash

PREFIX=out
TOOLCHAINS=/mnt/diska/X3399/source/buildroot/output/host/opt/ext-toolchain/bin
CROSS_COMPILE=${TOOLCHAINS}/aarch64-linux-gnu-
LOCAL_PATH=`pwd`
CFLAGS="-Wall -pipe -fpic \
-finline-limit=300 -ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
-fmodulo-sched -fmodulo-sched-allow-regmoves \
-Wno-psabi -Wa,--noexecstack"
EXTRA_CFLAGS=
EXTRA_LDFLAGS=
CPU_NAME=cortex-a72
FFMPEG_FLAGS="--prefix=${PREFIX} \
--target-os=linux \
--arch=arm \
--cpu=$CPU_NAME \
--enable-cross-compile \
--cross-prefix=${CROSS_COMPILE} \
--enable-shared \
--disable-symver \
--disable-doc \
--disable-ffplay \
--disable-ffmpeg \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avfilter \
--disable-muxers \
--disable-filters \
--disable-devices \
--disable-everything \
--enable-protocols \
--enable-parsers \
--enable-demuxers \
--disable-demuxer=sbg \
--enable-decoders \
--enable-bsfs \
--enable-network \
--enable-swscale \
--enable-neon \
--enable-version3 \
--disable-yasm \
--disable-asm" #--enable-debug \
#--disable-stripping \
#--disable-optimizations \ ./configure $FFMPEG_FLAGS --extra-cflags="$CFLAGS $EXTRA_CFLAGS" --extra-ldflags="$LDFLAGS $EXTRA_LDFLAGS" #make && make install

3 报错处理

如果在根目录下直接执行build-ffmpeg.sh脚本是无法成功安装ffmpeg的,首先这里会出现以下几个问题。

报错1:

错误内容:

{your path to toolchians}/aarch64-linux-gnu-gcc is unable to create an executable file. C compiler test failed.

解决方案:

  1. 打开configure文件;

  2. 搜索报错内容“C compiler test failed”,定位到以下内容,注释掉 die “C compiler test failed.” 或者修改 if 条件使得条件一直成立也是可以的。

    if test "$?" != 0; then
    echo "$cc is unable to create an executable file."
    if test -z "$cross_prefix" && ! enabled cross_compile ; then
    echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
    echo "Only do this if you know what cross compiling means."
    fi # die "C compiler test failed." fi

报错2

错误内容:

If you think configure made a mistake, make sure you are using the latest

version from Git. If the latest version fails, report the problem to the

ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.

Include the log file “config.log” produced by configure as this will help

solve the problem.

解决方案:

和报错1的解决方案类似,需要定位configure文件中的错误信息提示内容,

 die(){
echolog "$@"
cat <<EOF If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
EOF
if disabled logging; then
cat <<EOF
Rerun configure with logging enabled (do not use --disable-logging), and
include the log this produces with your report.
EOF
else
cat <<EOF
Include the log file "$logfile" produced by configure as this will help
solve the problem.
EOF
fi
# exit 1
}

简单粗暴一点将exit 1直接注释掉,这样就不会退出了,但是会遇到什么问题不得而知,至少目前可以成功安装了。

报错3

错误内容:

aarch64-linux-gnu-gcc: error: missing argument to ‘-mcpu=’

解决方案:

configure 参数中加入 –cpu=$CPU_NAME 选项

4 At last

最后将out文件夹下的 文件copy到目标板上即可

Linux下ffmpeg交叉编译的更多相关文章

  1. Linux下ffmpeg安装与开发配置

    Linux下ffmpeg安装与开发配置   1. ffmpeg安装 安装环境: ubuntu 12.04 (1)删除已安装的文件,避免冲突 sudo apt-get remove ffmpeg x26 ...

  2. Linux下FFmpeg的安装编译过程【转】

    本文转载自:http://www.linuxidc.com/Linux/2013-06/85628.htm 详细说下在Linux下FFmpeg的安装编译过程.参考 Ubuntu 10.04安装编译FF ...

  3. linux下FFmpeg编译生成ffplay

    1.确认Makefile中指定的config.mak(在ffmpeg根目录下)中:CONFIG_FFPLAY=yes,如果不是需要重新./configure 该处还有ffmpeg.ffprobe.ff ...

  4. Linux下ffmpeg添加Facebook/transform代码块实现将全景视频的球模型转换成立方体模型

    Facebook事实上已开始在平台中支持360度全景视频的流播,但公司对此并不满足.其工程师更是基于锥体几何学设计出了一套全新的视频编码,号称最高能将全景视频的文件大小减少80%.(VR最新突破:全景 ...

  5. Linux下ffmpeg的wav与amr相互转换

    转载:http://blog.csdn.net/sanshipianyezi/article/details/78742621 转载:http://blog.csdn.net/szfhy/articl ...

  6. linux下ffmpeg环境搭建记录

    1.Linux下安装yasm 官网下载:http://yasm.tortall.net/Download.html tar -zvxf yasm-1.3.0.tar.gz cd yasm-1.3.0/ ...

  7. linux 下ffmpeg和mencoder安装

    ffmpeg和mencoder是进行视频转换和视频抽帧的重要开源工具,支持linux和windows环境下的视频转换和视频抽帧操作.本文章记录在linux这两者工具的安装过程.ffmpeg集成视频编码 ...

  8. linux下ffmpeg安装

    1.ffmpeg下载地址: http://www.ffmpeg.org/download.html 2.解压 1 $ tar zvfj ffmpeg.tar.bz2 这里作者假设已经重命名为ffmpe ...

  9. Linux下ffmpeg的完整安装

    最近在做一个企业项目, 期间需要将用户上传的视频转成flv格式或mp4格式并用flash插件在前端播放, 我决定采用ffmpeg (http://www.ffmpeg.org/ )实现. 当然以前也用 ...

随机推荐

  1. php+mysql数据库联合查询 left join 右侧数据重复问题

    情况:多表联合查询(三表及以上联合查询) 分析: A left join B left join C left join D 假如: 表B.C.D都与表A关联查询 A left join B 4条数据 ...

  2. 2007 NOIP T1奖学金

    奖学金(07NOIPT1): [题目描述] 某小学最近得到了一笔赞助,打算拿出其中一部分为学习成绩优秀的前5名学生发奖学金.期末,每个学生都有3门课的成绩:语文.数学.英语.先按总分从高到低排序,如果 ...

  3. vue2.x学习笔记(二)

    接着前面的内容:https://www.cnblogs.com/yanggb/p/12555836.html. 声明式渲染 vue的核心是一个允许采用简洁的模板语法来声明式地将数据渲染进DOM的系统. ...

  4. github使用--配置sshkey

    配置sshkey 好处:每次提代码都不要输入用户名和密码. 1.生成key: 输入命令ssh-keygen -t rsa -C "邮箱地址" [邮箱地址:注册github时填写的邮 ...

  5. Java标识符中常见的命名规则

    标识符:就是给类,接口,方法,变量等起名字.组成规则:A:英文字母大小写B:数字字符C:$和_注意事项:A:不能以数字开头B:不能使Java中的关键字C:Java语言严格区分大小写常见的命名规则:见名 ...

  6. iOS appium

    1.如果没有安装过Homebrew,先安装homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/ ...

  7. wait,waitpid的学习使用

    man wait man waitpid 从中可知 函数原型 pid_t wait(int* status); pid_t waitpid(pid_t pid, int* status, int op ...

  8. 对 spring 中默认的 DataSource 创建进行覆盖

    配置如下 /** * Primary:标识为主配置,将默认的配置覆盖掉 * ConfigurationProperties:设置配置来源 * * @return DataSource */ @Prim ...

  9. 从Spring迁移到Spring Boot

    文章目录 添加Spring Boot starters 添加应用程序入口 Import Configuration和Components 迁移应用程序资源 迁移应用程序属性文件 迁移Spring We ...

  10. jQuery动态时钟

    效果图: 引用的jQuery.js自己百度 代码: <!DOCTYPE html> <html> <head> <meta charset="utf ...