Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于libffmpeg.so的问题 #247

Open
mengzhidaren opened this issue Nov 6, 2017 · 6 comments
Open

关于libffmpeg.so的问题 #247

mengzhidaren opened this issue Nov 6, 2017 · 6 comments

Comments

@mengzhidaren
Copy link

大师兄你好,我用你的FFmpeg-Android角本编译好的armeabi-v7库libbzffmpeg.so在部分低配手机上会闪退比如:魅族2等
我也试着自已编译了下,在其它主流手机也没什么问题 但是低配手机还是不兼容还是闪退,但换用你的android-gpuimage-plus编译好的armeabi-v7库libffmpeg.so就没问题,能给点帮助吗

···

11-06 11:44:54.816 23383-23383/com.myvideo A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 23383 (com.myvideo)
11-06 11:44:54.867 23304-23304/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-06 11:44:54.867 23304-23304/? I/DEBUG: Build fingerprint: 'Meizu/meizu_mx2/mx2:5.0.1/LRX22C/m04x.Flyme_OS_4.5.7.20151021090108:user/release-keys'
11-06 11:44:54.867 23304-23304/? I/DEBUG: Revision: '17429'
11-06 11:44:54.867 23304-23304/? I/DEBUG: ABI: 'arm'
11-06 11:44:54.867 23304-23304/? I/DEBUG: pid: 23383, tid: 23383, name: com.myvideo >>> com.myvideo <<<
11-06 11:44:54.867 23304-23304/? I/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
11-06 11:44:54.898 23304-23304/? I/DEBUG: r0 00000000 r1 00005b57 r2 00000006 r3 00000000
11-06 11:44:54.898 23304-23304/? I/DEBUG: r4 4012f114 r5 00000006 r6 00000058 r7 0000010c
11-06 11:44:54.898 23304-23304/? I/DEBUG: r8 00000001 r9 4012e82c sl 00000001 fp 6f0c5a6c
11-06 11:44:54.898 23304-23304/? I/DEBUG: ip 00005b57 sp be8228b8 lr 4016fe11 pc 40192ed4 cpsr 60070010
11-06 11:44:54.898 23304-23304/? I/DEBUG: backtrace:
11-06 11:44:54.898 23304-23304/? I/DEBUG: #00 pc 00039ed4 /system/lib/libc.so (tgkill+12)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #1 pc 00016e0d /system/lib/libc.so (pthread_kill+52)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #2 pc 00017a2b /system/lib/libc.so (raise+10)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #3 pc 00014281 /system/lib/libc.so (__libc_android_abort+36)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #4 pc 00012a50 /system/lib/libc.so (abort+4)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #5 pc 007a8090 /data/app/com.myvideo-1/lib/arm/libyylffmpeg.so
11-06 11:44:54.898 23304-23304/? I/DEBUG: #6 pc 00001a89 /system/bin/linker (__dl__ZN6soinfo12CallFunctionEPKcPFvvE+44)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #7 pc 00001b5d /system/bin/linker (__dl__ZN6soinfo9CallArrayEPKcPPFvvEjb+140)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #8 pc 00001e3d /system/bin/linker (__dl__ZN6soinfo16CallConstructorsEv+144)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #9 pc 00002491 /system/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfo+136)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #10 pc 00000e9d /system/bin/linker (__dl__ZL10dlopen_extPKciPK17android_dlextinfo+24)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #11 pc 001cf5bf /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, art::Handleart::mirror::ClassLoader, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)+502)
11-06 11:44:54.898 23304-23304/? I/DEBUG: #12 pc 001f55e5 /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv
, _jclass*, _jstring*, _jobject*, _jstring*)+548)
11-06 11:44:54.899 23304-23304/? I/DEBUG: #13 pc 00077809 /data/dalvik-cache/arm/system@[email protected]
····

@wysaid
Copy link
Owner

wysaid commented Nov 6, 2017

你看看这个 #93
里面有编译好的, 看看这个有没有问题?

@mengzhidaren
Copy link
Author

这个留言我试过了的 最早就是用这个角本编译的 最近线上项目报错才知道 库的兼容性有问题 现在换成你的角本还是有问题 但用你线上的android-gpuimage-plus编译好的.so就没问题 现在是一加载.so直接进程闪退不能捕获异常

@wysaid
Copy link
Owner

wysaid commented Nov 6, 2017

我编译用的ffmpeg版本是 2.8.6, 来源是 git://source.ffmpeg.org/ffmpeg.git
x264 来源 http://git.videolan.org/git/x264.git 用的是去年的某个版本
下面是编译x264用的参数:

#!/bin/bash

echo "###### 开始编译 x264 ######"

SOURCE=$TARGET_X264_DIR
cd $SOURCE
#PREFIX指定的是编译输出路径,不指定默认是/usr/local/lib和/usr/local/include
#PREFIX=/usr/local/x264

EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__"
EXTRA_LDFLAGS="-nostdlib"

./configure \
	--cross-prefix=$CROSS_PREFIX \
	--extra-cflags="$EXTRA_CFLAGS" \
	--extra-ldflags="$EXTRA_LDFLAGS" \
	--enable-static \
	--enable-pic \
	--enable-strip \
	--disable-cli \
	--host=arm-linux \
	--sysroot=$SYSROOT

make clean
make STRIP=-j4 install
cd ../

然后下面是编译ffmpeg用的参数

#!/bin/bash

echo "###### 开始编译 ffmpeg ######"

SOURCE=$TARGET_FFMPEG_DIR
cd $SOURCE

ADD_H264_FEATURE="--enable-encoder=aac \
--enable-decoder=aac \
--enable-gpl \
--enable-encoder=libx264 \
--enable-libx264 \
--extra-cflags=-I/usr/local/include \
--extra-ldflags=-L/usr/local/lib "

function build_one_so
{
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-doc \
--disable-symver \
--disable-avdevice \
--disable-avfilter \
--enable-small \
--enable-asm \
--enable-neon \
--cross-prefix=$CROSS_PREFIX \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--disable-parsers \
--enable-parser=aac \
--enable-parser=h264 \
--disable-encoders \
--disable-decoders \
--enable-decoder=h264 \
--disable-network \
--disable-protocols \
--enable-protocol=file \
--disable-filters \
$ADD_H264_FEATURE
make clean
make -j4
make install
}

build_one_so

@mengzhidaren
Copy link
Author

试了一天了 放弃了 不是版本问题就是 --extra-cflags 和--extra-ldflags这个两参数有问题 这个老cpu淘汰3年多了 应该是属于armv5,armv6, vfp, neon其中一个 但我传参 -mfpu=vfp 试了半天都不行 不适配它们了,有点浪费时间,降版本一定能行但我不想降,谢谢回复

@mengzhidaren
Copy link
Author

大师兄你好 上次问了问题一直没说解决方法今天突然想起来这个bug
就顺便说下解决方法
先说下原因
测试不支持的cpu 如:魅族2的手机 m045
cpuinfo=Features : swp half thumb fastmult vfp edsp neon vfpv3 tls
然后其它手机的cpu
cpuinfo=Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
解决方法1
FileReader fileReader = new FileReader("/proc/cpuinfo");
读取cpuinfo配置信息
不支持vfpv4就别加载ffmpeg.so文件了
解决方法2
修改编译器选项配置
gcc选择用-mfpu=vfpv3-fp16来指定为vfp协处理,而-mfpu=neon-vfpv4等就能指定为NEON+VFP结构
不过我是方法是推荐不加载.so文件,连vfpv4都不支持就别兼容这么老的机器了放弃最好还省事速度还快很多

@wysaid
Copy link
Owner

wysaid commented Dec 30, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants