【问题标题】:How to compile FFmpeg with libx265 for Android?如何为 Android 使用 libx265 编译 FFmpeg?
【发布时间】:2015-11-01 04:26:53
【问题描述】:

我已经成功地为 Android 编译了带有 libx264(作为静态库)的 FFmpeg。但我也想在 Android 上的 FFmpeg 中使用 libx265(作为静态库)。所以我做了一些尝试:

首先,我修复了 libx265 的 log2 函数和 posix_memalign 函数未发现问题,将它们更改为 log(使用 log 近似 log2)函数和 memalign(替换 posix_memalign 并进行一些调整)函数。并通过删除 cmakelist.txt 文件中的“-lpthread”修复了 pthread 链接问题。

然后,我使用cmake和make成功编译了libx265(作为静态库)。

我在配置 FFmpeg 时启用了 libx265。但是当配置运行时,它在屏幕上显示“libx265 not found using pkg-config”。

我检查了 config.log,发现了这些错误信息:

/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(bitstream.cpp.o):bitstream.cpp:typeinfo for x265::BitInterface: error: undefined reference to 'vtable for __cxxabiv1::__class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(bitstream.cpp.o):bitstream.cpp:typeinfo for x265::Bitstream: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(encoder.cpp.o):encoder.cpp:typeinfo for x265::SEIDecodedPictureHash: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(encoder.cpp.o):encoder.cpp:typeinfo for x265::SEIuserDataUnregistered: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(encoder.cpp.o):encoder.cpp:typeinfo for x265::SEIMasteringDisplayColorVolume: error: undefined reference to 'vtable for __cxxabiv1::__si_class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(threading.cpp.o):threading.cpp:typeinfo for x265::Thread: error: undefined reference to 'vtable for __cxxabiv1::__class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(wavefront.cpp.o):wavefront.cpp:typeinfo for x265::JobProvider: error: undefined reference to 'vtable for __cxxabiv1::__class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(slicetype.cpp.o):slicetype.cpp:typeinfo for x265::BondedTaskGroup: error: undefined reference to 'vtable for __cxxabiv1::__class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(frameencoder.cpp.o):frameencoder.cpp:function x265::FrameEncoder::encodeSlice(): error: undefined reference to '__dynamic_cast'
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(frameencoder.cpp.o):frameencoder.cpp:function x265::FrameEncoder::encodeSlice(): error: undefined reference to '__dynamic_cast'
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(frameencoder.cpp.o):frameencoder.cpp:function x265::FrameEncoder::processRowEncoder(int, x265::ThreadLocalData&): error: undefined reference to '__dynamic_cast'
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(frameencoder.cpp.o):frameencoder.cpp:function .LTHUNK2: error: undefined reference to '__dynamic_cast'
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(frameencoder.cpp.o):frameencoder.cpp:typeinfo for x265::FrameEncoder: error: undefined reference to 'vtable for __cxxabiv1::__vmi_class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/user/ffmpeg-2.8.1/android/arm/lib/libx265.a(sei.cpp.o):sei.cpp:typeinfo for x265::SEI: error: undefined reference to 'vtable for __cxxabiv1::__vmi_class_type_info'
/home/user/ffmpeg-2.8.1/android/arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function

我应该如何解决它?

【问题讨论】:

  • 如果我使用共享库,它会起作用。我认为有些库或函数我没有链接。
  • 可以为 arm 发布您的 /makefile/.configure 文件/脚本吗? @user3032481

标签: android c++ ffmpeg libx265


【解决方案1】:

我找到了解决办法。

我需要手动将「libgnustl_static.a」的路径作为参数添加到gcc/g++。完成后,编译成功。

【讨论】:

    【解决方案2】:

    最近我遇到了错误,正如 user3032481 所说。

    我修改ffmpeg的配置如下。

    --extra-libs="-lother_libs -L/Users/shutup/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -lgnustl_static" \
    

    我认为,原因是 x265 需要 c++ rtti 功能,但 android 默认 libstdc++ 不包含它。所以我们需要添加 libgnustl_static.a 。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-10
      • 2016-07-08
      • 1970-01-01
      • 2014-02-23
      • 1970-01-01
      • 1970-01-01
      • 2013-09-05
      • 1970-01-01
      相关资源
      最近更新 更多