我一直试图在网上找到一个解决方案,几天没有运气。我使用Ubuntu,并试图编译FFMPEG最新的稳定版本(1.0.1)与X264支持。我确信我卸载任何现有的X264然后我下载了最新的X264源和以下配置编译它:
./configure --prefix=$PREFIX \
--enable-shared \
--enable-static \
--disable-gpac \
--extra-cflags=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP " \
--extra-ldflags=" -nostdlib -Bdynamic -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,nocopyreloc -Wl,-soname,/usr/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -lc -lm -ldl -lgcc" \
--cross-prefix=${ARM_PRE}- \
--disable-asm \
--host=arm-linux \
make clean
make install
一切顺利的话,我检查了安装的版本:
x264 -V
x264 0.129.x
built on Dec 27 2012, gcc: 4.6.1
configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
然后我尝试编译FFMPEG有以下选项:
./configure --target-os=linux \
--enable-libx264 \
--enable-gpl \
--prefix=$PREFIX \
--extra-cflags="-I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/include -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264 -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
在配置和使清洁/ make install的工作做好了,但是当我尝试创建.so文件以下命令将失败:
/home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld
-rpath-link=./android/armv7-a/usr/lib -L/home/tishu/Apps/android-ndk-r8d/platforms/android-14/arch-arm/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic \
--whole-archive --no-undefined -o ./android/armv7-a/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog \
--warn-once \
--dynamic-linker=/system/bin/linker /home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
这种失败,出现以下的输出:
libavcodec/libavcodec.a(libx264.o): In function `X264_frame':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:159: undefined reference to `x264_picture_init'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:179: undefined reference to `x264_encoder_reconfig'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:190: undefined reference to `x264_encoder_encode'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:196: undefined reference to `x264_encoder_delayed_frames'
libavcodec/libavcodec.a(libx264.o): In function `encode_nals':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:101: undefined reference to `x264_bit_depth'
libavcodec/libavcodec.a(libx264.o): In function `X264_close':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:231: undefined reference to `x264_encoder_close'
libavcodec/libavcodec.a(libx264.o): In function `X264_init':
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:284: undefined reference to `x264_param_default'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:292: undefined reference to `x264_param_default_preset'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:314: undefined reference to `x264_param_parse'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:459: undefined reference to `x264_param_apply_fastfirstpass'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:490: undefined reference to `x264_param_apply_profile'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:533: undefined reference to `x264_encoder_open_129'
/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:544: undefined reference to `x264_encoder_headers'
它正在寻找(129)的X264版本是一个用--enable-共享安装并成功编译。显然,所有的时候,不包括LIB 64编译罚款。
问:我如何指定包括最后命令路径?我尝试添加的路径,$ PATH,并且还加入这个与没有运气的说法:-I /家庭/ tishu /工作区/的ffmpeg / ffmpeg的/ JNI / X264
谢谢
对于跟随者(甚至不是机器人,但类似消息)
/.../mingw-w64-i686/lib/gcc/.../i686-w64-mingw32/bin/ld:
libavcodec/libavcodec.a(libx264.o):libx264.c:(.text+0x3c):
undefined reference to `x264_bit_depth'
: undefined reference to `x264_encoder_open_152'
出现此常数“下降”初期2017年见https://trac.ffmpeg.org/ticket/6966和https://trac.ffmpeg.org/ticket/6932
修复:更新的ffmpeg,或者downdate libx264 ...什么...
虽然这些天它应该什么样的支持libx264的旧版本,以及...