2

I tried to use opencv java interface to capture the video, I find isOpened is always false.

I have tried different video format and different version (2.4.11 and 3.0.0), both met the same issues.

I have configure "-Djava.library.path=D:\Project\opencv\opencv3.0\build\x64\vc12\bin", and have copied opencv_java300.dll to this folder.

And I checked tips OpenCV 3.0 VideoCapture doesn't open video file in Java and OpenCV 2.4 VideoCapture not working on Windows, neither works for me.

Anyone knows what's the trick part to capture the video?

The sample code I have is:

    VideoCapture capture=new VideoCapture();
    capture.open("D:\\StopMoti2001.mpeg");
    if(!capture.isOpened()){
        return;
    }
Community
  • 1
  • 1
Vincent
  • 340
  • 2
  • 11
  • have you tried passing the file to VideoCaputre's constructor? `VideoCapture capture=new VideoCapture("D:\\StopMoti2001.mpeg");` I did it with an input from webcam and was like this: `VideoCapture camera = new VideoCapture(0);` where 0 indicates the 1st camera. Maybe is similar for an input from file. – Pierfrancesco Soffritti Aug 22 '15 at 12:28
  • Yes, there is no difference, I also tried mp4, avi, all get the same issues. There is no log been printed, but capture does not opened. – Vincent Aug 22 '15 at 12:38
  • can you try to open an jpeg file with videocapture? if that works there might be a codec problem? – Micka Aug 23 '15 at 11:23
  • can you upload a small video file you tried? – Micka Aug 23 '15 at 11:24
  • can you try to copy the opencv_ffmpeg dll file to your folder? it doesn't give an error if missing but is needed to access codec – Micka Aug 23 '15 at 11:25
  • I put the dll in windows/system32 folder, I can parse the video now, thanks. – Vincent Aug 24 '15 at 04:23
  • Can you elaborate how you solved this issue Vincent. – Vivekanand Jan 21 '16 at 21:19

1 Answers1

3

I have had the same issue but thanks tou your comments I have figured it out. For anyone intrested in the solution: copy opencv_ffmpeg310_64.dll from opencv/build/java/x64 folder to your project main folder (containing folders: src, .settings, bin).

P.Mac
  • 235
  • 5
  • 13