TransWikia.com

Webcam in Ubuntu 20.04 works partly

Ask Ubuntu Asked by Kasheftin on November 9, 2021

My webcam works in some applications and does not work in another.
For example, it works in skype and guvcview but does not work in cheese (cheese was reinstalled, no effect).

>lsusb
Bus 001 Device 002: ID 0806:0806 SJ-181217-N 1080P Webcam

>hwinfo --usb
07: USB 00.2: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: RUmI.YLn6RqfXaa3
  Parent ID: k4bc.2DFUsyrieMD
  SysFS ID: /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.2
  SysFS BusID: 1-7:1.2
  Hardware Class: unknown
  Model: "SJ-181217-N 1080P Webcam"
  Hotplug: USB
  Vendor: usb 0x0806 "SJ-181217-N"
  Device: usb 0x0806 "1080P Webcam"
  Revision: "12.17"
  Driver: "snd-usb-audio"
  Driver Modules: "snd_usb_audio"
  Speed: 480 Mbps
  Module Alias: "usb:v0806p0806d1217dcEFdsc02dp01ic01isc01ip00in02"
  Driver Info #0:
    Driver Status: snd_usb_audio is active
    Driver Activation Cmd: "modprobe snd_usb_audio"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #9 (Hub)

Even more, in chrome it works on some websites and does not work on another. I don’t know if that is the same issue or another one. It works in meet.google.com and hangouts.google.com and in some webcam tests, but it does not work in any of the javascript webcam tutorials (where we use <video> and navigator.mediaDevices.getUserMedia(..).

If I google for webcam test, and follow the results:

  1. https://www.onlinemictest.com/webcam-test/ – works;
  2. https://webcamtests.com/ – does not work;
  3. https://www.vidyard.com/cam-test/ – works;
  4. https://webcammictest.com/ – does not work;
  5. https://www.iobit.com/en/webcam-test.php – works;
  6. https://www.hotcleaner.com/webcam-test/ – does not work;
  7. https://www.drift.com/video/camera-test/ – does not work;

Chrome devtools says nothing.

Update:
got a very strange behavior: If I go to any of the working websites, for example to https://www.onlinemictest.com/webcam-test/ and start the test, then in the other tab open non-working site, it starts working as well.
It seems, the working website makes something that turns the camera on, and after that it works everywhere. If I close the first tab and refresh the second, I see the black screen only.

2 Answers

There's some hidden data about width/height/resolution that the webcam usually provides to the system. Probably, for my webcam model this data is missing. I finally managed to solve the issue by specifying width and height manually in the getUserMedia call. I guess, all the working webcam tests above have these options set, and all non-working tests do not set these options.

Here's the working code: https://codepen.io/kasheftin/pen/YzwdmYV

P.S. I guess that cheese also tries to get width/height from the camera settings and has not fallback (the default values).

Answered by Kasheftin on November 9, 2021

Okay, Goto chrome://settings/content/camera?search=camera and check either the sites you mentioned are in Allow or Block. Try Enabling or Disabling "Ask before accessing". Also, try https://storyxpress.co/webcam-test webcam test tool if your camera work here or not.

Answered by Varun Goyal on November 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP