Package: linux
Version: 6.12.96+deb13-amd64
Control: affects -1 pipewire
Severity: wishlist


The hardware of the tested USB camera is as follows:
# lsusb -v -d 046d:092f | egrep -i "idProduct|idVendor"
  idVendor           0x046d Logitech, Inc.
  idProduct          0x092f QuickCam Express Plus

Windows 11 says it's “Logitech Quickcam Express/Go”.

The camera is handled by the gspca_spca561 driver:

# readlink -f /sys/class/video4linux/video1/device/driver
/sys/bus/usb/drivers/spca561


Problem: The driver exposes only S561 (320×240 and 352×288) and GBRG (160×120 
and 176×144) formats:


$ v4l2-ctl -d /dev/video1 --all --list-formats-ext
Driver Info:
        Driver name      : spca561
        Card type        : Camera
        Bus info         : usb-0000:00:14.0-5.1
        Driver version   : 6.12.96
        Capabilities     : 0x85200001
                Video Capture
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x05200001
                Video Capture
                Read/Write
                Streaming
                Extended Pix Format
Priority: 2
Video input : 0 (spca561: ok)
Format Video Capture:
        Width/Height      : 352/288
        Pixel Format      : 'S561' (GSPCA SPCA561)
        Field             : None
        Bytes per Line    : 352
        Size Image        : 50688
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
Streaming Parameters Video Capture:
        Frames per second: invalid (0/0)
        Read buffers     : 2
User Controls brightness 0x00980900 (int) : min=-128 max=127 step=1 default=0 value=0 flags=slider
                            hue 0x00980903 (int)    : min=1 max=127 step=1 
default=64 value=64 flags=slider
                       exposure 0x00980911 (int)    : min=1 max=2372 step=1 
default=700 value=700
                           gain 0x00980913 (int)    : min=0 max=255 step=1 
default=63 value=70
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture
[0]: 'S561' (GSPCA SPCA561, compressed)
                Size: Discrete 320x240
                Size: Discrete 352x288
        [1]: 'GBRG' (8-bit Bayer GBGB/RGRG)
                Size: Discrete 160x120
                Size: Discrete 176x144


Modern PipeWire camera applications cannot use the camera directly. Snapshot 
doesn't detect the camera, and Firefox and Chromium see the camera but cannot 
obtain a usable video stream.

The only workaround known to me is a cumbersome multistep process requiring 
root privileges:
1) Determine the /dev/video… device corresponding to the camera from the output 
of `v4l2-ctl --list-devices`. In our test, this is /dev/video1, and it's 
subject to change (say, at boot or when re-plugging).
2) Create a loopback device:
   $ sudo modprobe -r v4l2loopback
   $ sudo modprobe v4l2loopback video_nr=10 card_label="QuickCam Express 
(converted)" exclusive_caps=1
3) Convert the stream and feed it into the loopback device in a new xterm:
   $ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4l/v4l2convert.so ffmpeg -f v4l2 
-video_size 352x288 -i /dev/video1 -f v4l2 /dev/video10
   Keep the process running as long as you need the camera (to quit, hit “q”). 
The maximal resolution was taken from the output of `v4l2-ctl -d /dev/video1 
--list-formats-ext`.
4) Restart PipeWire components:
   $ systemctl --user restart pipewire pipewire-pulse wireplumber
5) Applications can then use the virtual camera exposed through /dev/video10. 
Tests:
   $ snapshot
   $ ffplay -f v4l2 /dev/video10
   $ firefox https://webcamtests.com
   $ chromium 
https://webrtc.github.io/samples/src/content/getusermedia/resolution

Wish:
Please consider exposing at least one commonly supported standard V4L2 pixel 
format in addition to the existing S561 and GBRG formats. Examples include YUYV 
or another standard format directly usable by modern PipeWire/WebRTC camera 
applications. This would allow the camera to be used directly by applications 
such as Snapshot, Firefox, and Chromium without requiring an ffmpeg + 
v4l2loopback conversion pipeline.

Reply via email to