建立FFMPEG与librtmp为android [英] Building FFMPEG with librtmp for android

查看:347
本文介绍了建立FFMPEG与librtmp为android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试使用NDK r7b构建FFMPEG的一体化静态二进制文件,并且一切正常,直到我尝试使用RTMP支持来构建它。我来自 https://github.com/guardianproject/android-ffmpeg 与librtmp2的来源.4和这样的自定义配置

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

和r tmpdump目录位于与ffmpeg相同的级别。
我知道我的配置中的最后两个字符串说编译器可能会找到librtmp的来源。
但是我得到的只是错误:librtmp找不到



我没有被NDK和obviosly我缺少一些重要的部分,但我找不到它自己。

解决方案

这是有挑战性的,但我认为我有一个办法。配置时的问题是FFmpeg希望通过pkg-config管理系统来检测正确的librtmp安装。



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

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

注释(将'#'放在前面线)。现在,重新运行配置,只有这些修改:

   -  extra-cflags = -  I / full / path /到/ rtmpdump

这可能有助于在这里有绝对路径。另外,由于#include指令已经在头文件前面带有librtmp /,所以省略/ librtmp /。下一步:

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

再次,绝对路径,并指定要链接的库,因为我们通过configure注释掉该逻辑。



现在,配置应该成功,交叉编译也应该很开心。最终的ffmpeg二进制文件应该根据协议报告RTMP模块系列:

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

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


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.

解决方案

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.

这篇关于建立FFMPEG与librtmp为android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