[FFmpeg-user] FFmpeg /x264 building for Android
Hans-Christoph Steiner
hans at guardianproject.info
Thu Aug 30 18:26:10 CEST 2012
Try this:
https://github.com/guardianproject/android-ffmpeg
.hc
On 08/29/2012 08:34 PM, Mehmet Kerim Yücel wrote:
> I also would like to add the following scripts and the errors I have encountered.
>
> Script I am using is as follows.
> NDK=~/Android_NDK_r7b
> PLATFORM=$NDK/platforms/android-8/arch-arm/
> PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
> x264=/usr/local
> #x264v2=~/x264
> function build_one
> {
> ./configure --target-os=linux \
> --prefix=$PREFIX \
> --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 \
> --sysroot=$PLATFORM \
> # --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
> --extra-cflags="-I$x264/include" \
> --enable-shared \
> --enable-static \
> #--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
> --extra-ldflags="-L$x264/lib" \
> --disable-everything \
> # --enable-demuxer=mov \
> # --enable-demuxer=h264 \
> # --disable-ffplay \
> --enable-gpl \
> --enable-libx264 \
> # --enable-protocol=file \
> # --enable-avformat \
> # --enable-avcodec \
> # --enable-encoder=libx264 \
> # --enable-decoder=rawvideo \
> #--enable-decoder=mjpeg \
> # --enable-decoder=h263 \
> # --enable-decoder=mpeg4 \
> # --enable-encoder=h264 \
> # --disable-network \
> #--enable-zlib \
> # --disable-avfilter \
> #--disable-avdevice \
> $ADDITIONAL_CONFIGURE_FLAG
>
> make clean
> make -j4 install
> $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
> $PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
> }
>
> #arm v7vfpv3
> CPU=armv7-a
> OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
> PREFIX=./androidIncludeTrialsNDK7/$CPU
> ADDITIONAL_CONFIGURE_FLAG=
> build_one
>
> If I basically delete the lines extracf and extrald flags and use other ones (commented outs), it works fine except libx264 not found error. I obtain these in terminal.
> ./buildnew.sh: line 35: --extra-cflags=-I/usr/local/include: No such file or directory
> ./buildnew.sh: line 38: --extra-ldflags=-L/usr/local/lib: No such file or directory
> ./buildnew.sh: line 40: --disable-everything: command not found
> ./buildnew.sh: line 44: --enable-gpl: command not found
>
>
> The compilation process ends with the following.
> make: *** [libavdevice/v4l.o] Error 1
> make: *** Waiting for unfinished jobs....
> /home/mehmet/Android_NDK_r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ar: creating libavcodec/libavcodec.a
> /home/mehmet/Android_NDK_r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld: cannot open output file ./androidIncludeTrialsNDK7/armv7-a/libffmpeg.so: No such file or directory
>
>
> I have x264 installed in my directory /home/mehmet/x264 and I also check whereis x264.a, it shows me as /usr/local/lib. I have tried changing the path $x264 to point out to home/mehmet/x264 folder, but I get the same error.
>
> Lastly, if I enable both extracf and extrald flags. I get the same error mentioned above. I am afraid I am doing a simple typo here, but can`t see it and it is driving me crazy. Thanks a lot for your help.
>
> Best.
>
>
> M.Kerim Yücel
>
>
>
>
>
> ________________________________
> From: Mehmet Kerim Yücel <mehmetkerimyucel at yahoo.com>
> To: "ffmpeg-user at ffmpeg.org" <ffmpeg-user at ffmpeg.org>
> Sent: Thursday, August 30, 2012 12:15 AM
> Subject: [FFmpeg-user] FFmpeg /x264 building for Android
>
> Hello everybody,
>
> I have few questions, please keep in mind that I am a beginner at this and sorry if my questions are simple ones.
>
>
> I have been trying to build ffmpeg for Android lately and encountered few problems. I have been using this tutorial ( http://www.roman10.net/how-to-build-ffmpeg-for-android/ ) and managed to build ffmpeg. I wanted to include libx264 and found out that I had to compile libx264 seperately, which I did as well.
>
> I am trying to include libx264.a static library to ffmpeg build. I know that I have to change extracf and extrald flags( so that ffmpeg can include libx264 static library) while configuring ffmpeg, but I don't know exactly how. Any help might be really helpful.
>
> My last question is related to size of libffmpeg.so shared library. I have used the versions of NDK and ffmpeg in aforementioned tutorial link and libffmeg.so's size was around 6mb. I have tried the same script for different NDK and ffmpeg versions, such as NDK 7 ffmpeg 0.10.4 and obtained the file size as 3mb. What does that mean? Is this a problem? Static libraries and include files are same as tutorial's case (NDK 5b and Love version of ffmpeg).
>
> Thanks in advance for the answers.
>
> Best,
>
> M.Kerim Yücel
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
More information about the ffmpeg-user
mailing list