编译ffmpeg的Android库
环境
- ubunut 18.04 lts
- ndk r20b
- ffmpeg 4.4 N-103194-g00b579890d
手动编译
- 需要参数
--enable-cross-compile
才能启用clang - ndk r20b的clang是需要单独指定的,
--cross-prefix
是拼接不出来的.
--enable-cross-compile
才能启用clang--cross-prefix
是拼接不出来的.环境
sudo apt-get install yasm make
编译
"D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
bash
./configure --toolchain=msvc --arch=x86_32 --enable-x86asm --enable-shared --enable-w32threads --disable-doc --disable-static --enable-optimizations --disable-debug --prefix=output
make install
m1机器编译arm64
./configure --arch=arm64 --disable-shared --enable-pthreads --disable-doc --enable-static --enable-optimizations --disable-debug --prefix=output_arm64
make install
intel机器编译x86_64
./configure --arch=x86_64 --disable-shared --enable-pthreads --disable-doc --enable-static --enable-optimizations --disable-debug --prefix=output_x86_64
make install
合并
lipo -create output_arm64/lib/libavcodec.a output_x86_64/lib/libavcodec.a -output /prebuilt/mac/libavcodec.a
strip -S /prebuilt/mac/libavcodec.a