jitsi / jitsi-meet

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
https://jitsi.org/meet
Apache License 2.0
23.36k stars 6.77k forks source link

UVC Camera not working with Jitsi meet, works with onlinemictest, zoom #11229

Closed prajjwald closed 2 years ago

prajjwald commented 2 years ago

Description:

Jitsi meet (from flatpak app, Firefox, Brave, Chromium) gives me a Unable to access camera error. The same camera works fine with the webrtc test on the same browsers, as well as with the zoom app, guvcview, and cheese.

I only started having this issue a few weeks back. I've seen the same issue with:

With Firefox, I have also noticed that while the camera is not accessible from Jitsi meet online despite giving permissions, if I close the browser, it generates a crashscan in a few minutes - with the top frame of the stack trying to access the camera. I tried using a brand new camera, but got the same result. The fact that mictest can correctly detect and display my video in both my old and new cameras makes it look like it is something that is wrong with how Jitsi is trying to access the camera.

Steps to reproduce:

Prerequisites:

  1. Open jitsi meet online from browser
  2. Start/join conference, give camera access to the page

Expected behavior:

My camera should start streaming my video once I give permission

Actual behavior:

image

Server information:

Client information:

Additional information:

saghul commented 2 years ago

What resolution does your camera provide?

Can you reproduce it when accessing meet.jit.si ?

prajjwald commented 2 years ago

Per the specs:

The C920x (newer) provides 1080p/720p. The C270 provides 720p.

I am able to reproduce this when accessing meet.jit.si: I tried Firefox (currently using flatpak, but tried deb and snap too), brave (Deb), and chromium (Deb). Same behavior as the jitsi flatpak app.

gpatel-fr commented 2 years ago

For what it's worth, I have a UVC cam that I use to test Jitsi-meet, it's a no name brand and the OS is an elderly Ubuntu 18.04. It's working not well, but it has never worked reliably - it works for half an hour to one hour and then I have to reinitialize it, but it's not a new problem. And while it works, it works. As an aside try to not post links to test sites funded by advertisement, you can test your cam in a browser with a non commercial site. About Jitsi-meet, since you say that it's a recent problem ('few weeks back'), there are ways to test more ancient Jitsi-meet versions on the Internet, on the community instances list I have found that fairmeeting.net is running 6726 a version published on 10 dec 2021, that's 3 months back, can you test your cam on this site to see if it works there with the same system that fails on meet.jit.si ?

prajjwald commented 2 years ago

Thank you for the link to the debugging instructions and the community list - I wasn't aware of this before.

That site was the only one I had been able to find which allowed me to successfully test my cameras. I've now edited my comments to link to webrtc test instead. On the other hand, I just tried the older jitsi version from fairmeeting.net, and got the same problem. This is the issue I see from Firefox (it asked me for audio, did not ask me for video access):

image

I also tried with the Jitsi app, and get errors too:

image

Even though this did start just a few weeks ago (I had videoconferenced with my friends using Jitsi meet with the same camera before that), I have noticed that Google meet has also started having the same issue.

I will post more details if I am able to find more helpful info I can provide, either on suggestion, or from the troubleshooting link you provided. Thanks!

I wonder if this is something to do with newer versions of either Ubuntu libraries or Kernel deprecating older calls that might be being used.. as some sites (the ad-funded free testing tool I linked above) are able to access the camera correctly?

prajjwald commented 2 years ago

To contrast against the Firefox screenshot I posted above, I'm also posting the results from the test site below.

The webrtc.github.io page gives me the following prompt, after which the camera works properly:

image

gpatel-fr commented 2 years ago

As of Chrome and Firefox versions, are you on fixed versions or do you follow the real time rolling of new versions ? I'm not convinced by the Ubuntu updates theory, since for desktop environment, Ubuntu is pretty conservative for graphic libraries in a given LTS version. The kernel can change but it's not usual that there are large changes unless you are asking for it (such as 4 -> 5). I think browsers change much more and faster.

