ChitraPathak / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

FFMpeg cannot be used on Android #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to use FFMpegFrameGrabber
2. FrameGrabber f = new FFmpegFrameGrabber("/mnt/sdcard/test.avi");

What is the expected output? What do you see instead?
Expected to work. Instead it crashes :

01-22 19:04:24.235: E/AndroidRuntime(21463): FATAL EXCEPTION: GLThread 3280
01-22 19:04:24.235: E/AndroidRuntime(21463): 
java.lang.ExceptionInInitializerError
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.googlecode.javacv.FFmpegFrameGrabber.<init>(FFmpegFrameGrabber.java:73)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.nea.nehe.lesson06.Cube.loadGLTexture(Cube.java:197)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.nea.nehe.lesson06.Lesson06.onSurfaceCreated(Lesson06.java:66)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1446)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
01-22 19:04:24.235: E/AndroidRuntime(21463): Caused by: 
java.lang.ExceptionInInitializerError
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
java.lang.Class.classForName(Native Method)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
java.lang.Class.forName(Class.java:217)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
java.lang.Class.forName(Class.java:172)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.googlecode.javacpp.Loader.load(Loader.java:305)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.googlecode.javacv.cpp.avcodec.<clinit>(avcodec.java:87)
01-22 19:04:24.235: E/AndroidRuntime(21463):    ... 5 more
01-22 19:04:24.235: E/AndroidRuntime(21463): Caused by: 
java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1285]:   121 
cannot locate '__cxa_begin_catch'...
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
java.lang.Runtime.loadLibrary(Runtime.java:370)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
java.lang.System.loadLibrary(System.java:535)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.googlecode.javacpp.Loader.load(Loader.java:358)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.googlecode.javacpp.Loader.load(Loader.java:285)
01-22 19:04:24.235: E/AndroidRuntime(21463):    at 
com.googlecode.javacv.cpp.avutil.<clinit>(avutil.java:76)
01-22 19:04:24.235: E/AndroidRuntime(21463):    ... 10 more

What version of the product are you using? On what operating system?
Latest libs from google code, set in armeabi and armeabi-v7. Testing on a 
Galaxy S (I9000) with Android 4.0.3.

Please provide any additional information below.

OpenCvFrameGrabber works fine

Original issue reported on code.google.com by guilo.gu...@gmail.com on 22 Jan 2012 at 6:17

GoogleCodeExporter commented 9 years ago
Strange.. Anyway, this FFmpeg build is getting old, so I made a new build for 
FFmpeg 0.7.11 with the newest Android NDK r7. I have not tested it, but nothing 
seems to have changed much. Please be so kind and be my guinea pig :) 

http://javacv.googlecode.com/files/ffmpeg-0.7.11-android-arm.zip
http://javacv.googlecode.com/files/javacv-bin-20120108.zip

Thank you!

Original comment by samuel.a...@gmail.com on 23 Jan 2012 at 11:19

GoogleCodeExporter commented 9 years ago
Thank you for your fast review ! But unfortunately it still doesn't work. 

I am using a custom and unofficial rom of Android 4 for Galaxy S. As it could 
be an issue, I will give it a try with a regular device tomorrow and report 
here.

Original comment by guilo.gu...@gmail.com on 23 Jan 2012 at 11:05

GoogleCodeExporter commented 9 years ago
I have tested on Nexus S 4.0.3 and Nexus One 2.3.6 and the result is 
unfortunately the same.

Original comment by guilo.gu...@gmail.com on 26 Jan 2012 at 5:54

GoogleCodeExporter commented 9 years ago
Arg, looks like they renamed libstdc++.a to libgnustl_static.a starting from 
r7, while also inserting a new dummy libstdc++.so just to thoroughly confuse 
everyone. What a PITA... I am attaching a new set of libjni* libraries for 
FFmpeg, those should work.

Original comment by samuel.a...@gmail.com on 28 Jan 2012 at 4:46

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks a lot. It now works perfectly.

Original comment by guilo.gu...@gmail.com on 31 Jan 2012 at 8:37

GoogleCodeExporter commented 9 years ago
How to replace the older library.

When I add it to librar, it shows "The library 'javacv-ffmpeg-android-arm.jar' 
contains native libraries that will not run on the device".

Original comment by booker0108@gmail.com on 9 Feb 2012 at 6:59

GoogleCodeExporter commented 9 years ago
Simply follow the instructions in the README.txt file. The Android team wants 
us to do things the hard way. An easy to use IDE is too much to ask of them 
apparently.. :(

Original comment by samuel.a...@gmail.com on 10 Feb 2012 at 5:10

GoogleCodeExporter commented 9 years ago
Latest release contains newly compiled, working binaries, AFAIK. Let me know if 
you still have any problem

Original comment by samuel.a...@gmail.com on 18 Feb 2012 at 2:16

GoogleCodeExporter commented 9 years ago
Hello,
i have a similar issue. I try to use 
IplImage.create(width / f, height / f, IPL_DEPTH_8U, 1);
it crashes with:
05-23 17:55:13.623: E/AndroidRuntime(2998): FATAL EXCEPTION: main
05-23 17:55:13.623: E/AndroidRuntime(2998): 
java.lang.ExceptionInInitializerError
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.berner_mattner.fasapps.callback.AppSurfaceHolderCallback.processImage(AppSur
faceHolderCallback.java:229)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.berner_mattner.fasapps.callback.AppSurfaceHolderCallback.onPreviewFrame(AppS
urfaceHolderCallback.java:206)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
android.hardware.Camera$EventHandler.handleMessage(Camera.java:753)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
android.os.Looper.loop(Looper.java:137)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
android.app.ActivityThread.main(ActivityThread.java:4507)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.reflect.Method.invokeNative(Native Method)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.reflect.Method.invoke(Method.java:511)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
dalvik.system.NativeStart.main(Native Method)
05-23 17:55:13.623: E/AndroidRuntime(2998): Caused by: 
java.lang.ExceptionInInitializerError
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.Class.classForName(Native Method)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.Class.forName(Class.java:217)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacpp.Loader.load(Loader.java:335)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
05-23 17:55:13.623: E/AndroidRuntime(2998):     ... 11 more
05-23 17:55:13.623: E/AndroidRuntime(2998): Caused by: 
java.lang.ExceptionInInitializerError
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.Class.classForName(Native Method)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.Class.forName(Class.java:217)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacpp.Loader.load(Loader.java:335)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
05-23 17:55:13.623: E/AndroidRuntime(2998):     ... 15 more
05-23 17:55:13.623: E/AndroidRuntime(2998): Caused by: 
java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1286]:  1834 
cannot locate '_ZSt20__throw_length_errorPKc'...
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.Runtime.loadLibrary(Runtime.java:370)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
java.lang.System.loadLibrary(System.java:535)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:409)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacpp.Loader.load(Loader.java:342)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacpp.Loader.load(Loader.java:316)
05-23 17:55:13.623: E/AndroidRuntime(2998):     at 
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:129)
05-23 17:55:13.623: E/AndroidRuntime(2998):     ... 19 more

Original comment by M.Sc.Chr...@googlemail.com on 23 May 2012 at 3:59

GoogleCodeExporter commented 9 years ago
With which version of JavaCV, FFmpeg and Android is that?

Original comment by samuel.a...@gmail.com on 24 May 2012 at 1:01