android - 在 Android 上使用 librtmp 编译 FFMPEG 时出现 "Undefined Reference"

标签 android bash ffmpeg rtmp

我已经搜索过了,而 Building FFMPEG with librtmp for android回答了我的部分问题,我在编译过程中进一步遇到了其他问题。

首先,我尝试使用 this github repo 中的脚本。 ,更改标志以包括

  --enable-librtmp \
  --extra-cflags=-I/home/bradford/Development/FFMPEG/rtmp/rtmpdump/librtmp/ \
  --extra-ldflags=-L/home/bradford/Development/FFMPEG/rtmp/rtmpdump/librtmp"

我按照 S74ck3r 的 instructions on his github repo 使用 polarSSL 构建 librtmp和 stream-recorder thread .这似乎工作正常,我有一个 librtmp.so、librtmp.a 和 rtmp.h

当我尝试使用 librtmp 编译 ffmpeg 时,出现错误
ERROR: librtmp not found

This SO question helped ,我修改了 ffmpeg 的配置文件,使其不会查看 pkg-config 的 librtmp(即使 pkg-config 知道 librtmp ...):
#enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket

当我现在构建时,它成功启动,我得到了希望的线:
librtmp enabled           yes

后来我看到了更多好消息:
...
Enabled protocols:
applehttp       http            mmsh
cache           httpproxy       mmst
concat          librtmp         mmsu
crypto          librtmpe        pipe
fd          librtmps        rtp
file            librtmpt        tcp
gopher          librtmpte       udp
hls         md5
...

但最后,在编译完所有内容并在安装阶段,我得到了这些类型的错误:
INSTALL   libavutil/libavutil.pc
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_get_file_handle:libavformat/librtmp.c:190: error: undefined reference to 'RTMP_Socket'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_read_seek:libavformat/librtmp.c:180: error: undefined reference to 'RTMP_SendSeek'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_read_pause:libavformat/librtmp.c:161: error: undefined reference to 'RTMP_Pause'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_close:libavformat/librtmp.c:64: error: undefined reference to 'RTMP_Close'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_write:libavformat/librtmp.c:145: error: undefined reference to 'RTMP_Write'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_read:libavformat/librtmp.c:153: error: undefined reference to 'RTMP_Read'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:96: error: undefined reference to 'RTMP_LogSetLevel'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:97: error: undefined reference to 'RTMP_LogSetCallback'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:118: error: undefined reference to 'RTMP_Init'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:119: error: undefined reference to 'RTMP_SetupURL'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:127: error: undefined reference to 'RTMP_Connect'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:127: error: undefined reference to 'RTMP_ConnectStream'
/tmp/FFMPEG/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: libavformat/librtmp.o: in function rtmp_open:libavformat/librtmp.c:125: error: undefined reference to 'RTMP_EnableWrite'
collect2: ld returned 1 exit status

而我无法超越他们。听起来它找不到 rtmp.h,其中包含对这些函数的引用,但它存在于它应该存在的地方(afaik)。

另外,我的项目需要 librtmp - ffmpeg 的内置 rtmp 功能是不够的,因为我需要 librtmp 的身份验证功能。

最佳答案

感谢您将其分解为一个单独的问题并彻底阐明您的过程和问题。

根据提供的数据,您可以构建 FFmpeg 并执行二进制文件以查看协议(protocol)列表。但是安装阶段失败了? rtmp.h 文件必须存在,因为二进制构建(编译时需要.h,而不是链接时或运行时)。

我最好的猜测是您编译的 FFmpeg 二进制文件动态链接到 librtmp.so。您是否将 librtmp.so 复制到此系统上(假设此处为交叉编译)?如果存在,您是否运行了 /sbin/ldconfig为了注册图书馆?运行ldd ffmpeg查看 FFmpeg 二进制文件想要查看的 .so 库。它是否缺少指向 librtmp.so 的链接?

关于android - 在 Android 上使用 librtmp 编译 FFMPEG 时出现 "Undefined Reference",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20721445/

相关文章:

java - 从 RetrofitClient 内的 SharedPreferences 获取 BASE_URL

android - 带有 PendingIntent 的 FusedLocationApi 只被触发一次并且它的 null

linux - "xset"的反义词是什么?是否有 "xget"命令?

image - 裁剪图像并使用 ffmpeg 获取左侧部分

用于将 HTML5 视频从 ogg 转换为 mp4 的 ffmpeg 设置

android - 如何将 Linkedin 与我的 Android 应用程序集成?

java - ORMLite id 始终为 null(没有 id 字段)

linux - 如何使用 awk 命令验证文件的内容?

linux - 将 linux cout 重定向到脚本中的变量和屏幕

ffmpeg - 通过设置高度比修改后如何让ffmpeg计算宽度?