Java 在Windows上的Xuggler库中获取网络摄像头名称
当我在带有多个Windows网络摄像机的计算机上使用Xuggler库时,我需要使用此网络摄像机的“名称”来选择设备。我的意思是命令“vfwcap 0”只选择第一个网络摄像机,并且不允许命令“vfwcap 1”或“vfwcap 2”访问其他网络摄像机。如果我使用:Java 在Windows上的Xuggler库中获取网络摄像头名称,java,video,webcam,xuggler,Java,Video,Webcam,Xuggler,当我在带有多个Windows网络摄像机的计算机上使用Xuggler库时,我需要使用此网络摄像机的“名称”来选择设备。我的意思是命令“vfwcap 0”只选择第一个网络摄像机,并且不允许命令“vfwcap 1”或“vfwcap 2”访问其他网络摄像机。如果我使用: $ ffmpeg -list_devices true -f dshow -i dummy 我可以看到这个网络摄像机的“名字”列表。例如:“罗技高清摄像头C270”、“罗技摄像头C210”。如果在Xuggler库中使用此名称,则会出现
$ ffmpeg -list_devices true -f dshow -i dummy
我可以看到这个网络摄像机的“名字”列表。例如:“罗技高清摄像头C270”、“罗技摄像头C210”。如果在Xuggler库中使用此名称,则会出现错误
因此,我只能使用Xuggler访问Windows机器上的第一台网络摄像头
我可以从Xuggler获取Windows中所有设备的列表,并且可以在Xuggler中使用这些名称吗(我只想同时使用多个网络摄像头)
可能存在其他方法?使用这个简单的java程序,您可以获得系统上所有可用网络摄像头的列表
import com.github.sarxos.webcam.Webcam;
public class CameraTest {
public static void main(String[] args) {
List<Webcam> list = Webcam.getWebcams();
for (int i = 0; i < list.size(); i++) {
try {
Webcam cam = list.get(i);
System.out.println("Found this Camera : "+cam.getName());
BufferedImage image = cam.getImage();
} catch (Exception e) {
System.out.println("Exception in cam : " + i);
}
}
}
}
您将拥有所有摄像头的列表,因此您可以随意使用其中任何一台。穆罕默德,非常感谢!这不是Xuggler的原生方式,但它对我来说是非常有用的库!
Found this Camera : TV CARD WDM VIDEO CAPTURE 0
Found this Camera : ManyCam Video Source 1
Found this Camera : DroidCam 2