VIDEOIO(V4L2:/dev/video0): select() timeout

I 'm trying to connect my webcam USB with WSL2. I can get it showed up on WSL2 with command

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:08cb Logitech, Inc. Mic (Notebooks Pro)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


$ v4l2-ctl --list-devices
UVC Camera (046d:08c9) (usb-vhci_hcd.0-1):

When I tried to run my program

import numpy as np
import cv2

cap = cv2.VideoCapture(0)


    ret, frame =
    if ret:

        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

        if cv2.waitKey(1) & 0xFF == ord('q'):

The webcam light is on, its mean activating but can not capture any frame.

[ WARN:0@10.310] global /io/opencv/modules/videoio/src/cap_v4l.cpp (1000) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.

I tried these command below but seems doesn’t help

rmmod uvcvideo
modprobe uvcvideo nodrop=1 timeout=5000

its showed error

rmmod uvcvideo
rmmod: ERROR: Module uvcvideo is builtin.

Any solutions?

assert cap.isOpened()

always do that after creating the object

can you receive frames using ffmpeg or vlc (inside the container)?

Hi,I meet the same problem with you and I haven’t solved that yet,so is there any progress you have made to solve the error?I would appreciate it if you can give me some advice!:slight_smile:

I use ffplay -f video4linux2 -input_format mjpeg -framerate 30 -video_size 640*480 /dev/video0 to test if ffmpeg can show frames correctly and the result the picture above,it seems that ffmpeg can’t open the camera too,so what’s the problem with this,do you have any idea?

Hey, I got simmilar issue and solve it with setting format as MJPG int the 4-character code of codec.

from cv2 import cv2

camera = cv2.VideoCapture(0)
camera.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))
status, image =