当前位置: 首页 > news >正文

Ubuntu24.04 交叉编译 aarch64 ffmpeg

ffmpeg

  • 官网: https://ffmpeg.org
  • 文档: https://ffmpeg.org/documentation.html
    • 编译参数说明: https://trac.ffmpeg.org/wiki/CompilationGuide/Generic
    • 在Linux下编译: https://trac.ffmpeg.org/wiki/CompilationGuide
  • 下载页: https://ffmpeg.org/download.html

安装依赖

sudo apt install \autoconf \automake \build-essential \cmake \git-core \libass-dev \libfreetype6-dev \libgnutls28-dev \libmp3lame-dev \libsdl2-dev \libtool \libva-dev \libvdpau-dev \libvorbis-dev \libxcb1-dev \libxcb-shm0-dev \libxcb-xfixes0-dev \meson \ninja-build \pkg-config \texinfo \wget \yasm \zlib1g-devsudo apt install libunistring-dev libaom-dev libdav1d-dev

下载源代码

下载页拉到下方 Releases 位置, 下载最新的代码包, 当前版本是 FFmpeg 7.1.1 “Péter”

解压到本地, 在与 ffmpeg-7.1.1 同一级目录下再建一个目录用作 install 的目标目录

configure

设置交叉编译的gcc工具链路径, 设置 install 的目标路径

通过./configure --help可以查看所有的选项.

如果只编译指定的解码器, 可以用--disable-decoders --enable-decoder=h264这样的参数组合, 编码器也是同理.

默认编译所有的编解码器, 执行 configure

./configure --enable-cross-compile --target-os=linux --arch=arm64 \
--cross-prefix=/opt/gcc-arm/aarch64-buildroot-linux-gnu-gcc-12.3.0/bin/aarch64-buildroot-linux-gnu- \
--cc=/opt/gcc-arm/aarch64-buildroot-linux-gnu-gcc-12.3.0/bin/aarch64-buildroot-linux-gnu-gcc \
--cxx=/opt/gcc-arm/aarch64-buildroot-linux-gnu-gcc-12.3.0/bin/aarch64-buildroot-linux-gnu-g++ \
--prefix=/home/milton/WorkC/ffmpeg-7.1.1-lib \
--disable-asm  --enable-parsers --disable-debug \
--enable-ffmpeg --enable-shared --disable-static \
--disable-stripping --disable-doc

然后编译

make -j4

安装

make install

会在目录下生成对应的 bin, include 和 lib

├── bin
│   ├── ffmpeg
│   └── ffprobe
├── include
│   ├── libavcodec
│   ├── libavdevice
│   ├── libavfilter
│   ├── libavformat
│   ├── libavutil
│   ├── libswresample
│   └── libswscale
├── lib
│   ├── libavcodec.so -> libavcodec.so.61.19.101
│   ├── libavcodec.so.61 -> libavcodec.so.61.19.101
│   ├── libavcodec.so.61.19.101
|   |   ...
│   ├── libswscale.so.8 -> libswscale.so.8.3.100
│   ├── libswscale.so.8.3.100
│   └── pkgconfig
└── share└── ffmpeg

查看二进制文件是X64还是Aarch64

file

$ file bin/ffmpeg
bin/ffmpeg: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, with debug_info, not stripped

objdump

$ objdump -f bin/ffmpeg bin/ffmpeg:     file format elf64-little
architecture: UNKNOWN!, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x000000000000edc0

readelf

$ readelf -h bin/ffmpeg
ELF Header:Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class:                             ELF64Data:                              2's complement, little endianVersion:                           1 (current)OS/ABI:                            UNIX - System VABI Version:                       0Type:                              DYN (Position-Independent Executable file)Machine:                           AArch64Version:                           0x1Entry point address:               0xedc0Start of program headers:          64 (bytes into file)Start of section headers:          382240 (bytes into file)Flags:                             0x0Size of this header:               64 (bytes)Size of program headers:           56 (bytes)Number of program headers:         9Size of section headers:           64 (bytes)Number of section headers:         37Section header string table index: 36

相关文章:

  • 旅游微信小程序制作指南
  • 高并发区块链系统实战:从架构设计到性能优化
  • 华为VanillaNet遇上BiFPN:YOLOv8的性能突破之旅
  • `<CLS>` 向量是 `logits` 计算的“原材料”,`logits` 是基于 `<CLS>` 向量的下游预测结果
  • Python爬虫:trafilatura 的详细使用(高效的网页正文提取工具)
  • stress 服务器压力测试的工具学习
  • MySQL范式和反范式
  • 深度学习之模型压缩三驾马车:模型剪枝、模型量化、知识蒸馏
  • LeetCode 3370.仅含置位位的最小整数
  • 42、响应处理-【源码分析】-浏览器与PostMan内容协商完全适配
  • 面试题小结(真实面试)
  • Elasticsearch中的语义搜索(Semantic Search)介绍
  • Go语言学习-->项目中引用第三方库方式
  • Zookeeper 集群部署与故障转移
  • 细说C语言将格式化输出到字符串的函数sprintf、_sprintf_l、swprintf、_swprintf_l、__swprintf_l
  • Git安装与常用命令全攻略
  • 机器翻译模型笔记
  • 股指期货合约价值怎么算?
  • (C++)STL:vector的认识与使用全解析
  • App 上线后还能加固吗?iOS 应用的动态安全补强方案实战分享(含 Ipa Guard 等工具组合)
  • 衢州做网站公司/海南百度推广代理商
  • 做建网站的工作一年赚几百万/系统优化是什么意思
  • 做挂网站吗/谷歌关键词推广怎么做
  • 制作网站需要域名还需要什么/推广普通话手抄报图片
  • 营销策划网站/免费信息发布平台网站
  • 电商网站设计思维导图/企业网站设计优化公司