FFMpeg Android Port Help??

181 views
Skip to first unread message

Andy Savage

unread,
Jun 15, 2010, 6:18:49 AM6/15/10
to android-porting
Hi there everyone,

Just wondering if somebody has had success building this FFMpeg build
for Android? I'm having an issue (that I'm not quite experienced
enough to solve).

Or perhaps if somebody has already built it maybe they could send me
the binary? :)

Any help that you guys can give me would be great. Here's the Android
Port:
http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android

The error I'm getting when I try a make on that code is:
make: *** No rule to make target `libavformat/libavformat.a', needed
by `all'. Stop.

:-(

Kind regards,
Andy Savage

Deva R

unread,
Jun 15, 2010, 2:22:07 PM6/15/10
to an...@bluewire.net.nz, android-porting
Can you share complete log?? since libavformat is built within ffmpeg-android, it should be some .mk mismatch.,

Are you using android sdk toolchain or other GNU toolchain??
if any tool chians used other than android, the binaries should be strictly static, as android has its own libc version, so binaries wont work.

btw, i was able to build it with in my SDK., few gcc 4.4 specific breaks were there, but it compiled all libraries.



PS.
GCC 4.4 build breaks in the shared gitorious tree

diff --git a/libavformat/metadata_compat.c b/libavformat/metadata_compat.c
index b05fb04..8829940 100644
--- a/libavformat/metadata_compat.c
+++ b/libavformat/metadata_compat.c
@@ -105,7 +105,7 @@ void ff_metadata_demux_compat(AVFormatContext *ctx)


 #define FILL_METADATA(s, key, value) {                                        \
-    if (value && *value && !av_metadata_get(s->metadata, #key, NULL, 0))      \
+    if ( (value != NULL )&& *value && !av_metadata_get(s->metadata, #key, NULL, 0))      \
         av_metadata_set(&s->metadata, #key, value);                           \
     }
 #define FILL_METADATA_STR(s, key)  FILL_METADATA(s, key, s->key)
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 2243d00..babc880 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -840,6 +840,7 @@ av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_ind
     else if(stream_index == -2) return back_ptr;

 assert(0);
+return -1;
 }




Andy Savage

unread,
Jun 17, 2010, 12:26:19 AM6/17/10
to Deva R, android-porting
So, I've downloaded the code from ffmpeg-android (also tried using the origional ffmpeg sources with same error).

Here's the problem... I run my configure script (below):
#!/bin/bash

PREBUILT=/stuff/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1
PREBUILTLIB=$PREBUILT/lib/gcc/arm-eabi/4.2.1
PLATFORM=/stuff/android-ndk-r4/build/platforms/android-5/arch-arm
PREFIX=/stuff/ffmpeg-android-bin
./configure --target-os=linux \
--arch=armv4t \
--enable-cross-compile \
--cc=$PREBUILT/bin/arm-eabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-eabi- \
--nm=$PREBUILT/bin/arm-eabi-nm \
--extra-cflags="-fpic -DANDROID -I$PLATFORM/usr/include -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -march=armv5te -mtune=xscale -msoft-float -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack" \
--prefix=$PREFIX \
--extra-ldflags="-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -nodefaultlibs $PREBUILTLIB/crtbegin.o $PREBUILTLIB/crtend.o -lgcc -lc -lm" \
--enable-static \
--disable-ffplay \
--disable-ffserver \
--disable-debug \
--enable-small \
--disable-shared \
--disable-yasm > configout.txt

This runs fine and generates the required files, then I run 
make -j 2 TARGET_ARCH=arm APP=ffmpeg-android

And the sad error I get is
In file included from /stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/linux/in.h:209,
                 from /stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/netinet/in.h:33,
                 from libavformat/network.h:36,
                 from libavformat/os_support.c:42:
/stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/byteorder.h: In function '___arch__swab32':
/stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/byteorder.h:25: warning: implicit declaration of function 'asm'
/stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/byteorder.h:25: error: expected ')' before ':' token
make: *** [libavformat/os_support.o] Error 1
make: *** Waiting for unfinished jobs....

Any ideas on this one?? I've tried using android-8 instead and tried using both 4.2.1 and 4.4.0 in the toolchain.

Grrr, no idea where to go from here.

--
"The greatest challenge to any thinker is stating the problem in a way that will allow a solution"
- Bertrand Russell

Andy Savage
Cell Phone: +852 936 34341
Skype ID: andy_savage
Linked In: http://www.linkedin.com/in/andysavage

Yadnesh

unread,
Jun 17, 2010, 4:48:21 AM6/17/10
to android-porting
Hi All,

I am trying to build the FFMpeg Android port. Initially I landed into
the same issue "*** No rule to make target `libavformat/
libavformat.a', "

Following the steps in Andy's next post. The configuration script
worked fine (no errors displayed).

I tried the command "make TARGET_ARCH=arm APP=ffmpeg-android" and got
the following error:
=======================================================
Android NDK: APP variable defined to unknown applications: ffmpeg-
android
Android NDK: You might want to use one of the following: ffmpeg-
android
build/core/main.mk:81: *** Android NDK: Aborting . Stop.
=======================================================

Referring to the Android NDK documentation, I created $NDK_ROOT/apps/
ffmpeg-android/Application.mk
This file refers to the root folder of ffmpeg-android.

Now, the same command "make TARGET_ARCH=arm APP=ffmpeg-android" does
not show any error. But it also does not compile!!!
=======================================================
$ make TARGET_ARCH=arm APP=ffmpeg-android
Android NDK: Building for application 'ffmpeg-android'
=======================================================

Is there anything I am doing wrong? Is there anything extra that I
need to do? I am working on Ububtu 8.0.4

All help is appreciated:)

Regards,
Yadnesh

On Jun 17, 9:26 am, Andy Savage <a...@bluewire.net.nz> wrote:
> So, I've downloaded the code from ffmpeg-android (also tried using the
> origional ffmpeg sources with same error).
>
> *Here's the problem... I run my configure script (below):*
> *This runs fine and generates the required files, then I run *
> make -j 2 TARGET_ARCH=arm APP=ffmpeg-android
> *
> *
> *And the sad error I get is*
> *In file included from
> /stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/linux/ in.h:209,
> *
> *                 from
> /stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/netine t/in.h:33,
> *
> *                 from libavformat/network.h:36,*
> *                 from libavformat/os_support.c:42:*
> */stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/b yteorder.h:
> In function '___arch__swab32':*
> */stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/b yteorder.h:25:
> warning: implicit declaration of function 'asm'*
> */stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/b yteorder.h:25:
> error: expected ')' before ':' token*
> *make: *** [libavformat/os_support.o] Error 1*
> *make: *** Waiting for unfinished jobs....*
>
> *Any ideas on this one?? I've tried using android-8 instead and tried using
> both 4.2.1 and 4.4.0 in the toolchain.*
> *
> *
> *Grrr, no idea where to go from here.*
> *
> *
> >>http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android<http://gitorious.org/%7Eolvaffe/ffmpeg/ffmpeg-android>
>
> >> The error I'm getting when I try a make on that code is:
> >> make: *** No rule to make target `libavformat/libavformat.a', needed
> >> by `all'.  Stop.
>
> >> :-(
>
> >> Kind regards,
> >> Andy Savage
>
> >> --
> >> unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsubscribe@ googlegroups.com>
> >> website:http://groups.google.com/group/android-porting

Yadnesh

unread,
Jun 17, 2010, 8:44:41 AM6/17/10
to android-porting
Hi,

I followed all the steps in trying to build the FFMpeg on android.
The build goes fine for some time and then I get the following error:
===========================================================
make: *** No rule to make target `out/apps/ffmpeg-org/armeabi/
libz.so', needed b
y `out/apps/ffmpeg-org/armeabi/libavcodec.a'. Stop.
===========================================================

libz.so is present in the Android NDK (build/platforms/android-5/arch-
arm/usr/lib/libz.so) and the application only needs to link to the
library

the Android.mk in libavformat fools as follows:
===========================================================
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

include $(LOCAL_PATH)/../av.mk

LOCAL_SRC_FILES := $(FFFILES)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/.. \
external/zlib

LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_CFLAGS += -include "string.h" -Dipv6mr_interface=ipv6mr_ifindex

LOCAL_SHARED_LIBRARIES := libz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)

LOCAL_MODULE := $(FFNAME)

include $(BUILD_STATIC_LIBRARY)
===========================================================

Referring to some information in the NET I replaced the
LOCAL_SHARED_LIBRARIES := libz
with
LOCAL_LDLIBS := -Lbuild/platforms/android-5/arch-arm/usr/lib -lz

But still get same error. All suggestions to resolve the issue are
welcome :)

Thanks and Regards,
Yadnesh

On Jun 17, 9:26 am, Andy Savage <a...@bluewire.net.nz> wrote:
> So, I've downloaded the code from ffmpeg-android (also tried using the
> origional ffmpeg sources with same error).
>
> *Here's the problem... I run my configure script (below):*
> *This runs fine and generates the required files, then I run *
> make -j 2 TARGET_ARCH=arm APP=ffmpeg-android
> *
> *
> *And the sad error I get is*
> *In file included from
> /stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/linux/ in.h:209,
> *
> *                 from
> /stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/netine t/in.h:33,
> *
> *                 from libavformat/network.h:36,*
> *                 from libavformat/os_support.c:42:*
> */stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/b yteorder.h:
> In function '___arch__swab32':*
> */stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/b yteorder.h:25:
> warning: implicit declaration of function 'asm'*
> */stuff/android-ndk-r4/build/platforms/android-5/arch-arm/usr/include/asm/b yteorder.h:25:
> error: expected ')' before ':' token*
> *make: *** [libavformat/os_support.o] Error 1*
> *make: *** Waiting for unfinished jobs....*
>
> *Any ideas on this one?? I've tried using android-8 instead and tried using
> both 4.2.1 and 4.4.0 in the toolchain.*
> *
> *
> *Grrr, no idea where to go from here.*
> *
> *
> >>http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android<http://gitorious.org/%7Eolvaffe/ffmpeg/ffmpeg-android>
>
> >> The error I'm getting when I try a make on that code is:
> >> make: *** No rule to make target `libavformat/libavformat.a', needed
> >> by `all'.  Stop.
>
> >> :-(
>
> >> Kind regards,
> >> Andy Savage
>
> >> --

Andy Savage

unread,
Jun 22, 2010, 9:28:41 PM6/22/10
to yad...@gmail.com, android-porting
Hi All,

Here is a VERY fantastic company that provides a very helpful link in order to compile ffmpeg (Bambuser). Look to the bottom of the page in the "Open Source" section. They obviously use ffmpeg for their product.

Also, I have nothing to do with their product but it does look great too. I only have big smiles for this company for providing back to the community.

You can download their archive and use their patches and scripts to cross-compile a (reasonably) recent version of ffmpeg for your device.

If you use this and make any changes, please contribute back as I am very interested to see any changes people make using it.

Cheers,
Andy

--
"The greatest challenge to any thinker is stating the problem in a way that will allow a solution"
- Bertrand Russell

Andy Savage
Cell Phone: +852 936 34341
Skype ID: andy_savage
Linked In: http://www.linkedin.com/in/andysavage


NBK

unread,
Jul 13, 2010, 7:40:51 AM7/13/10
to android-porting
Hi ,

I am also trying to build ffmpeg on android. For that I followed
steps given in http://slworkthings.wordpress.com/2010/02/23/ffmpeg-and-android-mk/#comments
web site. I have successfully build upto step 1to4. In step 5, I am
facing similar problem like yours.

Android NDK: APP variable defined to unknown applications: ffmpeg-
org
Android NDK: You might want to use one of the following:
build/core/main.mk:81: *** Android NDK: Aborting . Stop.

I am using ubuntu 9.04. Please advice if you have some idea.

THANKS

On Jun 17, 1:48 pm, Yadnesh <yadn...@gmail.com> wrote:
> Hi All,
>
> I am trying to build theFFMpegAndroidport.  Initially I landed into
> the same issue "*** No rule to make target `libavformat/
> libavformat.a', "
>
> Following the steps in Andy's next post.  The configuration script
> worked fine (no errors displayed).
>
> I tried the command "make TARGET_ARCH=arm APP=ffmpeg-android" and got
> the following error:
> =======================================================AndroidNDK:  APP variable defined to unknown applications:ffmpeg-androidAndroidNDK:  You might want to use one of the following:ffmpeg-android
> build/core/main.mk:81: ***AndroidNDK:  Aborting    .  Stop.
> =======================================================
>
> Referring to theAndroidNDK documentation, I created $NDK_ROOT/apps/ffmpeg-android/Application.mk
> This file refers to the root folder offfmpeg-android.
>
> Now, the same command "make TARGET_ARCH=arm APP=ffmpeg-android" does
> not show any error.  But it also does not compile!!!
> =======================================================
> $ make TARGET_ARCH=arm APP=ffmpeg-androidAndroidNDK: Building for application 'ffmpeg-android'
> =======================================================
>
> Is there anything I am doing wrong?  Is there anything extra that I
> need to do?  I am working on Ububtu 8.0.4
>
> Allhelpis appreciated:)
>
> Regards,
> Yadnesh
>
> On Jun 17, 9:26 am, Andy Savage <a...@bluewire.net.nz> wrote:
>
> > So, I've downloaded the code fromffmpeg-android(also tried using the
> > origionalffmpegsources with same error).
> > *Any ideas on this one?? I've tried usingandroid-8 instead and tried using
> > both 4.2.1 and 4.4.0 in the toolchain.*
> > *
> > *
> > *Grrr, no idea where to go from here.*
> > *
> > *
> > --
> > "The greatest challenge to any thinker is stating the problem in a way that
> > will allow a solution"
> > - Bertrand Russell
>
> > Andy Savage
> > Cell Phone: +852 936 34341
> > Skype ID: andy_savage
> > Linked In:http://www.linkedin.com/in/andysavage
>
> > On Wed, Jun 16, 2010 at 2:22 AM, Deva R <r.deva...@gmail.com> wrote:
> > > Can you share complete log?? since libavformat is built within
> > >ffmpeg-android, it should be some .mk mismatch.,
>
> > > Are you usingandroidsdk toolchain or other GNU toolchain??
> > > if any tool chians used other thanandroid, the binaries should be strictly
> > > static, asandroidhas its own libc version, so binaries wont work.
> > >> forAndroid? I'm having an issue (that I'm not quite experienced
> > >> enough to solve).
>
> > >> Or perhaps if somebody has already built it maybe they could send me
> > >> the binary? :)
>
> > >> Anyhelpthat you guys can give me would be great. Here's theAndroid
Reply all
Reply to author
Forward
0 new messages