Question

I am using JMF to operate my web cam.My usb webcam works perfectly with JMF, I used it in JMStudio however,when I make this call from my java code

deviceListVector = CaptureDeviceManager.getDeviceList( null );

my "audio capture device" is detected however, my usb webcam at vfw://0 is not detected. To clarify, the audio capture device and the USB cam are entirely separate devices. How can I properly detect the usb webcam, and its formats, from JMF?

Thanks In advance

Was it helpful?

Solution

Also you can try LTI-Civil or Xuggler.

OTHER TIPS

To detect only webcams you should pass argument to getDeviceList(Format) method (instead of null):

Vector<Object> devices = CaptureDeviceManager.getDeviceList(new Format("RGB"));
Iterator<Object> di = devices.iterator();
while (di.hasNext()) {
    CaptureDeviceInfo info = (CaptureDeviceInfo) di.next();
    System.out.println(info);
}

This should print all your webcams - build in and those connected to USB. I've tested this code and it works for me.

If this won't help (since JMF is veeeery old and some parts of the code can be outdated), you can try using part of my Webcam Capture project. It is working correctly with most platforms - Windows x86 and x64, Linux x86 and x64, Mac OS, etc. If you decide to try it, you will have to write something like this to list all your webcam devices:

List<Webcam> webcams = Webcam.getDevices();

Please note that it can also work on top of JMF - to replace default build-in driver to JMF one, you will have to add JMF driver JAR into the classpath and call this before listing webcams:

Webcam.setDriver(new JmfDriver());

Hope this help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top