I'm very new to WSL. I want to run a python code on ubuntu shell on my win10 PC. This code needs access to webcam, but it seems that the webcam is not opened properly..I have checked online and I found several posts 1-2 years ago which said that the integrated webcam cannot be accessed by WSL..Is there any update or trick that can use webcam on WSL?
Many thanks!
The good news is that you may compile your own Linux kernel for WSL2 and have access to the occasional microphone or webcam from your chosen Linux distribution.
This happens when WSL shuts down automatically and you need to start it back with Admin privileges. Open Powershell / CMD as admin and run wsl . WSL will start and you can close the window. The normal way of using WSL will now work.
Method 2: Enabling the Webcam. If you've disabled the webcam in the BIOS or UEFI setup screen, then you'll need to reboot and hold down F2 or another key to access the menu. Change the “Camera” setting to [ Enabled ] before saving and quitting. You may then boot Linux as normal.
Visual Studio's WSL 2 toolset allows you to use Visual Studio to build and debug C++ code on WSL 2 distros without adding a SSH connection. You can already build and debug C++ code on WSL 1 distros using the native WSL 1 toolset introduced in Visual Studio 2019 version 16.1.
You can't still access the webcam in WSL but there are several ways to access the video stream in WSL. The most obvious one is converting your webcam to a web-based streaming protocol like RTSP, MPEG, FFMPEG streams (example) where you get almost similar experiences.
Also, there are many applications where you can make your webcam as an IPcam stream then use the stream URL instead of using the camera index in OpenCV or any other application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With