一、概述
交叉编译Android上可用的x264:x264是一个开源的H.264/MPEG-4 AVC视频编码函数库,是最好的有损视频编码器之一
编译环境:ubuntu20
二、编译步骤
1.下载ndk
wget https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip
2.下载x264
下载地址:
git clone https://code.videolan.org/videolan/x264.git
3.切换到x264目录
4.编辑交叉编译脚本
#!/bin/bash export NDK=/tony/third_library/android-ndk-r21d export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64 export API=21 function build { ./configure \ --prefix=$PREFIX \ --disable-cli \ --enable-static \ --enable-pic \ --host=$HOST \ --cross-prefix=$CROSS_PREFIX \ --sysroot=$NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot \ make clean make -j8 make install } #armeabi-v7a PREFIX=./armeabi-v7a HOST=armv7a-linux-android export TARGET=armv7a-linux-androideabi export CC=$TOOLCHAIN/bin/$TARGET$API-clang export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++ export CROSS_PREFIX=$TOOLCHAIN/bin/arm-linux-androideabi- build
5.给build_android.sh执行权限
sudo chmod +x filename
6.执行后的目录
ps:
如需要编译arm64-v8a架构版本,则修改以下变量: ```bash #arm64-v8a PREFIX=./android/arm64-v8a HOST=aarch64-linux-android export TARGET=aarch64-linux-android export CC=$TOOLCHAIN/bin/$TARGET$API-clang export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++ CROSS_PREFIX=$TOOLCHAIN/bin/aarch64-linux-android-
标签:bin,--,编译,export,linux,x264,android,ubuntu20 From: https://www.cnblogs.com/tony-yang-flutter/p/17082377.html