soyersoyer / cameractrls

Camera controls for Linux
Other
574 stars 24 forks source link

Something about visiting the Capture page persists a bad configuration #30

Closed dannypurcell closed 1 year ago

dannypurcell commented 1 year ago

Installed from Snap, looked at the Capture page and my camera view went black. Now it is always black. By the reviews on the KDE software center, I'm not the only one who has experienced this. As far as I can tell, the camera still works, but no apps display anything but a black screen. Previously this camera was working fine right out of the box.

What does this app do when we first land on the Capture page?

And how can one fully reset anything this app may have changed?

Uninstalling Camerctrls didn't reset things, neither did unplug/replug, nor full shutdown reboot. So there seems to be something this app is leaving behind even after uninstall. That bit might be on the packager in this case but not laying blame here, just want to know everything this app can change and where to find any files it writes so I can hunt down what happened.

dannypurcell commented 1 year ago

Still no idea what happened to the camera when using this app but the resolution for now appears to have been using Guvcview to flip through all possible settings for the camera until it finally stopped outputting one of the following error messages. In my case Guvcview was logging this message right after startup:

V4L2_CORE: Could not grab image (select timeout): Resource temporarily unavailable

and switching through resolution and fps settings would vary the message between this and

V4L2_CORE: Could not grab image (select timeout): Device or resource busy

or

V4L2_CORE: Could not grab image (select timeout): Invalid argument

Also tried switching camera output mode and got the same error messages. Also fiddled with the Image Controls no real changes there, until I switched Power Line Frequency from 60hz to 50hz. That got the camera image back for reasons I can't explain. Switched the Power Line Frequency back to 60hz and still have an image. ... so yea, no idea what happened there.

For the sake of science I tried to recreate the issue by going back through what I thought the steps were that caused it originally. Unfortunately, I have so far not been able to trigger the camera to go blank again yet.

So I guess this one is a Heisenbug for now...

In case anyone in the future is seeing similar issues, along the way I also tried testing with the Cheese app, VLC media player's Video Capture feature, the Microsoft Teams video call feature via Chromium, fswebcam, and ffmpeg/ffplay, just to see if I can get anything to log something interesting. During the issue, none of those would take an image.

After the issue resolved all of those use case scenarios work as one would expect One minor detail of interest is that the fswebcam has a different failure message when it knows the camera is in use by another program. Attempting to run fswebcam -d /dev/video1 -r 1280x960 -v -S 10 --set brightness=100% test_image.jpg while the camera is in use by Teams or Cheese results in

Error selecting input 0
VIDIOC_S_INPUT: Device or resource busy

This would seem to indicate that, if the camera was somehow hung up even after being unplugged and through multiple system restarts, it was not due to a normal program acquiring a lock on the device.

My best guess is that playing with settings in Camerctrls put this particular camera's internal settings, into an unusable state and walking through all of the settings with Guvcview accidentally brought that back to a usable state.

In case it is useful for reference, below are the outputs from the usual commands of interest with regard to Cameractrls.

~$ v4l2-ctl -d /dev/video1 --all
Driver Info:
        Driver name      : uvcvideo
        Card type        : JBUDS CAM USB HD WEBCAM: JBUDS 
        Bus info         : usb-0000:06:00.4-2.3
        Driver version   : 5.15.46
        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            : JBUDS CAM USB HD WEBCAM: JBUDS 
        Serial           : 20211208004
        Bus info         : usb-0000:06:00.4-2.3
        Media version    : 5.15.46
        Hardware revision: 0x00001208 (4616)
        Driver version   : 5.15.46
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : JBUDS CAM USB HD WEBCAM: JBUDS 
        Function         : V4L2 I/O
        Flags            : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000010: from remote pad 0x100000a of entity 'Extension 3' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 1280/720
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 2560
        Size Image        : 1843200
        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 1280, Height 720
        Default     : Left 0, Top 0, Width 1280, Height 720
        Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 1280, Height 720, Flags: 
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 1280, Height 720, Flags: 
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 10.000 (10/1)
        Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=136 value=115
                       contrast 0x00980901 (int)    : min=0 max=95 step=1 default=28 value=44
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=36 value=46
                            hue 0x00980903 (int)    : min=-2000 max=2000 step=100 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=100 max=300 step=1 default=150 value=190
           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=2800 max=6500 step=1 default=4600 value=6500 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=100 step=1 default=5 value=5
         backlight_compensation 0x0098091c (int)    : min=0 max=200 step=5 default=50 value=50
                  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=8192 step=1 default=500 value=500 flags=inactive
                 focus_absolute 0x009a090a (int)    : min=0 max=255 step=1 default=0 value=0 flags=inactive
                     focus_auto 0x009a090c (bool)   : default=1 value=1
~$ v4l2-ctl -d /dev/video1 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'MJPG' (Motion-JPEG, compressed)
                Size: Discrete 640x480
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1920x1080
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1280x960
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 800x600
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1024x576
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 960x720
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
        [1]: 'YUYV' (YUYV 4:2:2)
                Size: Discrete 640x480
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                        Interval: Discrete 0.333s (3.000 fps)
                Size: Discrete 1920x1080
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1280x960
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 800x600
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                Size: Discrete 640x360
                        Interval: Discrete 0.033s (30.000 fps)
                        Interval: Discrete 0.040s (25.000 fps)
                        Interval: Discrete 0.050s (20.000 fps)
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 1024x576
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)
                Size: Discrete 960x720
                        Interval: Discrete 0.067s (15.000 fps)
                        Interval: Discrete 0.100s (10.000 fps)
                        Interval: Discrete 0.133s (7.500 fps)
                        Interval: Discrete 0.200s (5.000 fps)