ffmpeg自动手动编译安装
1.下载linux ndk并配置profile文件
本例以android-ndk-r10e为例
vi /etc/profile
export NDK_HOME=/root/ffmpeg/android-ndk-r10e
export PATH=
P
A
T
H
:
PATH:
PATH:NDK_HOME
source /etc/profile
2.下载x264并生成
git clone https://code.videolan.org/videolan/x264.git
cd x264/
./configure --prefix=/root/ffmpeg/outputx264 --enable-shared --enable-static --disable-asm
make
make install
3.下载fdk-aac并生成
git clone --depth 1 https://gitee.com/mirrors/fdk-aac.git
cd fdk-aac/
./autogen.sh
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
./autogen.sh
./configure --enable-shared --prefix=/root/ffmpeg/outputfdk
make
make install
4.下载lame并生成
wget http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
tar zxvf lame-3.100.tar.gz
cd lame-3.100/
./configure --enable-shared --enable-static --prefix=/root/ffmpeg/outputlame
make
make install
5.最后编译ffmpg
root@ubuntu2004:~/ffmpeg/FFmpeg-release-2.7# cat build_ffmpeg.sh
#!/bin/bash
NDK=/root/ffmpeg/android-ndk-r10e
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt
PLATFORM=$NDK/platforms/android-15/arch-arm
PREFIX=/root/ffmpeg/outputffmpeg
./configure --prefix=
P
R
E
F
I
X
−
−
s
y
s
r
o
o
t
=
PREFIX \ --sysroot=
PREFIX −−sysroot=PLATFORM
–cross-prefix=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-
–target-os=android --arch=arm
–extra-cflags=“-I/root/ffmpeg/outputx264/include -I/root/ffmpeg/outputlame/include -I/root/ffmpeg/outputfdk/include -fPIC "
–extra-ldflags=”-L/root/ffmpeg/outputx264/lib -L/root/ffmpeg/outputlame/lib -L/root/ffmpeg/outputfdk/lib"
–disable-programs
–disable-doc
–enable-shared
–enable-cross-compile
–enable-gpl
–enable-avresample
–enable-nonfree