使用 librtmp 为 android 构建 FFMPEG [英] Building FFMPEG with librtmp for android

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

问题描述

我正在尝试使用 NDK r7b 构建 FFMPEG 的多合一静态二进制文件,一切正常,直到我尝试使用 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 的来源.但我得到的只是 ERROR: librtmp not found

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

我对 NDK 没有经验,显然我遗漏了一些重要的部分,但我自己找不到.

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

推荐答案

这很有挑战性,但我想我有一个解决方案.配置时的问题是 FFmpeg 希望通过 pkg-config 管理系统检测正确的 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 指令已经在头文件前面加上 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.

现在,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 开发环境来对此进行测试.但是我在我的桌面 Ubuntu 系统上通过编译 librtmp(没有通过 pkg-config 安装包)然后执行上述步骤进行测试.

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.

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

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