Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

configuration - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...