Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building FFMPEG with librtmp for android

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.

like image 573
Andrew Avatar asked Mar 09 '12 13:03

Andrew


1 Answers

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.

like image 171
Multimedia Mike Avatar answered Oct 21 '22 08:10

Multimedia Mike