java 无法通过 JMF 检测捕获设备(网络摄像头)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2570944/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 21:50:36  来源:igfitidea点击:

Unable to detect Capture Device (webcam) through JMF

javawebcamjmf

提问by Padmaja

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

我正在使用 JMF 来操作我的网络摄像头。我的 USB 网络摄像头与 JMF 完美配合,但是我在 JMStudio 中使用了它,当我从我的 java 代码进行此调用时

deviceListVector = CaptureDeviceManager.getDeviceList( null );

my USB "webcam" is detected however when i am trying to detect webcam on my laptop it is not detecting any device.

检测到我的 USB“网络摄像头”,但是当我尝试在我的笔记本电脑上检测网络摄像头时,它没有检测到任何设备。

How can I properly detect the webcam of laptop, and its formats, from JMF API?

如何从 JMF API 正确检测笔记本电脑的网络摄像头及其格式?

回答by mikek3332002

  1. Make sure that the system you're using it on contains all the required files eg On Windows it requires certain dlls. The easiest way to do this is to use the setup program.
  2. Once JMF is properly installed run JMFRegistry?, detect the camera, then register and/or save the results. (In vista you'll need to run it as Administrator for it work)
  3. The code should now be returning the list of devices. Assuming the code has jmf.jar added to its project files.
  1. 确保您使用它的系统包含所有必需的文件,例如在 Windows 上它需要某些 dll。最简单的方法是使用安装程序。
  2. 正确安装 JMF 后,运行 JMFRegistry?,检测相机,然后注册和/或保存结果。(在 vista 中,您需要以管理员身份运行它才能正常工作)
  3. 代码现在应该返回设备列表。假设代码已将 jmf.jar 添加到其项目文件中。

You might be interested in alternatives: http://en.wikipedia.org/wiki/Java_Media_Framework#AlternativesThe FMJ projectis one that is designed to be API compatible(not everything is implemented yet) and does dynamic device detection.

您可能会感兴趣的备选方案: http://en.wikipedia.org/wiki/Java_Media_Framework#AlternativesFMJ项目是一个被设计为兼容的API(不是一切都还没有实现),并进行动态设备检测。

回答by Oso

Be sure to include jmf.jar & sound.jar in your project classpath. Although I had it in my CLASSPATH, it didn't work until I included those files in my project libraries.

确保在项目类路径中包含 jmf.jar 和 sound.jar。尽管我的 CLASSPATH 中有它,但直到我将这些文件包含在我的项目库中后,它才起作用。