Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webcam cannot be accessed by WSL

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!

like image 895
gladys0313 Avatar asked Apr 08 '18 12:04

gladys0313


People also ask

Can WSL access camera?

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.

How do I fix Permission denied in WSL?

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.

How do I enable my webcam on Linux?

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.

Does Visual Studio work with WSL?

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.


1 Answers

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.

like image 90
Sumsuddin Shojib Avatar answered Sep 21 '22 09:09

Sumsuddin Shojib