1. Download NDK r6 and FFmpeg 0.8.1
Android NDK r6
FFmpeg 0.8.1
2. Extract
Extract the android-ndk-r6-linux-x86.tar.bz2 to the/home/pekall/opt directory and add the ndk path to the path environment variable
Decompress the ffmpeg-0.8.1.tar.gz to the/home/pekall/Projects_private/FFmpegPlayer/lib directory
Rename the directory/home/pekall/Projects_private/FFmpegPlayer/lib/ffmpeg-0.8.1 to/home/pekall/Projects_private/FFmpegPlayer/lib/jni
3. Compile the FFmpeg configuration script
Create the script file config. sh in the/home/pekall/Projects_private/FFmpegPlayer/lib/jni directory and add the executable permission.
./Configure \
-- Disable-static \
-- Enable-shared \
-- Enable-gpl \
Enable-version3 \
-- Enable-nonfree \
-- Disable-doc \
-- Disable-ffmpeg \
-- Disable-ffplay \
-- Disable-ffprobe \
-- Disable-ffserver \
-- Disable-avdevice \
-- Disable-avfilter \
-- Disable-postproc \
-- Enable-small \
-- Cross-prefix =/home/pekall/opt/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi -\
-- Enable-cross-compile \
-- Target-OS = linux \
-- Extra-cflags = '-I/home/pekall/opt/android-ndk-r6/platforms/android-9/arch-arm/usr/include '\
-- Extra-ldflags = '-L/home/pekall/opt/android-ndk-r6/platforms/android-9/arch-arm/usr/lib-nostdlib '\
-- Arch = arm \
-- Disable-symver \
-- Disable-debug \
-- Disable-stripping \
Sed-I's/HAVE_LRINT 0/HAVE_LRINT 1/G' config. h
Sed-I's/HAVE_LRINTF 0/HAVE_LRINTF 1/G' config. h
Sed-I's/HAVE_ROUND 0/HAVE_ROUND 1/G' config. h
Sed-I's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/G' config. h
Sed-I's/HAVE_TRUNC 0/HAVE_TRUNC 1/G' config. h
Sed-I's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/G' config. h
The following attributes must be modified based on the location where the ndk is installed:
Cross-prefix
Extra-cflags
Extra-ldflags
4. Compile the Android. mk File
You can use this link to obtain the same content as the reference file.
5. Generate the FFmpeg configuration file
Open the terminal and run config. sh in the/home/pekall/Projects_private/FFmpegPlayer/lib/jni directory.
6. Compile FFmpeg
Open the terminal and run ndk-build in the/home/pekall/Projects_private/FFmpegPlayer/lib directory, after compilation, the libffmpeg file about MB is generated in the/home/pekall/Projects_private/FFmpegPlayer/lib/libs/armeabi directory. so