这些视频设备中,我怎样才能知道哪一个是网络摄像头?

$ ls -ltrh /dev/video*
crw-rw----+ 1 root video 81, 1 Mai  4 00:17 /dev/video1
crw-rw----+ 1 root video 81, 0 Mai  4 00:17 /dev/video0

这是一台笔记本电脑,我猜其中一个是内置摄像头,另一个是屏幕。但是我怎么查看哪个是哪个呢?有没有办法获取更多关于它们的信息?

最好但最愚蠢的方法是使用像Discord这样的视频聊天应用,并打开你的摄像头。如果一个摄像头不起作用,就使用另一个。我和我姐姐就是用这种方法来测试摄像头和麦克风的。 - Irsu85
好的,但是当我打开Zoom时,它只列出了摄像头,所以我猜我的问题可能是... Zoom是如何知道的呢? - Alex028502
我真的不知道Zoom是怎么知道的 - Irsu85
2个回答

你可以在终端中使用 v4l2-ctl来完成这个操作。
  1. 打开终端(如果尚未打开)
  2. 安装实用程序(如果尚未安装)
    sudo apt update 
    sudo apt install v4l2-ctl
    
  3. 运行实用程序:
    v4l2-ctl --list-devices
    
    您将看到如下输出:
    Integrated Camera (usb-0000:00:3b.0-1.2):
        /dev/video0
    

/dev/video* 中看到的视频设备之一是虚拟设备。


2我认为安装命令中有一个拼写错误;应该是 sudo apt install v4l-utils,对吗? - Enterprise
这并不总是有效的,在我的笔记本电脑上我得到了 HP TrueVision HD: HP TrueVision (usb-0000:00:14.0-5): /dev/video0 /dev/video1,但我只有一个摄像头。 - Archisman Panigrahi
@Archisman,我也有一台HP机器,v4l2-ctl也列出了两个设备(/dev/video0/dev/video1)。我想知道其中一个是否是红外摄像头? - Enterprise
@PJSingh 我想我没有红外相机。 - Archisman Panigrahi

有一个叫做usbutils的软件包,它可以是一个非常有价值的工具:
sudo apt install usbutils

然后您可以查询任何USB设备并获得大量信息:
$ sudo lsusb -v | grep -i webcam -a14

Bus 001 Device 009: ID 1bcf:2b8c Sunplus Innovation Technology Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1bcf Sunplus Innovation Technology Inc.
  idProduct          0x2b8c 
  bcdDevice           47.14
  iManufacturer           1 SunplusIT Inc
  iProduct                2 Integrated_Webcam_HD
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          767
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0 
      iFunction               4 Integrated Webcam
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0 
      iInterface              4 Integrated Webcam
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength          109
        dwClockFrequency       48.000000MHz
        bInCollection           1
        baInterfaceNr( 0)       1
      VideoControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1


我没想到-a--text)会接收参数。它似乎和-C一样工作,它们是等价的吗? - Pablo Bianchi
@PabloBianchi 你可以使用-a#来指定grep匹配前后的行数。你可以使用-A#来指定grep匹配后的行数。我以前没有使用过grep中的-C选项。你用它做什么? - WinEunuuchs2Unix
-C--context)是用于上下文的。它似乎与未记录的-a#完全相同,据我所知。请注意,-a可能会输出二进制垃圾。 - Pablo Bianchi