Ask Your Question

opencv3 videoCapture doesn't work

asked 2015-08-31 14:42:35 -0500

jma gravatar image

I've a problem with openCV 3 java wrapper.

When i use videocapture, camera.grab() always return false. I see several subjects on internet about this problem. I succeeded to run opencv 2.4 but not with version 3.

My environnement :

  • windows 10 (64b)
  • java 8u51 (32b)
  • eclipse mars (32b)

So, I test these methods. Env :

  • Set windows path : D:\Programs\opencv3x\build\x86\vc12\bin
  • Add opencv_ffmpeg to D:\Programs\opencv3x\build\x86\vc12\bin (in opencv 3, this lib is already in with the good name : opencv_ffmpeg300.dll).

Dev env : In eclipse project :

  • add opencv-300.jar
  • set the native lib to D:/Programs/opencv3x/build/java/x86
  • With this configuration, I can use opencv 3 without problem...but i can't decode video file!

Does anyone have a solution on this? Thx.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2017-01-13 11:07:46 -0500

Your second method will work if you remember that you use Java.

• Add opencv_ffmpeg to .../opencv3x/build/java/x86 - the path that you set for native lib in Eclipse.

edit flag offensive delete link more

answered 2015-09-20 10:22:49 -0500

RolandC gravatar image

updated 2015-09-20 10:25:00 -0500

You need to load the ffmpeg dll as well. You could create a folder structure


and add the jar to your build path.

Then in your application load the libraries e. g. like this:

// set the library path during runtime (or specify it at program start via -Djava.library.path=...)
try {

    System.setProperty("java.library.path", "lib/x64");

    Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
    fieldSysPath.set(null, null);

} catch (Exception ex) {
    throw new RuntimeException(ex);

// load the required libraries

The video is now playable with

VideoCapture videoCapture = new VideoCapture();"c:/movies/mymovie.mp4");
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-08-31 14:41:21 -0500

Seen: 2,854 times

Last updated: Jan 13 '17