一個物理設備的多個 /dev/video
首先是一些規格:我的電腦是 HP EliteBook 8460p。它帶有一個集成的 Chicony HP 高畫質網路攝像頭。
我的問題是很多應用程序(至少是 Skype 和 guvcview)為同一個網路攝像頭顯示多行;事實上,如果我這樣做
ls -l /dev | grep video
,我會得到以下資訊:crw-rw---- 1 root video 29, 0 Apr 16 08:13 fb0 crw-rw---- 1 root video 243, 0 Apr 16 08:13 media0 crw-rw----+ 1 root video 81, 0 Apr 16 08:13 video0 crw-rw----+ 1 root video 81, 1 Apr 16 08:13 video1
我有 2 個
/dev/video[n]
,只有一個(集成)網路攝像頭;Skype 可以正常工作/dev/video0
,但不能正常工作/dev/video1
。guvcview 也一樣。如果我插入另一個 USB 網路攝像頭,例如羅技網路攝像頭,我會得到以下資訊
dmesg
:[21222.638802] usb 2-2: new high-speed USB device number 20 using xhci_hcd [21222.970684] usb 2-2: New USB device found, idVendor=046d, idProduct=08c2, bcdDevice= 0.05 [21222.970755] usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [21222.972518] uvcvideo: Found UVC 1.00 device <unnamed> (046d:08c2) [21226.044535] uvcvideo 2-2:1.0: Entity type for entity Extension 4 was not initialized! [21226.044538] uvcvideo 2-2:1.0: Entity type for entity Extension 8 was not initialized! [21226.044540] uvcvideo 2-2:1.0: Entity type for entity Extension 10 was not initialized! [21226.044541] uvcvideo 2-2:1.0: Entity type for entity Extension 9 was not initialized! [21226.044543] uvcvideo 2-2:1.0: Entity type for entity Extension 3 was not initialized! [21226.044545] uvcvideo 2-2:1.0: Entity type for entity Processing 2 was not initialized! [21226.044547] uvcvideo 2-2:1.0: Entity type for entity Camera 1 was not initialized! [21226.044746] input: UVC Camera (046d:08c2) as /devices/pci0000:00/0000:00:1c.7/0000:25:00.0/usb2/2-2/2-2:1.0/input/input35 [21226.137559] usb 2-2: Warning! Unlikely big volume range (=3072), cval->res is probably wrong. [21226.137569] usb 2-2: [5] FU [Mic Capture Volume] ch = 1, val = 4608/7680/1
以下是
ls -l /dev/ | grep video
:crw-rw---- 1 root video 29, 0 Apr 16 08:13 fb0 crw-rw---- 1 root video 243, 0 Apr 16 08:13 media0 crw-rw---- 1 root video 243, 1 Apr 16 14:06 media1 crw-rw----+ 1 root video 81, 0 Apr 16 08:13 video0 crw-rw----+ 1 root video 81, 1 Apr 16 08:13 video1 crw-rw----+ 1 root video 81, 2 Apr 16 14:06 video2 crw-rw----+ 1 root video 81, 3 Apr 16 14:06 video3
3 個新條目
/dev/media1
:/dev/video2
和/dev/video3
。我什至發現了一個索尼網路攝像頭 (CEVCECM),它最多可以添加 4 個新設備。
dmesg
日誌:[21927.665747] usb 2-2: new high-speed USB device number 23 using xhci_hcd [21927.817330] usb 2-2: New USB device found, idVendor=05e3, idProduct=0608, bcdDevice= 9.01 [21927.817339] usb 2-2: New USB device strings: Mfr=0, Product=1, SerialNumber=0 [21927.817343] usb 2-2: Product: USB2.0 Hub [21927.824119] hub 2-2:1.0: USB hub found [21927.824814] hub 2-2:1.0: 4 ports detected [21928.113733] usb 2-2.4: new high-speed USB device number 24 using xhci_hcd [21928.223184] usb 2-2.4: New USB device found, idVendor=054c, idProduct=097b, bcdDevice=21.12 [21928.223192] usb 2-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [21928.223197] usb 2-2.4: Product: CEVCECM [21928.223201] usb 2-2.4: Manufacturer: Sony [21928.223206] usb 2-2.4: SerialNumber: DHZD10412EUHK1 [21928.227506] uvcvideo: Found UVC 1.00 device CEVCECM (054c:097b) [21928.242592] uvcvideo: Unable to create debugfs 2-24 directory. [21928.242780] uvcvideo 2-2.4:1.0: Entity type for entity Extension 7 was not initialized! [21928.242783] uvcvideo 2-2.4:1.0: Entity type for entity Extension 3 was not initialized! [21928.242785] uvcvideo 2-2.4:1.0: Entity type for entity Processing 2 was not initialized! [21928.242787] uvcvideo 2-2.4:1.0: Entity type for entity Camera 1 was not initialized! [21928.242877] input: CEVCECM: CEVCECM as /devices/pci0000:00/0000:00:1c.7/0000:25:00.0/usb2/2-2/2-2.4/2-2.4:1.0/input/input38
生成的設備文件包含
ls -l /dev | grep video
:crw-rw---- 1 root video 29, 0 Apr 16 08:13 fb0 crw-rw---- 1 root video 243, 0 Apr 16 08:13 media0 crw-rw---- 1 root video 243, 1 Apr 16 14:18 media1 crw-rw----+ 1 root video 81, 0 Apr 16 08:13 video0 crw-rw----+ 1 root video 81, 1 Apr 16 08:13 video1 crw-rw----+ 1 root video 81, 2 Apr 16 14:18 video2 crw-rw----+ 1 root video 81, 3 Apr 16 14:18 video3 crw-rw----+ 1 root video 81, 4 Apr 16 14:18 video4 crw-rw----+ 1 root video 81, 5 Apr 16 14:18 video5
5 個新條目:
/dev/media1
和/dev/video2
到/dev/video5
.我覺得要使用的文件是正確
/dev/media[n]
的,但 Skype 和 guvcview 不知何故未能這樣做並回退到/dev/video[n]
.例如,我對 Webcamoid 沒有這個問題。
如果有人有想法,我會接受。與此同時,我將繼續調查……
— 編輯了 2019-05-14 —
得到了一些有趣的資訊
v4l2-ctl --device=/dev/video* --all
。對於群光惠普高畫質網路攝像頭,其 2 個設備文件具有不同的設備功能:# Devices capabilities for /dev/video0 Video Capture Streaming Extended Pix Format # Devices capabilities for /dev/video1 Metadata Capture Streaming Extended Pix Format
對於 USB 網路攝像頭,我得到了類似的結果。所以說到底,也許 Skype 和 guvcview 做不到的就是只列出支持
Video Capture
設備功能的影片設備。
第二設備提供關於來自第一設備的影片數據的元數據。此更新檔引入了新設備:
可以在此處找到有關 V4L 元數據介面的更多資訊:
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/dev-meta.html
對於普通的 USB 影片類設備,這主要只是提供更準確的時間戳資訊。對於像英特爾的 RealSense 系列這樣的相機,提供有關如何擷取圖像的更廣泛的數據。
據推測,這些數據被拆分到一個單獨的設備節點中,因為它無法以兼容的方式輕鬆地傳遞到主設備節點上。不過這有點痛苦,因為 (a) 不關心此元數據的應用程序現在需要過濾掉額外的設備,並且 (b) 關心元數據的應用程序需要一種將兩個設備綁定在一起的方法.