You can locate older Chrome versions following this link: https://vikyd.github.io/download-chromium-history-version Select Linux 64 and then you can download the version you want (usually the stable version 0.xx is the last one in this list). You can just unzip it and run it directly.

Beware of the config directory, there is no descending compatibility. For standard Chrome it's ~/.config.chromium. If it's already used by your current browser, save it and delete it, or rename it before using an older Chrome version. If you use Snap Chromium it's not a problem since it uses a different config dir, but if you start doing tests and you want to go back in time you have to think to delete the config dirbefore launching the older Chromium.

prajjwald commented 2 years ago

Thanks again for the chromium links: I am learning quite a bit here... I tried with the 2022-01-21 version (just a spot check) - that did not work.

After, that, I tried with the 2021-11-08 version, this did not work as well.

Posting a snapshot of the latter version below:

image

prajjwald commented 2 years ago

Since I use Firefox as my daily driver and Brave as a fallback browser, I normally don't have Chromium installed (I only install it on occasion for testing if I have problems with the other two). I did remove ~/.config.chromium. before testing though, same results.

prajjwald commented 2 years ago

Also, regarding the screenshot above: lsof /dev/video* does not show any other device using it.

I am also able to use webrtc.github.io on the older Chromium browsers without issues.

prajjwald commented 2 years ago

Also posting resolutions as shown by guvcview in case this is somehow related with resolution:

image

gpatel-fr commented 2 years ago

Can you try to install the v4l-conf and v4l-utils packages and run v4l2-ctl --all and v4l-info /dev/video0 (and video1-x if you have several devices)

prajjwald commented 2 years ago

Sure. this is the output of v4l2-ctl --al

Driver Info:
    Driver name      : uvcvideo
    Card type        : HD Pro Webcam C920
    Bus info         : usb-0000:00:10.0-1.2.1
    Driver version   : 5.15.27
    Capabilities     : 0x84a00001
        Video Capture
        Metadata Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Media Driver Info:
    Driver name      : uvcvideo
    Model            : HD Pro Webcam C920
    Serial           : 9165D69F
    Bus info         : usb-0000:00:10.0-1.2.1
    Media version    : 5.15.27
    Hardware revision: 0x00000021 (33)
    Driver version   : 5.15.27
Interface Info:
    ID               : 0x03000002
    Type             : V4L Video
Entity Info:
    ID               : 0x00000001 (1)
    Name             : HD Pro Webcam C920
    Function         : V4L2 I/O
    Flags            : default
    Pad 0x01000007   : 0: Sink
      Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 176/144
    Pixel Format      : 'YUYV' (YUYV 4:2:2)
    Field             : None
    Bytes per Line    : 352
    Size Image        : 50688
    Colorspace        : sRGB
    Transfer Function : Rec. 709
    YCbCr/HSV Encoding: ITU-R 601
    Quantization      : Default (maps to Limited Range)
    Flags             : 
Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 176, Height 144
    Default     : Left 0, Top 0, Width 176, Height 144
    Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 176, Height 144, Flags: 
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 176, Height 144, Flags: 
Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 15.000 (15/1)
    Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=0 value=255
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2 (60 Hz)
                0: Disabled
                1: 50 Hz
                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2000 max=6500 step=1 default=4000 value=3177 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=128 value=128
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
                1: Manual Mode
                3: Aperture Priority Mode
              exposure_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=250 value=333 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1
                   pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=0 max=250 step=5 default=0 value=55 flags=inactive
                     focus_auto 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=100 max=500 step=1 default=100 value=100
                      led1_mode 0x0a046d05 (menu)   : min=0 max=3 default=0 value=3 (Auto)
                0: Off
                1: On
                2: Blink
                3: Auto
                 led1_frequency 0x0a046d06 (int)    : min=0 max=255 step=1 default=0 value=0

This is the output of v4l-info /dev/video0

# v4l-info /dev/video0 

### v4l2 device info [/dev/video0] ###
general info
    VIDIOC_QUERYCAP
    driver                  : "uvcvideo"
    card                    : "HD Pro Webcam C920"
    bus_info                : "usb-0000:00:10.0-1.2.1"
    version                 : 5.15.27
    capabilities            : 0x84a00001 [VIDEO_CAPTURE,?,?,STREAMING,(null)]

