如何使用libx265为Android编译FFmpeg
How to compile FFmpeg with libx265 for Android?
我已经成功地用libx264(作为静态库)为Android编译了FFmpeg。但我也想在Android上的FFmpeg中使用libx265(作为静态库)。所以我做了一些尝试:
首先,我修复了libx265的log2函数和posix_memalign函数没有发现的问题,将它们改为log(使用log来近似log2)函数和memalign(替换posix_mealig并进行一些调整)函数。并通过删除cmakelist.txt文件中的"-lpthread"修复了pthread链接问题。
然后,我使用cmake和make成功地编译了libx265(作为静态库)。
我在配置FFmpeg时启用了libx265。但是当configure运行时,它在屏幕上显示"使用pkg config找不到libx265"。
我检查了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
我该怎么修?
我找到了解决方案。
我需要手动将"libgnustl_static.a"的路径添加到gcc/g++作为参数。完成后,编译将成功。
最近我遇到了错误,正如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.
相关文章:
- 二叉排序树无法编译
- 编译时未启用intel oneApi CUDA支持
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 编译包含字符串的代码时遇到问题
- 将 FFMPEG 的 GPU 版本编译为 OpenCV
- 编译自己的 FFMPEG 过滤器
- 我在使用 ffmpeg 进行开发时遇到的编译错误
- 使用 FFMPEG 将每个输入图像转换为 H264 编译时出错,该图像在 MevisLab 中运行的 Visual St
- FFMPEG 2.8.x 交叉编译错误在 Mac OS X 10.10 上
- 在Visual Studio 2013中编译FFMPEG
- 为什么我只需要直接在PC上编译ffmpeg,我将在其上开发将使用ffmpeg库的应用程序
- 错误:使用 NDK 编译 FFMPEG 时未定义对'av_free_packet(AVPacket*)'的引用
- VS2005 中的 ffmpeg 编译 mathops.h 中的汇编代码无法编译
- 如何使用libx265为Android编译FFmpeg
- FFMPEG安卓编译与libmp3lame
- Ffmpeg头文件不能在windows中编译
- C++Ubuntu.使用FFMPEG库编译的多个未定义引用
- ffmpeg编译错误__wrap_swr_convert
- GCC-如何使用FLV1(又名H.263)、MP3(格式和编解码器)和FLV(容器格式)编译FFMpeg
- 使用 Android NDK 为 x86 编译 FFmpeg 3.1.1