我正在尝试让我的笔记本电脑的网络摄像头在 Cheese 中工作,但是我得到了这样的输出:
mohab@DESKTOP-VUD35O1:~$ cheese
** Message: 17:24:15.307: cheese-application.vala:214: Error during camera setup: No device found
(cheese:6699): cheese-CRITICAL **: 17:24:15.512: cheese_camera_device_get_name: assertion 'CHEESE_IS_CAMERA_DEVICE (device)' failed
(cheese:6699): GLib-CRITICAL **: 17:24:15.512: g_variant_new_string: assertion 'string != NULL' failed
(cheese:6699): GLib-CRITICAL **: 17:24:15.512: g_variant_ref_sink: assertion 'value != NULL' failed
(cheese:6699): GLib-GIO-CRITICAL **: 17:24:15.512: g_settings_schema_key_type_check: assertion 'value != NULL' failed
(cheese:6699): GLib-CRITICAL **: 17:24:15.512: g_variant_get_type_string: assertion 'value != NULL' failed
(cheese:6699): GLib-GIO-CRITICAL **: 17:24:15.512: g_settings_set_value: key 'camera' in 'org.gnome.Cheese' expects type 's', but a GVariant of type '(null)' was given
(cheese:6699): GLib-CRITICAL **: 17:24:15.512: g_variant_unref: assertion 'value != NULL' failed
** (cheese:6699): CRITICAL **: 17:24:15.513: cheese_preferences_dialog_setup_resolutions_for_device: assertion 'device != NULL' failed
Cheese 检测不到摄像头,因此无法执行任何操作。它只是一个空白屏幕。也没有/dev/video
。
我像这样将相机与 USBIP 连接起来:
PS C:\Users\mohab> usbipd wsl list
BUSID VID:PID DEVICE STATE
3-4 2232:1029 WebCam SC-13HDL11939N Not attached
4-3 8086:0189 Generic Bluetooth Adapter Not attached
PS C:\Users\mohab> USBIPD WSL attach -b 3-4
PS C:\Users\mohab> usbipd wsl list
BUSID VID:PID DEVICE STATE
3-4 2232:1029 WebCam SC-13HDL11939N Attached - Ubuntu
4-3 8086:0189 Generic Bluetooth Adapter Not attached
如何在 Windows 10 家庭版中使用 WSL2 中的相机?
答案1
要在 WSL2 中启用相机支持,你需要编译内核以包含它,因为默认的 WSL2 内核不包含支持它所需的模块,请使用此指导编译内核以包含这些必需的模块,之后你就可以通过连接网络摄像头在 WSL2 中使用了,在 Windows 端的 PowerShell 中使用 USBIP
注意:你需要在 WSL2 中支持 USB,请使用这个指导如果你还没有获得支持
像这样
PS C:\Users\mohab> usbipd wsl list
BUSID VID:PID DEVICE STATE
3-4 2232:1029 WebCam SC-13HDL11939N Not attached
4-3 8086:0189 Generic Bluetooth Adapter Not attached
PS C:\Users\mohab> USBIPD WSL attach -b 3-4
PS C:\Users\mohab> usbipd wsl list
BUSID VID:PID DEVICE STATE
3-4 2232:1029 WebCam SC-13HDL11939N Attached - Ubuntu
4-3 8086:0189 Generic Bluetooth Adapter Not attached
笔记:
连接到 WSL2 时,您可能无法使用 Windows 端的相机,
能够在 Windows 端再次使用它,将其从
WSL2 在 Windows 端使用 PowerShell。
像这样
PS C:\Users\mohab> usbipd wsl detach -b 3-4
或者将你的相机从主机(Windows)传输到客户机(WSL2 Ubuntu),使用摄像头2网络但是您每次都必须获取 IP 地址,并且它不适用于 Cheese,内核编译适用于每个程序,而这种方式只适用于支持 http 流(VLC、FFmpeg、Webbrowsers)的程序,而不适用于仅支持物理摄像头的程序,如 Cheese,这些程序需要/dev/video0
任何物理连接的摄像头,而不是 IP 摄像头。