16

I have a Dell XPS 9370, which is known to have only one camera. But ls /dev/video* results in /dev/video0 /dev/video1 /dev/video2 /dev/video3, so four different camera devices.
These four cameras bubble up to the applications, e.g. Skype which lists four cameras, but just the first one (/dev/video0) works.

Does anybody know where the other entries come from? Or how to hide them from higher layers?

2
  • I second the problem for a "Logitech, Inc. Portable Webcam C905" USB camera. I get /dev/video0 and /dev/video1. For me, the problem occurs after upgrading from Ubuntu 14.04 to Kubuntu 18.04. lsusb only shows one device, whereas udevadm shows two identical devices. Which OS are you using?
    – André
    Commented May 15, 2019 at 11:38
  • 2
    Interesting. It happens for me in Ubuntu 18.10, 19.04 and 19.10, as well as in Arch and Manjaro... Commented Jun 6, 2019 at 20:47

4 Answers 4

9

The answer given here https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device is a good one. I have the same problem with Skype and it started when I upgraded the kernel from 4.4.x to 5.1.x so somewhere in there the uvcvideo module produced a different output. However, has it is pointed out the output of

v4l2-ctl --device=/dev/video* --all

does show that each entry has a different capability, and in the case of my logitech usb camera only 1 has video capture. So this is most likely a bug in Skype, that appeared after the kernel probably fix a bug themselves, that does not only shows the entries that have a "Video capture" capability.

2
  • Thanks for the pointer, I also get different capabilities for each of them. Your guess, that it's a Skype bug seems correct, as e.g. gnomes cheese only shows one camera. Commented Jun 12, 2019 at 10:58
  • 1
    This is not a skype bug. I don't have skype installed and am experiencing this right now on 18.04. Vlc shows 2 cameras, and only one of them work. v4l2-ctl --list-devices shows 2 cameras, (lowest number seems to be the one that works most of the time). udevadm info -a -n /dev/videoX on the one that works shows a BUNCH of info about the camera, and on the one that doesnt work, almost nothing. My guess is that this is more of a v4l2 version 1.10.0 version VS v4l2 version 1.14.2. This also happened to me when going from 16.04 to 18.04
    – TehTris
    Commented Sep 4, 2019 at 23:34
8

Each camera has a second metadata device added to output timestamp information or detailed per frame metadata

You can use v4l2-ctl to get more information on a device, and can use v4l2-ctl --list-formats --device /dev/videoX to determine if it contains video streams.

To list just devices with video data use:

for dev in `find /dev -iname 'video*' -printf "%f\n"`
do
  v4l2-ctl --list-formats --device /dev/$dev | \
    grep -qE '\[[0-9]\]' && \
    echo $dev `cat /sys/class/video4linux/$dev/name`
done

This can be combined with fzf to select a camera and launch a program:

for dev in `find /dev -iname 'video*' -printf "%f\n"`;do; v4l2-ctl --list-formats --device /dev/$dev | grep -qE '\[[0-9]\]' && echo $dev `cat /sys/class/video4linux/$dev/name`;done | fzf | awk '{ printf("/dev/%s", $1) }' | xargs guvcview --device
6

To find out what each device is, you can run this (and change the number in video0 to video1, etc):

cat /sys/class/video4linux/video0/name

Googling Dell XPS 9370 gives information that this model has also an infrared camera in addition to the normal web camera, and the infrared camera can be used for authenticating with face recognition. https://wiki.archlinux.org/index.php/Dell_XPS_13_(9370)

If you want to disable for example the IR camera, more information about your system is needed, for example dmesg.

2
4

The difference between /dev/video0 and /dev/video1 for a single camera is that one is for 'Video Capture' and the other is for 'Metadata Capture'.

It can be checked in 'Device Caps' info below:

The following command shows the info for /dev/video0:

$ v4l2-ctl --info --device /dev/video0
Driver Info (not using libv4l2):
Driver name   : uvcvideo
Card type     : 720p HD Camera: 720p HD Camera
Bus info      : usb-0000:00:14.0-6
Driver version: 5.3.18
Capabilities  : 0x84A00001
    Video Capture
    Metadata Capture
    Streaming
    Extended Pix Format
    Device Capabilities
Device Caps   : 0x04200001
    Video Capture
    Streaming
    Extended Pix Format

And for /dev/video1:

$ v4l2-ctl --info --device /dev/video1
Driver Info (not using libv4l2):
Driver name   : uvcvideo
Card type     : 720p HD Camera: 720p HD Camera
Bus info      : usb-0000:00:14.0-6
Driver version: 5.3.18
Capabilities  : 0x84A00001
    Video Capture
    Metadata Capture
    Streaming
    Extended Pix Format
    Device Capabilities
Device Caps   : 0x04A00000
    Metadata Capture
    Streaming
    Extended Pix Format
1
  • The meaning of the Capabilities output block seems to be ambiguous as it does not disambiguate between the two device handles. Only the Device Caps block has the difference. Any idea why the output from this command is structured like that? it may feel more robust to use a different command like v4l2-ctl --list-formats-ext -d /dev/video1 whose output is less ambiguous about the video streaming capabilities of the device.
    – matanox
    Commented Feb 11 at 2:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .