6

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

Prakash Panjwani
  • 2,540
  • 5
  • 23
  • 34

2 Answers2

1

Also you can try LTI-Civil or Xuggler.

Art Clarke
  • 2,495
  • 18
  • 15
0

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.

Bartosz Firyn
  • 2,664
  • 2
  • 21
  • 18
  • ..hello i download your file but could not run it? why? could you help me? – Java D May 03 '13 at 11:57
  • @kapil In case of problems with the Webcam Capture project, please create new issue ticket on the project page https://github.com/sarxos/webcam-capture/issues – Bartosz Firyn May 07 '13 at 14:03
  • @Bartosz..but i have simple problem that i already imported your projcet in netbeans BUT it cant run it means when i m trying to run there is disable the run option.. why? – Java D May 08 '13 at 11:57
  • @kapil, it's hard to say what is wrong with the project without looking into it. Please create new issue on the project page and we will work out what the problem is. – Bartosz Firyn May 16 '13 at 14:11
  • @Bartosz..so can you tell me is it possible to do video conferencing from your code? – Java D May 17 '13 at 04:14
  • @kapil, all the library functionalities with bunch of examples are explained on the project page. You can do video conference using webcam-capture + xuggler. If you have any other questions, please ask them in the project page – Bartosz Firyn May 17 '13 at 11:03
  • @Bartosz..then any ready code available? and where is the project page? – Java D May 17 '13 at 12:03