Building FFMPEG with librtmp for android Building FFMPEG with librtmp for android android android

Building FFMPEG with librtmp for android


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[...]rtmprtmpertmpsrtmptrtmpte

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.