繁体   English   中英

如何使用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_memalign并进行一些调整)函数,从而发现问题。 并通过删除cmakelist.txt文件中的“ -lpthread”修复了pthread链接问题。

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

我在FFmpeg配置时启用了libx265。 但是运行配置后,它在屏幕上显示“使用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.a。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM