jloyd / javacv

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

Current javacv crashes with example provided in javacv homepage #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install all prerequired software as instructed in the website
2. Create a java project and add the Demo.java example provided in the javacv 
homepage
3. Add all the javacv jar libraries (Netbeans)
4. Run/Debug the project -> it crashes at Loader.load(opencv_objdetect.class);

What is the expected output? What do you see instead?
Not to crash. I have everything installed, I have tried older versions in the 
past that run on this machine (when it used name.audet.samuel.javacv.jna... 
instead of com.googlecode.javacv.cpp...
(by the way, notice the missing semi-colon at line "import 
com.googlecode.javacv.cpp.*" if you would like to correct it

What version of the product are you using? On what operating system?
Latest version, downloaded today. Windows 7. However, it seems to run fine on a 
Mac, but that the video recorded seems to be wrongly encoded and looks very odd 
(but I guess this is a separate issue I can open in another thread).

Please provide any additional information below.
It compiles fine, but it crashes at:
Loader.load(opencv_objdetect.class);

Information:
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
C:\Users\myuser\AppData\Local\Temp\jniopencv_core1024071573664674187.dll: Can't 
find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
        at java.lang.Runtime.load0(Runtime.java:770)
        at java.lang.System.load(System.java:1003)
        at com.googlecode.javacpp.Loader.load(Loader.java:308)
        at com.googlecode.javacpp.Loader.load(Loader.java:258)
        at com.googlecode.javacv.cpp.opencv_core$CvPoint.<clinit>(opencv_core.java:1733)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacpp.Loader.load(Loader.java:258)
        at com.googlecode.javacv.cpp.opencv_core$CvSize.<clinit>(opencv_core.java:2047)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacpp.Loader.load(Loader.java:258)
        at com.googlecode.javacv.cpp.opencv_core$CvScalar.<clinit>(opencv_core.java:2151)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacpp.Loader.load(Loader.java:258)
        at com.googlecode.javacv.cpp.opencv_core$CvErrorCallback.<clinit>(opencv_core.java:3962)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacpp.Loader.load(Loader.java:258)
        at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:120)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:87)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:88)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:85)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at com.googlecode.javacpp.Loader.load(Loader.java:280)
        at javacvvidrec.Demo.main(Demo.java:23)
Java Result: 1
BUILD SUCCESSFUL (total time: 31 seconds)

Original issue reported on code.google.com by steve.ro...@gmail.com on 23 Feb 2011 at 6:33

GoogleCodeExporter commented 9 years ago
Same problem using Vista 64 bits with 64 bits Java RE/SDK and Eclipse Helios 64 
bits.

OpenCV binaries are not provided with 64 bits version. So I guess we have to 
compile them for our environment.

Original comment by patem...@gmail.com on 23 Feb 2011 at 9:50

GoogleCodeExporter commented 9 years ago
As patem mentions, can you confirm that you are running a 64-bit version of 
Java _and_ a 64-bit version of OpenCV, *OR* a 32-bit version of Java _and_ a 
32-bit version of OpenCV? i.e.: You are not trying to mix modules of different 
bitness?

Original comment by samuel.a...@gmail.com on 24 Feb 2011 at 4:53

GoogleCodeExporter commented 9 years ago
Hm interesting, I'm actually using Java 32 bits, and if OpenCV comes only in 32 
bits, then everything is in 32 bits, but my actual Windows 7 machine is 64 
bits..

Original comment by steve.ro...@gmail.com on 25 Feb 2011 at 4:13

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Update: I reinstalled OpenCV binaries (2.2, I was using 2.1 previously), and 
that solved that part of the problem! maybe the 2.1 binaries did include 64 
bits? older javacv with older opencv were working fine on this machine! no 
idea, but that did the job.

So, now everything is on Windows 7 64 bits, but my java and opencv are 32 bits. 
However it crashes runtime after defining the OpenCVFrameRecorder, when I call 
recorder.start():
debug:
[ 0.99062455, 0.11969413, -36.876583
  -0.11489207, 0.9907334, 40.564842
  1.3198417E-4, -1.1462915E-4, 0.9951967 ]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00905a50, pid=26412, 
tid=28984
#
# JRE version: 6.0_20-b02
# Java VM: Java HotSpot(TM) Client VM (16.3-b01 mixed mode windows-x86 )
# Problematic frame:
# C  0x00905a50
#
# An error report file with more information is saved as:
# C:\Users\myuser\Documents\javacvproj\hs_err_pid26412.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Also, if I use FFmpegFrameRecorder instead, I get:
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
com.googlecode.javacv.cpp.avcodec$AVPacket.allocate()V
        at com.googlecode.javacv.cpp.avcodec$AVPacket.allocate(Native Method)
        at com.googlecode.javacv.cpp.avcodec$AVPacket.<init>(avcodec.java:747)
        at com.googlecode.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:101)
        at javacvvidrec.Demo.main(Demo.java:76)

So it seems I can't use neither OpenCVFrameRecorder nor FFmpegFrameRecorder for 
some reason..

Original comment by steve.ro...@gmail.com on 25 Feb 2011 at 6:51

GoogleCodeExporter commented 9 years ago
Ah, it seems the precompiled highgui of OpenCV 2.2 does not work with the 
"CV_FOURCC_DEFAULT", but it works with "-1", so I guess I will change the 
default in the next release of JavaCV.. for now, you can work around that by 
putting this line before "recorder.start()":
        recorder.setCodecID(-1); 

To use FFmpeg, you first need to install FFmpeg, as explained in the README.txt 
file.

Original comment by samuel.a...@gmail.com on 26 Feb 2011 at 3:19

GoogleCodeExporter commented 9 years ago
great, thanks. I'll try it out today and see how it goes.
As of FFmpeg, what I can say is I used the binaries from 
http://ffmpeg.arrozcru.org/autobuilds/
I tried different versions (32 bits, 64 bits, shared and static), and it seemed 
to have installed fine, since I could run ffmpeg command from the command line, 
but I would still be unable to run FFmpegFrameRecorder. 
However, if this might be a solution, I can try to compile ffmpeg myself 
(cygwin, MinGW, MSYS, etc) on 32 bits I imagine, making sure I also have LAME 
installed, and see if that solves the issue..

Original comment by steve.ro...@gmail.com on 26 Feb 2011 at 11:50

GoogleCodeExporter commented 9 years ago
Update 1:
I tried setCodecID(-1). I also tried CV_FOURCC_PROMPT, but still no success. 
However, the problem is different now: it doesn't crash as earlier, but it just 
seems to be stuck in an infinite loop somewhere: the programme does not 
terminate, does not crash, does not indicate any error at any moment, but after 
running the line recorder.start() it just stays there. Exploring it further, it 
seems to stop more specifically at:
writer = cvCreateVideoWriter(filename, codecID, frameRate, cvSize(imageWidth, 
imageHeight), pixelFormat);
Have you tried that line with opencv version 2.2, using codecID=-1 or so?

As a side note question: what is the fps that I can get with javacv for mac, 
windows and linux? what order of magnitud slower than opencv?

Original comment by steve.ro...@gmail.com on 26 Feb 2011 at 12:51

GoogleCodeExporter commented 9 years ago
The problem with FFmpegFrameRecorder might have to do with some issues I'm 
having with JavaCPP not being able to automatically load libraries sometimes. 
Calling
    Loader.load(avformat.class);
before trying to use the FFmpeg classes may help.

As for cvCreateVideoWriter(), yes setCodecID(-1) works just fine here with 
either 32-bit or 64-bit Windows. If it does not work for you, I suggest you ask 
the OpenCV guys to fix it.

Whatever FPS OpenCV and FFmpeg support for the given format.

