batresh
Posts: 24
Joined: Wed Jun 26, 2019 11:20 am

USB Webcam Appears as 2 Devices

Mon Jul 22, 2019 2:28 pm

I am trying to use a USB webcam on the RPi 3 B+. I have been having issues with open cv when trying to access video. I typed "ls /dev/video*" to see the devices and the webcam appears as both /dev/video0 and /dev/video1. How can I fix this?

$ ls /dev/video*
/dev/video0 /dev/video1 /dev/video10 /dev/video11 /dev/video12

Also I tried plugging the camera to my laptop and it appears as just one device.

PiGraham
Posts: 3778
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: USB Webcam Appears as 2 Devices

Mon Jul 22, 2019 2:32 pm

batresh wrote:
Mon Jul 22, 2019 2:28 pm
I am trying to use a USB webcam on the RPi 3 B+. I have been having issues with open cv when trying to access video. I typed "ls /dev/video*" to see the devices and the webcam appears as both /dev/video0 and /dev/video1. How can I fix this?

$ ls /dev/video*
/dev/video0 /dev/video1 /dev/video10 /dev/video11 /dev/video12

Also I tried plugging the camera to my laptop and it appears as just one device.
Does it work? Can you use dev/video0 ?

batresh
Posts: 24
Joined: Wed Jun 26, 2019 11:20 am

Re: USB Webcam Appears as 2 Devices

Mon Jul 22, 2019 2:37 pm

I can take pictures from the webcam but I can not stream video from it.
When I use cv2.imshow or cv2.VideoCapture I get the following error:

(Webcam1:1213): Gtk-WARNING **: cannot open display:

Since I have been able to use other open cv functions I was guessing that the Pi seeing the webcam as 2 devices might be the issue.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8076
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: USB Webcam Appears as 2 Devices

Mon Jul 22, 2019 2:53 pm

Check the formats that the two nodes can stream. "v4l2-ctl --list-formats-ext".

Memory says that uvcvideo (the kernel module responsible for USB Video Class devices) was updated a while back to support providing metadata as well as video data. The two streams come from independent nodes. Linux 4.16 by the looks of it.

Code: Select all

commit 68c5735eaa5e680e701c9a2d1e3c7880bdf5ab66
Merge: 2246edf 273caa2
Author: Linus Torvalds <[email protected]>
Date:   Tue Feb 6 11:27:48 2018 -0800

    Merge tag 'media/v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
    
    Pull media updates from Mauro Carvalho Chehab:
<snip>
     - add support for UVC metadata
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “General discussion”