建筑FFMPEG与librtmp为Android建筑、FFMPEG、Android、librtmp

由网友(逢场作戏)分享简介:我试图建立的所有功能于一身的ffmpeg静态二进制NDK R7B,一切工作正常,直到我尝试使用RTMP支持建立它。I'm trying to build all-in-one static binary of FFMPEG with NDK r7b and everything works fine untill i...

我试图建立的所有功能于一身的ffmpeg静态二进制NDK R7B,一切工作正常,直到我尝试使用RTMP支持建立它。

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.

我是https://github.com/guardianproject/android-ffmpeg与librtmp2.4和自定义的配置是这样

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 

和rtmpdump目录规定在相同的水平的ffmpeg。 据我了解在我的配置最后两个字符串表示,在这里编译器可能会发现librtmp来源。 但我得到的是错误: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

我不expereienced与NDK和obviosly我丢失了一些重要的组成部分,但我找不到它由我自己。

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

推荐答案

这是具有挑战性的,但我想我有一个解决办法。在配置时的问题是,FFmpeg的希望通过pkg-配置管理系统,以检测适当librtmp安装。

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.

我假设你已经成功地交叉编译通过../rtmpdump引用的目录librtmp。编辑FFmpeg的配置脚本,并搜索行:

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"

这可能有助于在这里有一个绝对路径。此外,省略/ librtmp /时,因为#include指令已经preFIX与librtmp /头文件的末尾。下一页:

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.

现在,配置应该会成功的交叉编译也应该是快乐的。最后的ffmpeg的二进制文件应在协议报告的RTMP模块系列:

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

请注意,我没有一个NDK开发环境来测试这上。但我通过编译librtmp(不包正在通过pkg配置安装),然后执行上述步骤测试了我的桌面的Ubuntu系统。

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.

阅读全文

相关推荐

最新文章