Posted by: developer | February 23, 2010

ffmpeg and Android.mk

I spent several days trying to compile ffmpeg on android-ndk1.5. Just want to share to others. Hopefully, it can save you some time.

STEP1:

First, I get the source code from http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android. I will need to use its *.mk files.

STEP2:

Get the ffmpeg source code from http://ffmpeg.org/download.html. I used svn, instead of git, so that I won’t need to get libswscale separately.

STEP3:

configure my ffmpeg with following cmd.

#!/bin/sh
PREBUILT=/home/myhome/android-ndk/build/prebuilt/linux-x86/arm-eabi-4.2.1
./configure –target-os=linux \
–arch=armv41 \
–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 ” \
–enable-static \
–disable-shared \
–disable-asm \
–disable-yasm \
–prefix=/home/myhome/work/ffmpeg-android-bin \
–extra-ldflags=”-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link=/home/myhome/android-ndk/build/platforms/android-1.5/arch-arm/usr/lib -L/home/myhome/android-ndk/build/platforms/android-1.5/arch-arm/usr/lib -nostdlib /home/myhome/android-ndk/build/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/crtbegin.o /home/myhome/android-ndk/build/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/crtend.o -lc -lm -ldl”

** I referenced this one at http://blog.csdn.net/anakiagmail/archive/2009/08/14/4446986.aspx ** If you don’t understand chinese, I’ll show you what it describe in following steps.

STEP4:

By now, configure should be passed successfully. Copy *.mk from olvaffe’s ffmpeg source tree to your ffmpeg-original source tree. There should be a Android.mk, av.mk under ffmpeg root dir. And, Android.mk under each libavcodec, libavutil, libavformat, libpostproc, libswscale dirs. If you don’t have Android.mk under libswscale/libpostproc, just copy one from libavutil. I don’t use libavdevice, so I just ignore it. Then, comment out all config.mak & subdir.mak in */Makefile.

STEP5:

cd to your NDK root dir, type make TARGET_ARCH=arm APP=ffmpeg-org

STEP6:

you should have a lot of compilation errors. That’s okay. I’ll show you how to fix them.

* edit libavutil/internal.h, comment out all error func(s).

* comment out all “restrict” keyword related “restrict” errors. They should in libavcodec/dsputil.h, libavformat/rtpenc_h263.c, libavcodec/dnxhdenc.c,
libavcodec/dsputil.c, libavcodec/ituh263dec.c, libavcodec/mpegvideo.c.

Try make again, and here we go. Those static *.a files are now in your NDK_ROOT/out/apps/ffmpeg-org/android-1.5-arm/.

Advertisements

