3

我使用这个项目作为参考:代码可在http://roman10.net/src/affmpeg.zip获得。

我正在尝试使用与项目建议的配置不同的 ffmpeg 编译该项目。我编译了一个新的 libffmpeg.so 并将其添加到项目中。但是,现在我收到“UnsatisfiedLinkError”

02-24 11:05:45.644: D/dalvikvm(11363): Trying to load lib /data/data/roman10.media.ffmpeg/lib/libffmpeg.so 0x47b0ec70
02-24 11:05:45.680: D/dalvikvm(11363): Added shared lib /data/data/roman10.media.ffmpeg/lib/libffmpeg.so 0x47b0ec70
02-24 11:05:45.680: D/dalvikvm(11363): No JNI_OnLoad found in /data/data/roman10.media.ffmpeg/lib/libffmpeg.so 0x47b0ec70, skipping init
02-24 11:05:45.684: D/dalvikvm(11363): Trying to load lib /data/data/roman10.media.ffmpeg/lib/libconverter.so 0x47b0ec70
02-24 11:05:45.687: I/dalvikvm(11363): Unable to dlopen(/data/data/roman10.media.ffmpeg/lib/libconverter.so): Cannot load library: link_image[1995]: failed to link libconverter.so
02-24 11:05:45.687: W/dalvikvm(11363): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lroman10/media/ffmpeg/ffmpegService;.<clinit>
02-24 11:05:45.687: W/dalvikvm(11363): Class init failed in newInstance call (Lroman10/media/ffmpeg/ffmpegService;)
02-24 11:05:45.687: D/AndroidRuntime(11363): Shutting down VM
02-24 11:05:45.687: W/dalvikvm(11363): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
02-24 11:05:45.695: E/AndroidRuntime(11363): FATAL EXCEPTION: main
02-24 11:05:45.695: E/AndroidRuntime(11363): java.lang.ExceptionInInitializerError
02-24 11:05:45.695: E/AndroidRuntime(11363):    at java.lang.Class.newInstanceImpl(Native Method)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at java.lang.Class.newInstance(Class.java:1429)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2940)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at android.app.ActivityThread.access$3300(ActivityThread.java:125)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at android.os.Looper.loop(Looper.java:123)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at android.app.ActivityThread.main(ActivityThread.java:4627)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at java.lang.reflect.Method.invokeNative(Native Method)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at java.lang.reflect.Method.invoke(Method.java:521)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at dalvik.system.NativeStart.main(Native Method)
02-24 11:05:45.695: E/AndroidRuntime(11363): Caused by: java.lang.UnsatisfiedLinkError: Library converter not found
02-24 11:05:45.695: E/AndroidRuntime(11363):    at java.lang.Runtime.loadLibrary(Runtime.java:461)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at java.lang.System.loadLibrary(System.java:557)
02-24 11:05:45.695: E/AndroidRuntime(11363):    at roman10.media.ffmpeg.ffmpegService.<clinit>(ffmpegService.java:123)

我决定重新编译 converter.so 文件,但是,在其上运行 ndk-build 命令时,我收到以下消息:

c:\Users\user\workspace\Main\jni>c:\work\android-ndk-r8d\ndk-build
c:/android-ndk-r8d/build/core/build-binary.mk:266: warning: overriding comm
ands for target `c:/Users/user/workspace/Main//obj/local/armeabi/objs/converter'

c:/android-ndk-r8d/build/core/build-binary.mk:266: warning: ignoring old co
mmands for target `c:/Users/user/workspace/Main//obj/local/armeabi/objs/converte
r'
c:/android-ndk-r8d/build/core/build-binary.mk:266: warning: overriding comm
ands for target `c:/Users/user/workspace/Main//obj/local/armeabi/objs/converter'

c:/android-ndk-r8d/build/core/build-binary.mk:266: warning: ignoring old co
mmands for target `c:/Users/user/workspace/Main//obj/local/armeabi/objs/converte
r'
c:/android-ndk-r8d/build/core/build-binary.mk:357: warning: overriding comm
ands for target `c:/Users/user/workspace/Main//obj/local/armeabi'
c:/android-ndk-r8d/build/core/build-binary.mk:357: warning: ignoring old co
mmands for target `c:/Users/user/workspace/Main//obj/local/armeabi'
c:/android-ndk-r8d/build/core/build-binary.mk:439: warning: overriding comm
ands for target `c:/Users/user/workspace/Main//libs/armeabi'
c:/android-ndk-r8d/build/core/build-binary.mk:439: warning: ignoring old co
mmands for target `c:/Users/user/workspace/Main//libs/armeabi'
c:/android-ndk-r8d/build/core/build-binary.mk:357: warning: overriding comm
ands for target `c:/Users/user/workspace/Main//obj/local/armeabi'
c:/android-ndk-r8d/build/core/build-binary.mk:357: warning: ignoring old co
mmands for target `c:/Users/user/workspace/Main//obj/local/armeabi'
"Compile thumb : converter <= cmdutils.c
c:/Users/user/workspace/Main//jni/cmdutils.c:32:34: fatal error: libavformat/avf
ormat.h: No such file or directory
compilation terminated.
make: *** [c:/Users/user/workspace/Main//obj/local/armeabi/objs/converter/cmduti
ls.o] Error 1

我能做些什么来解决这个问题并让它发挥作用?

4

1 回答 1

0

根据错误,您缺少 libavformat 标头。

我找到了这个:

Android 上的 FFMpeg,未定义对 libavcodec 函数的引用,尽管它在命令行中列出

于 2013-02-24T09:42:54.100 回答