Capture web camera on Windows today (assumingly with FFmpegFrameGrabber)

277 views
Skip to first unread message

Alex Fowler

unread,
Apr 3, 2016, 1:14:11 PM4/3/16
to javacv
I have worked with JavaCV before and was successfully able to capture my web camera input. However, now it does not work. I don't have the old code and can't write a new one that works. I have tried all the ways that I have found on the internet:

  • OpenCVFrameGrabber -- fails with the error that it can't create a device
  • FrameGrabber.createDefault(0) -- fails trying to utilize flyCapture and not finding the native libraries on path, though the cpp presets are there.
  • FFmpegFrameGrabber -- simply does not take in numbers for device indices, and creating it with a string that refers to the device, afaik works only on Linux since you can't access "device path" on Windows.
So, my question today is: how do I make the simple web camera video capture?

Samuel Audet

unread,
Apr 9, 2016, 3:45:47 AM4/9/16
to jav...@googlegroups.com
Have you tried VideoInputFrameGrabber? It's usually the one thing that always works consistently on Windows. That's why I leave it there.

Samuel

Alex Fowler

unread,
Apr 9, 2016, 5:55:32 PM4/9/16
to javacv

Just tried it and no, it does not work, creating the capture with new VideoInputFrameGrabber(0). The stack trace is below. I have checked my webcam on http://webcammictest.com/ and it works ok (though the website or the flash plugin itself are laggy, but I got the picture from the cam). My currently being tested camera is Genius iLook 300 if that matters, but I think it does not. I also installed the official drivers... still would appreciate help. I am sure it all worked very well before, idk what changed, but looks like things are changing in JavaCV and what worked like a year or two ago might not work now, idk why, I doubt that the video cam capturing technology changed that much :/

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
org.bytedeco.javacv.FrameGrabber$Exception: videoInput.setupDevice() Error: Could not setup device.
at org.bytedeco.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:111)
at org.bytedeco.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:101)
at nest.java.JavaCVCam.start(JavaCVCam.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:313)
at pixes.apps.cameracapturetest.core$create_camera_quad.invoke(core.clj:33)
at pixes.apps.cameracapturetest.core$init_camera_capture.invoke(core.clj:39)
at pixes.apps.cameracapturetest.core$init.invoke(core.clj:42)
at clojure.lang.Var.invoke(Var.java:375)
at pixes.editor.states.main$init_apps.invoke(main.clj:234)
at pixes.editor.states.main$init.doInvoke(main.clj:272)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.Var.invoke(Var.java:375)
at nest.system.wrappers.extensions.engine.jme3.app$mk_init_fn$fn__2505.invoke(app.clj:110)
at nest.system.wrappers.extensions.engine.jme3.app$application$fn__2544.invoke(app.clj:215)
at nest.system.wrappers.extensions.engine.jme3.app.proxy$com.jme3.app.SimpleApplication$ff19274a.simpleInitApp(Unknown Source)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at nest.system.wrappers.extensions.engine.jme3.app.proxy$com.jme3.app.SimpleApplication$ff19274a.initialize(Unknown Source)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:745)

Samuel Audet

unread,
Apr 9, 2016, 6:58:03 PM4/9/16
to jav...@googlegroups.com
On 04/10/2016 06:55 AM, Alex Fowler wrote:
> Just tried it and no, it does not work, creating the capture with new
> VideoInputFrameGrabber(0). The stack trace is below. I have checked my
> webcam on http://webcammictest.com/ and it works ok (though the website
> or the flash plugin itself are laggy, but I got the picture from the
> cam). My currently being tested camera is Genius iLook 300 if that
> matters, but I think it does not. I also installed the official
> drivers... still would appreciate help. I am sure it all worked very
> well before, idk what changed, but looks like things are changing in
> JavaCV and what worked like a year or two ago might not work now, idk
> why, I doubt that the video cam capturing technology changed that much :/

If you're having issues on Windows 10, the new VideoCapture API of
OpenCV seems to work better:
https://github.com/bytedeco/javacv/issues/357

OpenCVFrameGrabber has already been updated accordingly, so you might
want to try that...

Samuel

merle...@gmail.com

unread,
Apr 10, 2016, 5:05:24 PM4/10/16
to javacv
I prefer the VideoCapture class. Minor platform-specific quirks aside, this class seems to work more consistently than the alternatives (it's also the only way I could control capture parameters such as brightness and contrast, which may or may not be important to you).

Reply all
Reply to author
Forward
0 new messages