[FFmpeg-user] How to compile ffmpeg on Android
Mohammed Bey Ahmed Khernache
mohbeyinfo at gmail.com
Fri Jul 13 08:03:51 EEST 2018
I am doing cross-compilation. I am running on Ubuntu x86_64. My target os
is: android.
I used the script below:
-------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
#Change NDK to your Android NDK location
pushd .
cd ../ffmpeg
PLATFORM=$NDK/platforms/android-21/arch-arm64/
PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
GENERAL="\
--enable-small \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=aarch64 \
--cc=$PREBUILT/bin/aarch64-linux-android-gcc \
--cross-prefix=$PREBUILT/bin/aarch64-linux-android- \
--nm=$PREBUILT/bin/aarch64-linux-android-nm \
--extra-cflags="-I../ffmpeg-build/armeabi-v8a/include" \
--extra-ldflags="-L../ffmpeg-build/armeabi-v8a/lib" "
MODULES="\
--enable-gpl"
function build_arm64
{
./configure \
--logfile=conflog.txt \
--target-os=android \
--prefix=$PREFIX/armeabi-v8a \
${GENERAL} \
--sysroot=$PLATFORM \
--extra-cflags="" \
$COMMON_FLAGS \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib
-nostdlib -lc -lm -ldl -llog" \
--enable-shared \
--disable-static \
--disable-doc \
${MODULES}
make clean
make
make install
}
build_arm64
echo Android ARM64v8a builds finished
popd
-------------------------------------------------------------------------------------------------------------------------------
The error I got is below:
-------------------------------------------------------------------------------------------------------------------------------
WARNING:
/home/mohammedbey/Desktop/ffmpeg_sources/android-ndk-r17b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-pkg-config
not found, library detection may fail.
config.h is unchanged
libavutil/avconfig.h is unchanged
libavfilter/filter_list.c is unchanged
libavcodec/codec_list.c is unchanged
libavcodec/parser_list.c is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/demuxer_list.c is unchanged
libavformat/muxer_list.c is unchanged
libavdevice/indev_list.c is unchanged
libavdevice/outdev_list.c is unchanged
libavformat/protocol_list.c is unchanged
ffbuild/config.sh is unchanged
GEN libavutil/libavutil.version
GEN libswscale/libswscale.version
GEN libswresample/libswresample.version
GEN libpostproc/libpostproc.version
GEN libavcodec/libavcodec.version
GEN libavformat/libavformat.version
GEN libavfilter/libavfilter.version
GEN libavdevice/libavdevice.version
CC libavdevice/alldevices.o
In file included from ./libavformat/internal.h:24:0,
from libavdevice/alldevices.c:23:
/home/mohammedbey/Desktop/ffmpeg_sources/android-ndk-r17b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/include/stdint.h:9:26:
fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
ffbuild/common.mak:60: recipe for target 'libavdevice/alldevices.o' failed
make: *** [libavdevice/alldevices.o] Error 1
CC libavdevice/alldevices.o
In file included from ./libavformat/internal.h:24:0,
from libavdevice/alldevices.c:23:
/home/mohammedbey/Desktop/ffmpeg_sources/android-ndk-r17b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/include/stdint.h:9:26:
fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
ffbuild/common.mak:60: recipe for target 'libavdevice/alldevices.o' failed
make: *** [libavdevice/alldevices.o] Error 1
Android ARM64v8a builds finished
/home/mohammedbey/Desktop/ffmpeg4Android-master/ffmpeg-build-script
-------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------
Mohammed BEY AHMED KHERNACHE
PhD student
Lab-STICC / CNRS UMR 6285
University of Southern Brittany, Lorient, France
Tel: +33-783-700-185
Email: mohammed.bey-ahmed-khernache at univ-ubs.fr
----------------------------------------------------------------------------
On Thu, Jul 12, 2018 at 12:33 AM Rafael Lima <ragpl07 at gmail.com> wrote:
> Are you jealous? did you at least tried to build?
>
> it is not outdated and not broken... as I've made it few weeks ago using
> the latest version from every lib i needed for my project...
>
> if you dont need all of them it's good you can simple remove from config
> file... a work that seams to hard for you to do
>
> On Wed, Jul 11, 2018 at 7:13 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
> wrote:
>
> > 2018-07-12 0:01 GMT+02:00, Rafael Lima <ragpl07 at gmail.com>:
> > > https://github.com/bolds07/ffmpeg-for-android-for-dummies
> >
> > Yes, apart from being outdated and broken (as every other script
> > I have seen so far), this one has the great advantage that it
> > produces binaries that you cannot legally distribute - that must
> > help many users...
> >
> > Carl Eugen
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> >
>
>
>
> --
> --
> Rafael Lima
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list