VIDEOIO ERROR: V4L: can't find camera device
15,919
The suggestion api55 gave in his comment
video_capture = cv2.VideoCapture(0)
is what I would try first.
Generally, you can list the available cameras with ls /dev/video*
or v4l2-ctl --list-devices
. Here sample output:
NZXT-U:rt-trx> v4l2-ctl --list-devices
Microsoft® LifeCam Cinema(TM): (usb-0000:00:14.0-1):
/dev/video1
Microsoft® LifeCam Cinema(TM): (usb-0000:00:1a.0-1.3):
/dev/video0
/dev/video0
corresponds to device id 0, etc.
PS: v4l2-ctl
is quite useful for solving camera issues and can do much more than --list-devices
. I installed it via packagev4l-utils
on a 16.04 machine.
Author by
Neeraj Sharma
Updated on June 27, 2022Comments
-
Neeraj Sharma almost 2 years
I am using ubuntu16.04 and trying to run opencv script. when i use:
video_capture = cv2.VideoCapture(-1)
it gives me error VIDEOIO ERROR: V4L: can't find camera device No video window opens But when i run
video_capture = cv2.VideoCapture('test.jpg')
It opens window shows the picture and close the window. Please tell me why it is not streaming video directly from camera.
-
Neeraj Sharma over 5 yearsThank you very much Ulrich for your answer. I did sudo apt-get install cheese and it started working.
-
Ulrich Stern over 5 years@NeerajSharma, I took a quick look at the OpenCV source code, and
VideoCapture
does support negative device numbers (at least for cap_v4l.cpp), even though this is not in the docs! You could answer your own question. If you are not interested, I will edit my answer. -
Neeraj Sharma over 5 yearsYes i tried with -1 and it worked. Thanks for your support Ulrich.