使用librtmp为android构建FFMPEG

And*_*rew 11 configuration android ffmpeg rtmp android-ndk

我正在尝试使用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 \
Run Code Online (Sandbox Code Playgroud)

和rtmpdump目录位于与ffmpeg相同的级别.据我所知,我的配置中的最后两个字符串说明编译器可能找到librtmp的来源.但我得到的只是ERROR: librtmp not found

我并没有对NDK进行过任何考验,而且我错过了一些重要的部分,但我自己找不到它.

Mul*_*ike 11

这很有挑战性,但我想我有一个解决方案.配置时的问题是FFmpeg想要通过pkg-config管理系统检测正确的librtmp安装.

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

enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
Run Code Online (Sandbox Code Playgroud)

注释掉(在行的前面加上'#').现在,重新运行configure,只进行以下修改:

--extra-cflags="-I/full/path/to/rtmpdump"
Run Code Online (Sandbox Code Playgroud)

这里有一条绝对的道路可能会有所帮助.另外,最后省略/ librtmp /,因为#include指令已经使用librtmp /前缀头文件.下一个:

--extra-ldflags="-L/full/path/to/rtmpdump -lrtmp"
Run Code Online (Sandbox Code Playgroud)

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

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

ffmpeg -protocols
[...]
rtmp
rtmpe
rtmps
rtmpt
rtmpte
Run Code Online (Sandbox Code Playgroud)

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