Unzip to the/home/pekall/opt directory and add the ndk path to the path environment variable.
For the compilation process, refer to compiling FFmpeg 0.8 using Android NDK r5b in Mac OS X.
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 the command in the/home/pekall/Projects_private/FFmpegPlayer/lib/jni directory.Config. sh
6. Compile FFmpeg
Open the terminal and run the command in the/home/pekall/Projects_private/FFmpegPlayer/lib directory.Ndk-buildAfter compilation, the libffmpeg. so file about MB will be generated in the/home/pekall/Projects_private/FFmpegPlayer/lib/libs/armeabi directory.