standards

inputs
    VIDIOC_ENUMINPUT(0)
    index                   : 0
    name                    : "Camera 1"
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []

video capture
    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
    index                   : 0
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "YUYV 4:2:2"
    pixelformat             : 0x56595559 [YUYV]
    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
    index                   : 1
    type                    : VIDEO_CAPTURE
    flags                   : 1
    description             : "Motion-JPEG"
    pixelformat             : 0x47504a4d [MJPG]
    VIDIOC_G_FMT(VIDEO_CAPTURE)
    type                    : VIDEO_CAPTURE
    fmt.pix.width           : 176
    fmt.pix.height          : 144
    fmt.pix.pixelformat     : 0x56595559 [YUYV]
    fmt.pix.field           : NONE
    fmt.pix.bytesperline    : 352
    fmt.pix.sizeimage       : 50688
    fmt.pix.colorspace      : SRGB
    fmt.pix.priv            : 4276996862

controls
    VIDIOC_QUERYCTRL(BASE+0)
    id                      : 9963776
    type                    : INTEGER
    name                    : "Brightness"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+1)
    id                      : 9963777
    type                    : INTEGER
    name                    : "Contrast"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+2)
    id                      : 9963778
    type                    : INTEGER
    name                    : "Saturation"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+12)
    id                      : 9963788
    type                    : BOOLEAN
    name                    : "White Balance Temperature, Auto"
    minimum                 : 0
    maximum                 : 1
    step                    : 1
    default_value           : 1
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+19)
    id                      : 9963795
    type                    : INTEGER
    name                    : "Gain"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 0
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+24)
    id                      : 9963800
    type                    : MENU
    name                    : "Power Line Frequency"
    minimum                 : 0
    maximum                 : 2
    step                    : 1
    default_value           : 2
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+26)
    id                      : 9963802
    type                    : INTEGER
    name                    : "White Balance Temperature"
    minimum                 : 2000
    maximum                 : 6500
    step                    : 1
    default_value           : 4000
    flags                   : INACTIVE
    VIDIOC_QUERYCTRL(BASE+27)
    id                      : 9963803
    type                    : INTEGER
    name                    : "Sharpness"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+28)
    id                      : 9963804
    type                    : INTEGER
    name                    : "Backlight Compensation"
    minimum                 : 0
    maximum                 : 1
    step                    : 1
    default_value           : 0
    flags                   : unknown
prajjwald commented 2 years ago
# v4l-info /dev/video1

### v4l2 device info [/dev/video1] ###
general info
    VIDIOC_QUERYCAP
    driver                  : "uvcvideo"
    card                    : "HD Pro Webcam C920"
    bus_info                : "usb-0000:00:10.0-1.2.1"
    version                 : 5.15.27
    capabilities            : 0x84a00001 [VIDEO_CAPTURE,?,?,STREAMING,(null)]

standards

inputs

video capture
VIDIOC_G_FMT(VIDEO_CAPTURE): Invalid argument

controls
gpatel-fr commented 2 years ago

Well, I have 2 other Linux computers with video capture devices and all 3 are very different from your device from a particular POV, they are all reporting a size that seems to be the max resolution: VIDIOC_G_FMT(VIDEO_CAPTURE) type : VIDEO_CAPTURE fmt.pix.width : 1280 fmt.pix.height : 720 while your device is reporting an incredibly small 176x144 - I'm sure that the C920 does a lot more than that. I have no idea if or why Jitsi-meet should hate that. But it does not seem very normal.

prajjwald commented 2 years ago

Agreed that 176x144 is much lower than it should be. One interesting thing I noticed is that running before and after launching jitsi (after reboot) yielded different results (though 640x480 is still much lower than what it should be). The resolution changes from 640x480 -> 176x144. The pixel format changes from MJPG to YUYV.

Before running jitsi meet While running guvcview:

