[Libav-user] H264 codec not found in android
Davood Falahati
falahati.davood at gmail.com
Sat Jan 6 16:46:52 EET 2018
Dear all,
I have a problem with my ffmpeg-android integration. Briefly, this is what
I have done yet. This is my directory structure:
----
---- ffmpeg-3.2.9
----x264
----ffmpeg-build
|
--------- lib
----------include
----------share
----------bin
1- I have compiled libx264 for x86, x86_64, mips, arm and arm64
architectures
This is my script for arm64
NDK=$HOME/Android/ndk
PLATFORM=$NDK/platforms/android-18/arch-arm
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt
PREFIX=../ffmpeg-build/arm
function build_arm
{
./configure \
--prefix=$PREFIX \
--enable-static \
--enable-pic \
--host=arm-linux \
--cross-prefix=$TOOLCHAIN/linux-x86_64/bin/arm-linux-androideabi- \
--sysroot=$PLATFORM
make clean
make
make install
}
build_arm
as a result, i get libx264.a in ffmpeg-build/lib folder and two header
files in include folder. Then I go for compiling ffmpeg. I have manipulated
ffmpeg-3.2.9/configure to make shared .so files suitable in Android.
NDK=$HOME/Android/ndk
PLATFORM=$NDK/platforms/android-18/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
GENERAL="\
--enable-small \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--extra-cflags="-I../ffmpeg-build/armeabi/include" \
--extra-ldflags="-L../ffmpeg-build/armeabi/lib" "
function build_ARMv7
{
./configure \
--target-os=linux \
--prefix=./android/armeabi-v7a \
${GENERAL} \
--sysroot=$PLATFORM \
--enable-shared \
--disable-static \
--enable-gpl \
--enable-libx264 \
--extra-cflags="-DANDROID -fPIC -ffunction-sections -funwind-tables
-fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
-fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300"
\
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib
-nostdlib -lc -lm -ldl -llog" \
--enable-zlib \
${MODULES} \
--disable-doc \
--enable-neon
make clean
make
make install
}
build_ARMv7
Then I get .so files and include folders in ffmpeg-build. I have copied the
resulted so files in my jniLib and included them in cmake file. Everything
go nice but when I want to open AVCODEC_ID_H264 codec, say,
codec = avcodec_find_encoder(AV_CODEC_ID_H264);
it can't open h264 codec.
Where I have done this
Best,
Davood Falahati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180106/573f296e/attachment.html>
More information about the Libav-user
mailing list