ffmpeg - android 용 빌드 하기
Windows에서 MinGW 란 것을 이용해서 Android 용으로 ffmpeg 을 빌드해 보자
1. NDK 설치
- https://developer.android.com/ndk/downloads/index.html
- android-ndk-r13b-windows-x86_64.zip
- C:/dev/Android/android-ndk-r13b 에 풀었음
2. MinGW 설치
- http://www.mingw.org/
- 버전 0.6.2-beta-20131004-1
- C:/MinGW 에 설치했음
- MinGW Installation Manager 실행됨
-> mingw-developer-tookit, mingw32-base, msys-base 설치
3. ffmpeg
- https://ffmpeg.org/download.html
- ffmpeg-3.2.2.tar.bz2
- D:/ffmpeg/ffmpeg-3.2.2 에 풀었음
- build-android.sh 작성 후 D:/ffmpeg/ffmpeg-3.2.2 에 집어 넣음
build-android.sh 예
- arm, armv7-a 용
- 디코딩만할거라 encoders, muxers 등을 제외함
#!/bin/bash
NDK=C:/dev/Android/android-ndk-r13b
SYSROOT=$NDK/platforms/android-24/arch-arm
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64
ARCH=arm
CPU=armv7-a
PREFIX=./android/$CPU
ADDI_CFLAGS=""
ADDI_LDFLAGS=""
TEMPDIR=D:/ffmpeg/temp
TMP=D:/ffmpeg/temp
./configure \
--prefix=$PREFIX \
--disable-programs \
--disable-doc \
--disable-avdevice \
--disable-encoders \
--disable-muxers \
--disable-devices \
--disable-filters \
--arch=$ARCH \
--cpu=$CPU \
--cross-prefix=$TOOLCHAIN/bin/$TOOLCHAIN_PREFIX- \
--enable-cross-compile \
--sysroot=$SYSROOT \
--target-os=android \
--extra-cflags="-Os -ftree-vectorize $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
--enable-pic \
--disable-debug
make clean
# Adapt the jobs count
make -j3
make install
4. C:/MinGW/msys/1.0/msys.bat 실행
> cd /d/ffmpeg/ffmpeg-3.2.2
> ./build-android.sh
5. D:/ffmpeg/ffmpeg-3.2.2/android 폴더안에 결과물이 똵!
끝!
옵션관련 참고
- http://blog.k-tai-douga.com/article/47044816.html