Webcam in Ubuntu 20.04 works partly

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. - works;
  2. - does not work;
  3. - works;
  4. - does not work;
  5. - works;
  6. - does not work;
  7. - 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 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

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 webcam test tool if your camera work here or not.

2

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:

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like