我已经搜索过了,虽然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和stream-recorder thread之后用polarSSL构建了librtmp。它看起来工作正常,并且我有一个librtmp.so、librtmp.a和rtmp.h
当我尝试用librtmp编译ffmpeg时,我得到了错误
ERROR: librtmp not foundThis SO question helped,并且我修改了ffmpeg的配置文件,这样它就不会为librtmp查看pkg-config (即使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的身份验证功能。
发布于 2013-12-22 15:42:50
感谢您将此问题分解为一个单独的问题,并详细说明了您的流程和问题。
根据提供的数据,您可以构建FFmpeg并执行二进制文件,以便查看协议列表。但是安装阶段失败了吗?必须存在rtmp.h文件,因为是二进制构建(在编译时需要.h,而不是在链接时或运行时)。
我最好的猜测是,编译后的FFmpeg二进制文件动态链接到librtmp.so。你是不是把librtmp.so复制到这个系统上了(假设这里是交叉编译)?如果它存在,您是否运行了/sbin/ldconfig来注册库?运行ldd ffmpeg查看FFmpeg二进制文件想要查看的.so库。它是不是缺少一个到librtmp.so的链接?
发布于 2014-02-05 03:52:11
我已经documented了我成功构建FFmpeg 2.1.3的过程。
简单地说,构建Open/PolarSSL和librtmp之后,下载the latest FFmpeg release并对FFmpeg的configure进行以下更改
# ffmpegX.X.X/configure
...
# Replace the following lines:
#SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
#LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
#SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
#SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
# With:
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)'
...
# Replace this:
#enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
# With:
enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Socket -L/path/to/rtmpdump/librtmp/android/arm/lib -lrtmp然后使用以下构建脚本编译FFmpeg:
# ffmpegX.X.X/build_ffmpeg_with_librtmp_for_android.sh
#!/bin/bash
NDK=/path/to/android-ndk-r9c
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64
OPENSSL_DIR=/path/to/openssl-android/
LIBRTMP_DIR=/path/to/rtmpdump/librtmp/
# Note: Change above variables to match your system
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-librtmp \
--enable-shared \
--disable-static \
--disable-doc \
--disable-programs \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j8
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm -I${OPENSSL_DIR}include -I${LIBRTMP_DIR}android/arm/include -L${LIBRTMP_DIR}android/arm/lib -lrtmp"
ADDI_LFLAGS="-L${OPENSSL_DIR}libs/armeabi -L${LIBRTMP_DIR}android/arm/lib -lrtmp"
build_one非常感谢我的朋友Chris帮我渡过难关。
发布于 2019-03-05 17:07:12
我猜你没有在你的项目中链接库rtmp。您需要像这样链接rtmp库
-L${CMAKE_SOURCE_DIR}/src/main/cpp/libs/${CMAKE_ANDROID_ARCH_ABI}") (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} set
target_link_libraries(本地库avformat avcodec avfilter avutil swresample swscale z rtmp)
https://stackoverflow.com/questions/20721445
复制相似问题