Webcam, Linux, cheese, vlc, skype…

During the recent home office wave, I wanted to reactivate my webcam (Logitech Quickcam Chat, yes, it only has 176x144px but that’s fine for my use case). Of course, my laptop has an integrated webcam, but that’s about 75cm above and to the right of me – I’m having a „broker-type“ desk setup.

Problem is, the webcam is not recognized by Skype for Business (using the Citrix HDX RT Media Engine), cheese or Microsoft Teams for Linux.

I found the reason – those programs only support YUY2 color formats, while the webcam (and other solutions, like droidcam) supply other formats. Solution:

  1. Install v4l2loopback from git
  2. Create a loopback video device by loading the module
  3. Start a gstreamer pipline to convert the color space

For my quickcam chat, it looks like this:

gst-launch-1.0 -v v4l2src device=/dev/video2 ! video/x-bayer ! bayer2rgb ! videobalance saturation=0.8 ! videoconvert ! video/x-raw,format=YUY2 ! v4l2sink device=/dev/video4

/dev/video2 being the device of the webcam, /dev/video4 being the loopback device created earlier by loading the loopback module.

The loopback module has to be started with more than default buffers:

sudo modprobe v4l2loopback max_buffers=16

An example for droidcam (droidcam being /dev/video3):

gst-launch-1.0 -v v4l2src device=/dev/video3 ! smooth ! videoconvert ! video/x-raw,format=YUY2 ! v4l2sink device=/dev/video4