Original comment by samuel.a...@gmail.com on 26 Feb 2011 at 1:20

GoogleCodeExporter commented 9 years ago
Hi the same error here. My code:

    File f = new File("d:\\videok.avi");
    OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(f);
    try {

        grabber.start();
        cf.showImage(grabber.grab());
        grabber.stop();
    } catch (Exception e) {
    }

grabber.start() throw:
un:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00905a4f, pid=3808, tid=4960
#
# JRE version: 6.0_19-b04
# Java VM: Java HotSpot(TM) Client VM (16.2-b04 mixed mode, sharing windows-x86 
)
# Problematic frame:
# C  0x00905a4f
#
# An error report file with more information is saved as:
# D:\hs_err_pid3808.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

After this i tried: FFMpegFrameGrabber :
i got this when try to  "new FFMpegFrameGrabber(f)"

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
com.googlecode.javacv.cpp.avcodec$AVPacket.allocate()V
        at com.googlecode.javacv.cpp.avcodec$AVPacket.allocate(Native Method)
        at com.googlecode.javacv.cpp.avcodec$AVPacket.<init>(avcodec.java:747)

windows 7 64bit, java 32 bit.

now a i try the same in windos xp mode... maybeee

Original comment by kozsinsz...@gmail.com on 18 Mar 2011 at 3:57

GoogleCodeExporter commented 9 years ago
Some people are having problems using OpenCV to capture Windows 7:
http://groups.google.com/group/javacv/browse_thread/thread/418cec93c72143a7/fc17
e84fedaa77f2#38847e69646e50f2
Either downgrade to Windows XP, ask the OpenCV guys to fix this, or use 
something else to capture images

Original comment by samuel.a...@gmail.com on 19 Mar 2011 at 12:00

GoogleCodeExporter commented 9 years ago
Latest version of JavaCV now uses `CV_FOURCC_PROMPT` under Windows, which fixes 
the crash

Original comment by samuel.a...@gmail.com on 7 Apr 2011 at 7:53

GoogleCodeExporter commented 9 years ago
The same issue still prevails in android

Original comment by hollyace...@gmail.com on 22 Apr 2011 at 8:54

GoogleCodeExporter commented 9 years ago
Well, if you could provide more details I may be able to actually do something 
about it, because this works fine on Android for me:
http://code.google.com/p/javacv/downloads/detail?name=facepreview-20110407.apk
So there is nothing wrong that I can see.

Original comment by samuel.a...@gmail.com on 23 Apr 2011 at 1:56

GoogleCodeExporter commented 9 years ago
well, i don't know if my issue is similar to any above. I keep getting the 
error "cvCreateVideoWriter(): Could not create a writer", i have only attempted 
this in android and none of the ideas on the internet have helped.
Further more, when i attempt to use FFmpegFrameRecorder  to record my output it 
simply crashes on initialization.
What could i be doing wrong?

Original comment by pbb...@gmail.com on 19 Jun 2011 at 2:49

GoogleCodeExporter commented 9 years ago
If you read the README.txt file, you will understand that I compiled OpenCV 
without support for FFmpeg, so there is no reason for OpenCVFrameRecorder to 
work. 

To use FFmpegFrameRecorder, you need the libraries of FFmpeg. Please read the 
README.txt file. thank you

Original comment by samuel.a...@gmail.com on 20 Jun 2011 at 5:59

GoogleCodeExporter commented 9 years ago
Thanks for the quick response, when you said "To use FFmpegFrameRecorder, you 
need the libraries of FFmpeg" did you mean the precompiled libs for ffmpeg arm 
which were to be placed inside the /libs/armeabi/ folder?

Original comment by pbb...@gmail.com on 20 Jun 2011 at 7:37

GoogleCodeExporter commented 9 years ago
Yes... Can you please post your questions on the mailing list? Your questions 
are totally unrelated to this issue, and besides this is not an issue to start 
with

