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

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
http://www.lryc.cn/news/2400664.html

相关文章:

  • 《AI角色扮演反诈技术解析:原理、架构与核心挑战》
  • 微软的新系统Windows12未来有哪些新特性
  • 树莓派超全系列教程文档--(54)如何使用rsync在计算机之间同步文件夹
  • 华为ICT和AI智能应用
  • ROS2与Unitree机器人集成指南
  • 在虚拟宇宙中低语——进程间通信,Linux命名管道的前世今生
  • Cursor 工具项目构建指南:Java 21 环境下的 Spring Boot Prompt Rules 约束
  • 各个布局的区别以及示例
  • 什么是MVC?
  • STM32的ADC简介
  • Bash shell四则运算
  • (javaSE)Java数组进阶:数组初始化 数组访问 数组中的jvm 空指针异常
  • 力扣刷题Day 70:在排序数组中查找元素的第一个和最后一个位置(34)
  • vue 多端适配之pxtorem
  • 图片压缩工具 | 图片属性详解及读取解析元数据
  • React---day8
  • C# Onnx 动漫人物人脸检测
  • C++内存列传之RAII宇宙:智能指针
  • PVE 虚拟机安装 Ubuntu Server V24 系统 —— 一步一步安装配置基于 Ubuntu Server 的 NodeJS 服务器详细实录1
  • GitHub 趋势日报 (2025年06月03日)
  • 出现dev/nvmeOnip2 contains a file system with errors, check forced 解决方法
  • Vue3.5 企业级管理系统实战(二十二):动态菜单
  • 磨皮功能 C++/C的OpenCV 实现
  • 蓝牙防丢器应用方案
  • TDengine 开发指南——高效写入
  • Linux kill 暂停命令
  • Unity与Excel表格交互热更方案
  • LVS、NGINX、HAPROXY的调度算法
  • C++ 使用 ffmpeg 解码本地视频并获取每帧的YUV数据
  • 分布式微服务系统架构第143集:pom文件