交叉编译Android OpenCV with ffmpeg
编译为静态库
环境
Ubuntu 18.04 64位
OpenCV 4.2.0
ffmpeg 4.2.2
android-ndk-21r
准备
系统配置好cmake,cmake-gui,build-essential等工具,能够运行make、make install命令
编译ffmpeg
进入ffmpeg的源代码目录,运行下列脚本:
#!/bin/bash
export TMPDIR=./temp
TOOLCHAIN=/home/lijiyu/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/
CPU=arm64-v8a
PREFIX=/home/lijiyu/ffmpeg-4.2.2/ffmpeg-android-static
CROSS_PREFIX=$TOOLCHAIN/bin/aarch64-linux-android-
CC=$TOOLCHAIN/bin/aarch64-linux-android27-clang
CXX=$TOOLCHAIN/bin/aarch64-linux-android27-clang++
./configure \
--prefix=$PREFIX \
--enable-avresample \
--disable-shared \
--enable-static \
--disable-programs \
--disable-doc \
--disable-avdevice \
--disable-postproc \
--cross-prefix=$TOOLCHAIN/bin/aarch64-linux-android- \
--cc=$TOOLCHAIN/bin/aarch64-linux-android27-clang \
--cxx=$TOOLCHAIN/bin/aarch64-linux-android27-clang++ \
--target-os=android \
--arch=aarch64 \
--enable-cross-compile \
--sysroot=