Original comment by samuel.a...@gmail.com on 20 Jun 2011 at 7:52

GoogleCodeExporter commented 9 years ago
Ok thanks, i'll do that, but i just have to mention that i followed 
instructions on the quick start for opencv to the letter and the demo simply 
did not work on android 2.2.

Original comment by pbb...@gmail.com on 20 Jun 2011 at 12:08

GoogleCodeExporter commented 9 years ago
java.lang.UnsatisfiedLinkError: 
C:\Users\Administrator\AppData\Local\Temp\jniopencv_core7083035615485269052.dll:
 Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1003)
    at com.googlecode.javacpp.Loader.load(Loader.java:332)
    at com.googlecode.javacpp.Loader.load(Loader.java:266)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:118)
    at Main.<clinit>(Main.java:25)
Exception in thread "main" 
'
New to javaCV.
 I am Chinese, my Englist is bad.  The eclipse of how to solve this problem?

Original comment by saileizh...@gmail.com on 24 Aug 2011 at 11:54

GoogleCodeExporter commented 9 years ago
FYI: 
Common issues with OpenCV under Windows 7 
http://code.google.com/p/javacv/wiki/Windows7AndOpenCV

Original comment by samuel.a...@gmail.com on 27 Aug 2011 at 7:55

GoogleCodeExporter commented 9 years ago
i also get the "unsatisfiedLinkError blablabla can't find dependent libraries" 
problem, but i've tried every single approach that i could find...they do not 
work at all, what should i do.

Original comment by haoking...@gmail.com on 30 Oct 2012 at 6:49

GoogleCodeExporter commented 9 years ago
Hi,

      When I have run my eclipse java application i got Error like :Exception in thread "Thread-7" java.lang.NoClassDefFoundError: Could not initialize class com.googlecode.javacv.cpp.avcodec$AVPacket
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1908)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1793)
    at java.lang.Runtime.load0(Runtime.java:806)
    at java.lang.System.load(System.java:1076)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
    at com.googlecode.javacpp.Loader.load(Loader.java:586)
    at com.googlecode.javacpp.Loader.load(Loader.java:540)
    at com.googlecode.javacv.cpp.avformat.<clinit>(avformat.java:40)
    at com.googlecode.javacv.FFmpegFrameRecorder.<clinit>(FFmpegFrameRecorder.java:106)

I have download opencv OpenCV 2.4.8 ,Javacv-bin-0.7 , FFmpeg Share Latest 
version windows 64 bit ,also i have configure Environment System Variable class 
path Configure Javacv jar ,javacpp jar ,javacv_windows.jar, and Path set FFmpeg 
bin folder , and opencv all bin , lib and static folder set .Any mistake let me 
.Thanks

Original comment by sameerso...@gmail.com on 28 Jan 2014 at 7:40

GoogleCodeExporter commented 9 years ago
@sameer Please try the FFmpeg binaries provided here:
http://javacv.googlecode.com/files/javacv-0.7-cppjars.zip
instead of "FFmpeg Share Latest version windows 64 bit".

And please ask your questions on the mailing list if possible, not here, thank 
you.

Original comment by samuel.a...@gmail.com on 28 Jan 2014 at 7:47

GoogleCodeExporter commented 9 years ago
Ok Next Time I will ask my mail listing ,Thanks For reply to me ,I have 
download Zip file , here ffmpeg-2.1.1-windows-x86_64 and 
ffmpeg-2.1.1-windows-x86 , can i have configure Environmental System Path ? 
please let me know clear idea.

Thanks Samuel

Original comment by sameerso...@gmail.com on 28 Jan 2014 at 8:05

GoogleCodeExporter commented 9 years ago
@sameer Please follow the instructions in the README.txt file. If you do not 
understand the instructions in the README.txt file, please ask your questions 
on the mailing list, not here, thank you.

Original comment by samuel.a...@gmail.com on 28 Jan 2014 at 8:15