# v4l-info /dev/video0|grep fmt.pix
    fmt.pix.width           : 640
    fmt.pix.height          : 480
    fmt.pix.pixelformat     : 0x47504a4d [MJPG]
    fmt.pix.field           : NONE
    fmt.pix.bytesperline    : 0
    fmt.pix.sizeimage       : 614400
    fmt.pix.colorspace      : SRGB
    fmt.pix.priv            : 4276996862

After running Jitsi meet While not running guvcview:

# v4l-info /dev/video0|grep fmt.pix
    fmt.pix.width           : 176
    fmt.pix.height          : 144
    fmt.pix.pixelformat     : 0x56595559 [YUYV]
    fmt.pix.field           : NONE
    fmt.pix.bytesperline    : 352
    fmt.pix.sizeimage       : 50688
    fmt.pix.colorspace      : SRGB
    fmt.pix.priv            : 4276996862
gpatel-fr commented 2 years ago

Note that I almost only use Chromium with Jitsi-meet and the reported resolution never changes. Let's try with Firefox - the same. And the supported format don't change either (I have 2 with only MJPEG, and one that supports MJPEG and YUYV. This is true on all my computers with driver versions going from 5.4 (Ubuntu 18) to 5.15.19 (Kubuntu 22.04)

prajjwald commented 2 years ago

Thank you very much for all your help and suggestions on this! After wondering about the resolution and rebooting my computer a few times, I decided to try a direct connection to my desktop, as opposed to via the KVM switch (I have a multi-computer setup where I can switch between my laptop/work laptop/desktop).

Directly plugging in the camera works, so presumably something in the KVM hop degraded the camera output, albeit recently.

Directly connecting the camera gives expected high resolutions, e.g. with guvc running and with the appropriate resolution set, this is what I see:

# v4l-info /dev/video0|grep fmt.pix
    fmt.pix.width           : 1920
    fmt.pix.height          : 1080
    fmt.pix.pixelformat     : 0x47504a4d [MJPG]
    fmt.pix.field           : NONE
    fmt.pix.bytesperline    : 0
    fmt.pix.sizeimage       : 4147200
    fmt.pix.colorspace      : SRGB
    fmt.pix.priv            : 4276996862

The flatpak, and the browser versions of meet.jit.si work perfectly now.

Sorry about the wild goose chase, this turned out to be a hardware issue.

prajjwald commented 2 years ago

As an aside: I also see that webrtc test now shows a much better resolution for my camera as well.

gpatel-fr commented 2 years ago

Was the USB cam switched through the KVM ?

prajjwald commented 2 years ago

Yes, the USB camera was switched through the KVM, which should be why I ran into the issue across my laptop and desktop, which are completely different Ubuntu versions.

It had been working fine earlier though. I guess something got broken in the hardware - I still switch most of my USB devices (Keyboard, mouse, speakers) through the switch.

prajjwald commented 2 years ago

the fact that zoom, guvcview, were fine led to me not suspecting hardware at all.

saqibkafeel commented 8 months ago

how to enable permission for UVC camera from React native side? any particular file name and line no.? provide React native code to enable UVC camera instead builtin android cam

saghul commented 8 months ago

It's now builtin on Android < 14. It should be listed together with other cameras.

saqibkafeel commented 8 months ago

It's now builtin on Android < 14. It should be listed together with other cameras.

this is not the right answer for my question , right now jitsi-meet code not detected my uvc camera means it is not asking permission to access my usb camera , provide me react native code to enable usb camera permission also tell me where i need to put that code in this official repo : https://github.com/jitsi/jitsi-meet

saghul commented 8 months ago

Yes it is the right answer. In the latest beta release, and also on master, UVC camera support is builtin. It's part of react-native-webrtc.

saqibkafeel commented 8 months ago

Yes it is the right answer. In the latest beta release, and also on master, UVC camera support is builtin. It's part of react-native-webrtc.

i am using the latest jistsi-meet-master source code fetched yesterday and this repo not exposing any function from react-native-webrtc like getmediaUser or enumerated devices etc , so how can i access these functions in this repo : https://github.com/jitsi/jitsi-meet