11

I'm trying to build all-in-one static binary of FFMPEG with NDK r7b and everything works fine untill i try to build it with RTMP support.

I'm usind sources from https://github.com/guardianproject/android-ffmpeg with librtmp2.4 and custom config like this

.configure \
--target-os=linux \
--cross-prefix=arm-linux-androideabi- \
--arch=arm \
--sysroot=/home/andrey/android-ndk-r7b/platforms/android-3/arch-arm \
--enable-static \
--disable-shared \
--disable-symver \
--enable-small \
--disable-devices \
--disable-avdevice \
--enable-gpl \
--enable-librtmp \
--prefix=../build/ffmpeg/armeabi \
--extra-cflags=-I../rtmpdump/librtmp \
--extra-ldflags=-L../rtmpdump/librtmp \

and rtmpdump directory lays on the same level as ffmpeg. As i understand last two strings in my config says where compiler may find sources of librtmp. But all i get is ERROR: librtmp not found

I'm not expereienced with NDK and obviosly i missing some important part but i can't find it by myself.

Andrew
  • 1,756
  • 3
  • 18
  • 31

1 Answers1

11

This is challenging, but I think I have a solution. The problem at configure-time is that FFmpeg wants to detect a proper librtmp installation via the pkg-config management system.

I'm assuming your have successfully cross-compiled librtmp in the directory referenced by ../rtmpdump. Edit the FFmpeg configure script and search for the line:

enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket

Comment that out (put a '#' at the front of the line). Now, re-run configure, only with these modifications:

--extra-cflags="-I/full/path/to/rtmpdump"

It may help to have an absolute path here. Also, omit /librtmp/ at the end since the #include directives already prefix the header files with librtmp/. Next:

--extra-ldflags="-L/full/path/to/rtmpdump -lrtmp"

Again, absolute path, and specify the library to link against since we commented out that logic via configure.

Now, configure should succeed and the cross-compilation should also be happy. The final ffmpeg binary should report the family of RTMP modules under protocols:

ffmpeg -protocols
[...]
rtmp
rtmpe
rtmps
rtmpt
rtmpte

Note that I don't have an NDK dev environment to test this on. But I tested on my desktop Ubuntu system by compiling librtmp (without the package being installed via pkg-config) and then performing the above steps.

Multimedia Mike
  • 12,660
  • 5
  • 46
  • 62
  • Valuable info, Can you take a look at this : http://stackoverflow.com/questions/9605757/using-ffmpeg-with-android-ndk – iSun Mar 11 '12 at 16:09
  • I saw that question but I don't have much experience with Android NDK or Cygwin. – Multimedia Mike Mar 11 '12 at 16:52
  • Thank You Mike! It looks OK now on compilation step, it works indeed for x86 Ubuntu. But i am afraid i'm having now problems with cross-compiling librtmp. I should post it as separate topic. – Andrew Mar 12 '12 at 09:40
  • 1
    Mike, thank you. Following your instructions helped get me much further, but ultimately my build fails with errors like "libavformat/librtmp.o: in function rtmp_get_file_handle:libavformat/librtmp.c:190: error: undefined reference to 'RTMP_Socket'" - it sounds like it can't find the header file, but it is definitely there. Any pointers? – datu-puti Dec 20 '13 at 05:44
  • @elBradford: are you certain you have librtmp built correctly? – Multimedia Mike Dec 21 '13 at 02:04
  • @MultimediaMike I am pretty sure. I've posted my experience in this question: http://stackoverflow.com/questions/20721445/undefined-reference-when-compiling-ffmpeg-with-librtmp-on-android I'd be very grateful if you look at that. I've tried to be as complete as pssible. Thanks! – datu-puti Dec 21 '13 at 17:09
  • FWIW I had success building FFmpeg (current version 2.1.3 direct from FFMpeg.org, not the old GuardianProject build) with librtmp for Android. I documented my steps [here](https://github.com/OnlyInAmerica/FFmpeg-Android) – dbro Feb 04 '14 at 19:41