Responses

  1. […] ffmpeg and Android.mk Posted in 開発 | Tags: android, ffmpeg, yourfilehost « YouTubeAPIのクエリパラメータ You can leave a response, or trackback from your own site. […]

  2. 编译出来的静态库可以用吗?我在一个动态库里面调用ffmpeg里面的功能,提示undefined reference to ***这样的错误。同时发现,那些libavcodec.a什么的确实都生成了,并且指向的路径也对,不知道什么原因。

  3. Thanks for this tutorial!
    But I am not sure how to realize step 4 to step 5. What is your folder structure in ~/android-ndk/app did you check out the source code in
    ~/android-ndk/app/ffmpeg-org or did you a symbolic link?

    So I was only able to realize your tutorial to step 4. ;). I am using android-ndk release 3.

    best regards Matthias

    • as long as there is a ffmpeg-org under your android-ndk/sources, doesn’t matter it is symbolic link or not. And under your android-ndk/apps/, there is a ffmpeg-org dir too. So, under android-ndk root dir, you just need to type “make APP=ffmpeg-org” cmd.

  4. There’s gotta be a better way than commenting out the restrict qualifier everywhere. Anybody figure out a way to get around this in one of the config files?

  5. I tryed step 3, but it says :

    /Users/jb/Documents/android/android-ndk-r3/build/prebuilt/darwin-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc is unable to create an executable file.
    C compiler test failed.

    I don’t understand why… 😦 can anyone help me ?

    • Thanks for your previous reply. It worked. I created the Application.mk file and commented the functions as mentioned in the post, but still I get a lot of compilation error during make. Need your help…..

      The error is as follows

      root@ubuntuVbox:/home/swapna/DirectTv/android-ndk-r4/sources/FFMpeg# make TARGET_ARCH=arm APP=ffmpeg
      /bin/sh: /home/swapna/DirectTv/android-ndk-r4/sources/FFMpeg/version.sh: Permission denied
      CC libavdevice/alldevices.o
      In file included from libavdevice/alldevices.c:22:
      ./libavformat/avformat.h:54:18: warning: time.h: No such file or directory
      In file included from ./libavformat/avformat.h:55,
      from libavdevice/alldevices.c:22:
      /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘extern’
      /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:229: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__BEGIN_DECLS’
      /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:377: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__BEGIN_DECLS’
      /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:388: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’
      In file included from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavcodec/avcodec.h:29:19: warning: errno.h: No such file or directory
      In file included from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/common.h:29:19: warning: ctype.h: No such file or directory
      ./libavutil/common.h:31:22: warning: inttypes.h: No such file or directory
      In file included from /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/syslimits.h:7,
      from /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/limits.h:11,
      from ./libavutil/common.h:32,
      from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/limits.h:122:61: error: no include path in which to search for limits.h
      In file included from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/common.h:33:18: warning: math.h: No such file or directory
      ./libavutil/common.h:35:20: warning: stdlib.h: No such file or directory
      ./libavutil/common.h:36:20: warning: string.h: No such file or directory
      In file included from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/common.h:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_log2_tab’
      ./libavutil/common.h:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_reverse’
      ./libavutil/common.h: In function ‘av_log2_c’:
      ./libavutil/common.h:71: error: ‘ff_log2_tab’ undeclared (first use in this function)
      ./libavutil/common.h:71: error: (Each undeclared identifier is reported only once
      ./libavutil/common.h:71: error: for each function it appears in.)
      ./libavutil/common.h: In function ‘av_log2_16bit_c’:
      ./libavutil/common.h:83: error: ‘ff_log2_tab’ undeclared (first use in this function)
      In file included from ./libavutil/common.h:90,
      from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/intmath.h:24:20: warning: stdint.h: No such file or directory
      In file included from ./libavutil/common.h:90,
      from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/intmath.h: At top level:
      ./libavutil/intmath.h:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_inverse’
      In file included from ./libavutil/common.h:90,
      from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/intmath.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_sqrt_tab’
      ./libavutil/intmath.h: In function ‘ff_sqrt’:
      ./libavutil/intmath.h:82: error: ‘ff_sqrt_tab’ undeclared (first use in this function)
      ./libavutil/intmath.h:92: error: ‘uint32_t’ undeclared (first use in this function)
      ./libavutil/intmath.h:92: error: ‘uint64_t’ undeclared (first use in this function)
      ./libavutil/intmath.h:92: error: expected ‘)’ before ‘c’
      ./libavutil/intmath.h:92: error: ‘ff_inverse’ undeclared (first use in this function)
      In file included from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/common.h: At top level:
      ./libavutil/common.h:119: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clip_uint8’
      ./libavutil/common.h:130: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clip_uint16’
      ./libavutil/common.h:141: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clip_int16’
      ./libavutil/common.h:152: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clipl_int32’
      In file included from ./libavutil/common.h:305,
      from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/internal.h:36:20: warning: assert.h: No such file or directory
      In file included from ./libavutil/internal.h:186,
      from ./libavutil/common.h:305,
      from ./libavutil/avutil.h:81,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/libm.h: In function ‘lrint’:
      ./libavutil/libm.h:64: warning: implicit declaration of function ‘rint’
      ./libavutil/libm.h:64: warning: incompatible implicit declaration of built-in function ‘rint’
      ./libavutil/libm.h: In function ‘lrintf’:
      ./libavutil/libm.h:71: warning: incompatible implicit declaration of built-in function ‘rint’
      ./libavutil/libm.h: In function ’round’:
      ./libavutil/libm.h:78: warning: implicit declaration of function ‘floor’
      ./libavutil/libm.h:78: warning: incompatible implicit declaration of built-in function ‘floor’
      ./libavutil/libm.h:78: warning: implicit declaration of function ‘ceil’
      ./libavutil/libm.h:78: warning: incompatible implicit declaration of built-in function ‘ceil’
      ./libavutil/libm.h: In function ’roundf’:
      ./libavutil/libm.h:85: warning: incompatible implicit declaration of built-in function ‘floor’
      ./libavutil/libm.h:85: warning: incompatible implicit declaration of built-in function ‘ceil’
      ./libavutil/libm.h: In function ‘truncf’:
      ./libavutil/libm.h:92: warning: incompatible implicit declaration of built-in function ‘floor’
      ./libavutil/libm.h:92: warning: incompatible implicit declaration of built-in function ‘ceil’
      In file included from ./libavutil/avutil.h:82,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/error.h:31:5: warning: “EDOM” is not defined
      In file included from ./libavutil/mathematics.h:27,
      from ./libavutil/avutil.h:83,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/rational.h: In function ‘av_cmp_q’:
      ./libavutil/rational.h:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘tmp’
      ./libavutil/rational.h:49: error: ‘tmp’ undeclared (first use in this function)
      ./libavutil/rational.h:49: error: ‘int64_t’ undeclared (first use in this function)
      ./libavutil/rational.h:49: error: expected ‘;’ before ‘b’
      ./libavutil/rational.h: At top level:
      ./libavutil/rational.h:74: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavutil/rational.h:74: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavutil/rational.h:74: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      In file included from ./libavutil/avutil.h:83,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/mathematics.h:70: warning: data definition has no type or storage class
      ./libavutil/mathematics.h:70: warning: type defaults to ‘int’ in declaration of ‘int64_t’
      ./libavutil/mathematics.h:70: warning: ‘const’ attribute ignored
      ./libavutil/mathematics.h:70: error: expected ‘,’ or ‘;’ before ‘av_gcd’
      ./libavutil/mathematics.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_rescale’
      ./libavutil/mathematics.h:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_rescale_rnd’
      ./libavutil/mathematics.h:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_rescale_q’
      ./libavutil/mathematics.h:95: error: expected ‘)’ before ‘ts_a’
      ./libavutil/mathematics.h:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_compare_mod’
      In file included from ./libavutil/avutil.h:85,
      from ./libavcodec/avcodec.h:30,
      from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavutil/intfloat_readwrite.h:29: error: expected specifier-qualifier-list before ‘uint8_t’
      ./libavutil/intfloat_readwrite.h:33: error: expected ‘)’ before ‘v’
      ./libavutil/intfloat_readwrite.h:34: error: expected ‘)’ before ‘v’
      ./libavutil/intfloat_readwrite.h:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_dbl2int’
      ./libavutil/intfloat_readwrite.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_flt2int’
      In file included from ./libavformat/avformat.h:56,
      from libavdevice/alldevices.c:22:
      ./libavcodec/avcodec.h:705: error: expected specifier-qualifier-list before ‘int16_t’
      ./libavcodec/avcodec.h:970: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavcodec/avcodec.h:1022: error: expected specifier-qualifier-list before ‘uint8_t’
      ./libavcodec/avcodec.h:1090: error: expected specifier-qualifier-list before ‘uint8_t’
      ./libavcodec/avcodec.h:2687: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:2710: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
      ./libavcodec/avcodec.h:2767: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:2767: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:2780: error: expected ‘;’ before ‘int’
      ./libavcodec/avcodec.h:2808: error: expected specifier-qualifier-list before ‘uint8_t’
      ./libavcodec/avcodec.h:2881: error: expected specifier-qualifier-list before ‘uint16_t’
      ./libavcodec/avcodec.h:3053: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3157: error: expected ‘)’ before ‘pix_fmt_mask’
      ./libavcodec/avcodec.h:3414: error: expected declaration specifiers or ‘…’ before ‘int16_t’
      ./libavcodec/avcodec.h:3416: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3416: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3458: error: expected declaration specifiers or ‘…’ before ‘int16_t’
      ./libavcodec/avcodec.h:3478: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3478: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3531: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3531: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3548: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3550: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3571: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3586: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3588: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3642: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavcodec/avcodec.h:3769: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3769: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3771: error: expected ‘;’ before ‘void’
      ./libavcodec/avcodec.h:3785: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3786: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3786: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3820: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3821: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3821: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3827: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3828: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3828: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3845: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3846: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3846: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavcodec/avcodec.h:3847: error: expected ‘;’ before ‘void’
      ./libavcodec/avcodec.h:3855: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavcodec/avcodec.h:3856: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavcodec/avcodec.h:3856: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      In file included from ./libavformat/avformat.h:58,
      from libavdevice/alldevices.c:22:
      ./libavformat/avio.h:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_seek’
      ./libavformat/avio.h:148: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_filesize’
      ./libavformat/avio.h:205: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_url_read_seek’
      ./libavformat/avio.h:228: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avio.h:274: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:275: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:276: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avio.h:297: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:298: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:299: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avio.h:305: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:306: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:307: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avio.h:311: error: expected declaration specifiers or ‘…’ before ‘uint64_t’
      ./libavformat/avio.h:312: error: expected declaration specifiers or ‘…’ before ‘uint64_t’
      ./libavformat/avio.h:327: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_fseek’
      ./libavformat/avio.h:333: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avio.h:339: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_ftell’
      ./libavformat/avio.h:345: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_fsize’
      ./libavformat/avio.h:356: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_url_read_fseek’
      ./libavformat/avio.h:396: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_le64’
      ./libavformat/avio.h:403: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_be64’
      ./libavformat/avio.h:405: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_get_v’
      ./libavformat/avio.h: In function ‘url_is_streamed’:
      ./libavformat/avio.h:409: error: ‘ByteIOContext’ has no member named ‘is_streamed’
      ./libavformat/avio.h: At top level:
      ./libavformat/avio.h:478: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:509: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avio.h:511: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavformat/avio.h:511: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavformat/avio.h:515: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
      ./libavformat/avio.h:515: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
      ./libavformat/avio.h:516: error: expected ‘;’, ‘,’ or ‘)’ before ‘unsigned’
      In file included from libavdevice/alldevices.c:22:
      ./libavformat/avformat.h:200: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avformat.h:335: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:341: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avformat.h:385: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avformat.h:423: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avformat.h:563: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avformat.h:594: error: expected specifier-qualifier-list before ‘int64_t’
      ./libavformat/avformat.h:826: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avformat.h:840: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
      ./libavformat/avformat.h:1018: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1047: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1047: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1047: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1102: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1102: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1131: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1148: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1148: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1160: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1170: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1179: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gen_search’
      ./libavformat/avformat.h:1305: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘parse_date’
      ./libavformat/avformat.h:1308: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gettime’
      ./libavformat/avformat.h:1312: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ffm_read_write_index’
      ./libavformat/avformat.h:1313: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1314: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      ./libavformat/avformat.h:1314: error: expected declaration specifiers or ‘…’ before ‘int64_t’
      make: *** [libavdevice/alldevices.o] Error 1

  6. On step 5, I got the error
    “Android NDK: The APP variable contains unknown app names: ffmpeg-org
    Android NDK: Please use one of: hello-gl2 hello-jni san-angeles two-libs unit-tests “.

    So I ignored it and do the step 6, but when I try to make again, the error still there.

    Please help on this issue.

    • under your $Android-NDK-root/apps/, there should be a “ffmpeg-org” dir. and under ffmpeg-org, you will need to have a Application.mk. Please read Android-NDK tutorial/doc

      • Hi,

        I too have problems with make. I’m unable to find application.mk under FFMpeg root dir. Is there ne way to generate it.

      • under your $ANDROID_NDK_ROOT/apps/ffmpeg-org, you need to have one file called Application.mk and one directory called project.

        Following is the content of Application.mk:
        —————————————————————————
        APP_PROJECT_PATH := $(call my-dir)/project
        APP_MODULES := avutil avformat avcodec postproc swscale
        —————————————————————————–

      • Thanks for your previous reply. It worked. I created the Application.mk file and commented the functions as mentioned in the post, but still I get a lot of compilation error during make. Need your help…..

        The error is as follows

        root@ubuntuVbox:/home/swapna/DirectTv/android-ndk-r4/sources/FFMpeg# make TARGET_ARCH=arm APP=ffmpeg
        /bin/sh: /home/swapna/DirectTv/android-ndk-r4/sources/FFMpeg/version.sh: Permission denied
        CC libavdevice/alldevices.o
        In file included from libavdevice/alldevices.c:22:
        ./libavformat/avformat.h:54:18: warning: time.h: No such file or directory
        In file included from ./libavformat/avformat.h:55,
        from libavdevice/alldevices.c:22:
        /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘extern’
        /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:229: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__BEGIN_DECLS’
        /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:377: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__BEGIN_DECLS’
        /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/stdio.h:388: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘static’
        In file included from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavcodec/avcodec.h:29:19: warning: errno.h: No such file or directory
        In file included from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/common.h:29:19: warning: ctype.h: No such file or directory
        ./libavutil/common.h:31:22: warning: inttypes.h: No such file or directory
        In file included from /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/syslimits.h:7,
        from /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/limits.h:11,
        from ./libavutil/common.h:32,
        from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        /home/swapna/DirectTv/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/include/limits.h:122:61: error: no include path in which to search for limits.h
        In file included from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/common.h:33:18: warning: math.h: No such file or directory
        ./libavutil/common.h:35:20: warning: stdlib.h: No such file or directory
        ./libavutil/common.h:36:20: warning: string.h: No such file or directory
        In file included from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/common.h:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_log2_tab’
        ./libavutil/common.h:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_reverse’
        ./libavutil/common.h: In function ‘av_log2_c’:
        ./libavutil/common.h:71: error: ‘ff_log2_tab’ undeclared (first use in this function)
        ./libavutil/common.h:71: error: (Each undeclared identifier is reported only once
        ./libavutil/common.h:71: error: for each function it appears in.)
        ./libavutil/common.h: In function ‘av_log2_16bit_c’:
        ./libavutil/common.h:83: error: ‘ff_log2_tab’ undeclared (first use in this function)
        In file included from ./libavutil/common.h:90,
        from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/intmath.h:24:20: warning: stdint.h: No such file or directory
        In file included from ./libavutil/common.h:90,
        from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/intmath.h: At top level:
        ./libavutil/intmath.h:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_inverse’
        In file included from ./libavutil/common.h:90,
        from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/intmath.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_sqrt_tab’
        ./libavutil/intmath.h: In function ‘ff_sqrt’:
        ./libavutil/intmath.h:82: error: ‘ff_sqrt_tab’ undeclared (first use in this function)
        ./libavutil/intmath.h:92: error: ‘uint32_t’ undeclared (first use in this function)
        ./libavutil/intmath.h:92: error: ‘uint64_t’ undeclared (first use in this function)
        ./libavutil/intmath.h:92: error: expected ‘)’ before ‘c’
        ./libavutil/intmath.h:92: error: ‘ff_inverse’ undeclared (first use in this function)
        In file included from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/common.h: At top level:
        ./libavutil/common.h:119: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clip_uint8′
        ./libavutil/common.h:130: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clip_uint16′
        ./libavutil/common.h:141: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clip_int16′
        ./libavutil/common.h:152: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_clipl_int32′
        In file included from ./libavutil/common.h:305,
        from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/internal.h:36:20: warning: assert.h: No such file or directory
        In file included from ./libavutil/internal.h:186,
        from ./libavutil/common.h:305,
        from ./libavutil/avutil.h:81,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/libm.h: In function ‘lrint’:
        ./libavutil/libm.h:64: warning: implicit declaration of function ‘rint’
        ./libavutil/libm.h:64: warning: incompatible implicit declaration of built-in function ‘rint’
        ./libavutil/libm.h: In function ‘lrintf’:
        ./libavutil/libm.h:71: warning: incompatible implicit declaration of built-in function ‘rint’
        ./libavutil/libm.h: In function ’round’:
        ./libavutil/libm.h:78: warning: implicit declaration of function ‘floor’
        ./libavutil/libm.h:78: warning: incompatible implicit declaration of built-in function ‘floor’
        ./libavutil/libm.h:78: warning: implicit declaration of function ‘ceil’
        ./libavutil/libm.h:78: warning: incompatible implicit declaration of built-in function ‘ceil’
        ./libavutil/libm.h: In function ’roundf’:
        ./libavutil/libm.h:85: warning: incompatible implicit declaration of built-in function ‘floor’
        ./libavutil/libm.h:85: warning: incompatible implicit declaration of built-in function ‘ceil’
        ./libavutil/libm.h: In function ‘truncf’:
        ./libavutil/libm.h:92: warning: incompatible implicit declaration of built-in function ‘floor’
        ./libavutil/libm.h:92: warning: incompatible implicit declaration of built-in function ‘ceil’
        In file included from ./libavutil/avutil.h:82,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/error.h:31:5: warning: “EDOM” is not defined
        In file included from ./libavutil/mathematics.h:27,
        from ./libavutil/avutil.h:83,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/rational.h: In function ‘av_cmp_q’:
        ./libavutil/rational.h:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘tmp’
        ./libavutil/rational.h:49: error: ‘tmp’ undeclared (first use in this function)
        ./libavutil/rational.h:49: error: ‘int64_t’ undeclared (first use in this function)
        ./libavutil/rational.h:49: error: expected ‘;’ before ‘b’
        ./libavutil/rational.h: At top level:
        ./libavutil/rational.h:74: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavutil/rational.h:74: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavutil/rational.h:74: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        In file included from ./libavutil/avutil.h:83,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/mathematics.h:70: warning: data definition has no type or storage class
        ./libavutil/mathematics.h:70: warning: type defaults to ‘int’ in declaration of ‘int64_t’
        ./libavutil/mathematics.h:70: warning: ‘const’ attribute ignored
        ./libavutil/mathematics.h:70: error: expected ‘,’ or ‘;’ before ‘av_gcd’
        ./libavutil/mathematics.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_rescale’
        ./libavutil/mathematics.h:82: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_rescale_rnd’
        ./libavutil/mathematics.h:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_rescale_q’
        ./libavutil/mathematics.h:95: error: expected ‘)’ before ‘ts_a’
        ./libavutil/mathematics.h:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_compare_mod’
        In file included from ./libavutil/avutil.h:85,
        from ./libavcodec/avcodec.h:30,
        from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavutil/intfloat_readwrite.h:29: error: expected specifier-qualifier-list before ‘uint8_t’
        ./libavutil/intfloat_readwrite.h:33: error: expected ‘)’ before ‘v’
        ./libavutil/intfloat_readwrite.h:34: error: expected ‘)’ before ‘v’
        ./libavutil/intfloat_readwrite.h:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_dbl2int’
        ./libavutil/intfloat_readwrite.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_flt2int’
        In file included from ./libavformat/avformat.h:56,
        from libavdevice/alldevices.c:22:
        ./libavcodec/avcodec.h:705: error: expected specifier-qualifier-list before ‘int16_t’
        ./libavcodec/avcodec.h:970: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavcodec/avcodec.h:1022: error: expected specifier-qualifier-list before ‘uint8_t’
        ./libavcodec/avcodec.h:1090: error: expected specifier-qualifier-list before ‘uint8_t’
        ./libavcodec/avcodec.h:2687: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:2710: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
        ./libavcodec/avcodec.h:2767: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:2767: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:2780: error: expected ‘;’ before ‘int’
        ./libavcodec/avcodec.h:2808: error: expected specifier-qualifier-list before ‘uint8_t’
        ./libavcodec/avcodec.h:2881: error: expected specifier-qualifier-list before ‘uint16_t’
        ./libavcodec/avcodec.h:3053: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3157: error: expected ‘)’ before ‘pix_fmt_mask’
        ./libavcodec/avcodec.h:3414: error: expected declaration specifiers or ‘…’ before ‘int16_t’
        ./libavcodec/avcodec.h:3416: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3416: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3458: error: expected declaration specifiers or ‘…’ before ‘int16_t’
        ./libavcodec/avcodec.h:3478: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3478: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3531: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3531: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3548: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3550: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3571: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3586: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3588: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3642: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavcodec/avcodec.h:3769: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3769: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3771: error: expected ‘;’ before ‘void’
        ./libavcodec/avcodec.h:3785: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3786: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3786: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3820: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3821: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3821: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3827: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3828: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3828: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3845: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3846: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3846: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavcodec/avcodec.h:3847: error: expected ‘;’ before ‘void’
        ./libavcodec/avcodec.h:3855: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavcodec/avcodec.h:3856: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavcodec/avcodec.h:3856: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        In file included from ./libavformat/avformat.h:58,
        from libavdevice/alldevices.c:22:
        ./libavformat/avio.h:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_seek’
        ./libavformat/avio.h:148: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_filesize’
        ./libavformat/avio.h:205: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_url_read_seek’
        ./libavformat/avio.h:228: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avio.h:274: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:275: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:276: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avio.h:297: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:298: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:299: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avio.h:305: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:306: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:307: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avio.h:311: error: expected declaration specifiers or ‘…’ before ‘uint64_t’
        ./libavformat/avio.h:312: error: expected declaration specifiers or ‘…’ before ‘uint64_t’
        ./libavformat/avio.h:327: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_fseek’
        ./libavformat/avio.h:333: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avio.h:339: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_ftell’
        ./libavformat/avio.h:345: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘url_fsize’
        ./libavformat/avio.h:356: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_url_read_fseek’
        ./libavformat/avio.h:396: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_le64′
        ./libavformat/avio.h:403: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_be64′
        ./libavformat/avio.h:405: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_get_v’
        ./libavformat/avio.h: In function ‘url_is_streamed’:
        ./libavformat/avio.h:409: error: ‘ByteIOContext’ has no member named ‘is_streamed’
        ./libavformat/avio.h: At top level:
        ./libavformat/avio.h:478: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:509: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avio.h:511: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavformat/avio.h:511: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavformat/avio.h:515: warning: type defaults to ‘int’ in declaration of ‘uint8_t’
        ./libavformat/avio.h:515: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
        ./libavformat/avio.h:516: error: expected ‘;’, ‘,’ or ‘)’ before ‘unsigned’
        In file included from libavdevice/alldevices.c:22:
        ./libavformat/avformat.h:200: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avformat.h:335: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:341: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avformat.h:385: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avformat.h:423: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avformat.h:563: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avformat.h:594: error: expected specifier-qualifier-list before ‘int64_t’
        ./libavformat/avformat.h:826: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avformat.h:840: error: expected declaration specifiers or ‘…’ before ‘uint8_t’
        ./libavformat/avformat.h:1018: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1047: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1047: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1047: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1102: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1102: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1131: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1148: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1148: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1160: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1170: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1179: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gen_search’
        ./libavformat/avformat.h:1305: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘parse_date’
        ./libavformat/avformat.h:1308: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gettime’
        ./libavformat/avformat.h:1312: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ffm_read_write_index’
        ./libavformat/avformat.h:1313: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1314: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        ./libavformat/avformat.h:1314: error: expected declaration specifiers or ‘…’ before ‘int64_t’
        make: *** [libavdevice/alldevices.o] Error 1

  7. I don’t understand how to make understand the compiler that it will not result in an executable program… : “… is unable to create an executable file…”

    How did you manage that ??

    Thanks for the help

  8. Hi,

    I am using the newest version of the NDK and trying to compile using above steps after making the necessary changes in the ./configure command line. However, I get compile C compile error:

    Unknown C compiler /bin/arm-eabi-gcc
    /bin/arm-eabi-gcc is unable to create an executable file.
    C compiler test failed

    Any ideas as to why I am getting this?

    ALso, can someone send updated instructions using latest NDK?

    Thanks,

    Abhi

    • remove hidden ^M character.
      vi -b run.sh
      :%s/^M//g

  9. Could you please give us ffmepg binary, you built?

  10. Hi Guys,

    thanks for this tutorial. I’m stuck in between .configure and make – maybe you can help me out.

    I created a modified configure script like this:

    ——————————————–
    #!/bin/bash

    NDK=/home/sgreve/Projekte/android-ndk-r4
    PREBUILT=$NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1
    PROJHOME=pwd

    ./configure –target-os=linux \
    –arch=armv41 \
    –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 ” \
    –enable-static \
    –disable-shared \
    –disable-asm \
    –disable-yasm \
    –prefix=$PROJHOME \
    –extra-ldflags=”-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link=$NDK/build/platforms/android-3/arch-arm/usr/lib -L$NDK/build/platforms/android-3/arch-arm/usr/lib -nostdlib $NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/crtbegin.o $NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/crtend.o -lc -lm -ldl”

    # exclude all subdir.mak and config.mak includes
    # in all the makefiles
    for file in $(find . -name “Makefile”)
    do
    echo modifying $file
    sed -i ‘s/include config.mak/#include config.mak/g’ $file
    sed -i ‘s/include config.mak/#include subdir.mak/g’ $file
    sed -i ‘s/##/#/g’ $file
    done

    exit
    ——————————————–

    From my point of view this scirpt does well as it finishes saying:
    —————————————————-
    License: LGPL version 2.1 or later
    Creating config.mak and config.h…
    config.h is unchanged
    libavutil/avconfig.h is unchanged
    ( … + my modified output )
    —————————————————-

    But when I then try to use ndk-build it says:
    —————————————————-
    /home/sgreve/workspace/ffmpeg-android/jni/libavcodec/../av.mk:3: /home/sgreve/workspace/ffmpeg-android/jni/libavcodec/../config-arm.mak: No such file or directory
    /home/sgreve/workspace/ffmpeg-android/jni/libavformat/../av.mk:3: /home/sgreve/workspace/ffmpeg-android/jni/libavformat/../config-arm.mak: No such file or directory
    /home/sgreve/workspace/ffmpeg-android/jni/libavutil/../av.mk:3: /home/sgreve/workspace/ffmpeg-android/jni/libavutil/../config-arm.mak: No such file or directory
    /home/sgreve/workspace/ffmpeg-android/jni/libpostproc/../av.mk:3: /home/sgreve/workspace/ffmpeg-android/jni/libpostproc/../config-arm.mak: No such file or directory
    /home/sgreve/workspace/ffmpeg-android/jni/libswscale/../av.mk:3: /home/sgreve/workspace/ffmpeg-android/jni/libswscale/../config-arm.mak: No such file or directory
    make: *** Keine Regel, um »/home/sgreve/workspace/ffmpeg-android/jni/libswscale/../config-arm.mak« zu erstellen. Schluss.
    —————————————————-

    Which makes some kind of sense as there are no config-arm.mak files 🙂

    The ffmpeg sources are stored in
    /jni/
    and I call ndk-build from

    Maybe you can give me some hints
    Thanks

    • damn tag removal:

      The ffmpeg sources are stored in
      {EmptyEclipseProject}/jni/
      and I call ndk-build from {EmptyEclipseProject}

  11. http://abitno.me/compile-ffmpeg-android-ndk

  12. I have compiled the libFFmpeg.so file, but cannot figure out how to use it in a java android project. Any tips?

    Thanks!
    Bryan

  13. You can modify config.h so that the line

    #define restrict restrict

    is

    #define restrict __restrict

    and then you don’t have to worry about fixing the restrict errors.

  14. What version of ffmpeg did you use? When i use your config script with the current repository snapshot it complains “unknown option DANDROID, unknown option -rpath-link”, etc.

    • Some good sites for you, they have pre-configured Android.mk files for ffmpeg.
      Search “arcMedia” and “RockPlayer”, you can find their pre-configured ffmpeg source code with Android.mk files.

  15. […] https://slworkthings.wordpress.com/2010/02/23/ffmpeg-and-android-mk/ […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: