v4l2loopback device detected by Chrome, not seen by Zoom or Firefox

Viewed 4821

I am trying to create a loopback device from my webcam to be accessible from both Zoom and a browser. I created three v4l2loopback devices:

sudo modprobe v4l2loopback devices=3 video_nr=10,11,12 card_label="Loopback_1","Loopback_2","Virtual_cam" exclusive_caps=1,1,0

followed by:

ffmpeg -i /dev/video0 -f v4l2 -vcodec rawvideo -pix_fmt yuv420p /dev/video10 -f v4l2 /dev/video11

Both devices are detected by Chrome, yet not seen by either Zoom nor Firefox. Following advice on other questions on stackoverflow I tried setting the device properties using v4l2loopback-ctl, using v4l2loopback-ctl set-caps "video/x-raw,format=UYVY,width=640,height=480" /dev/video10, and got in response:

Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video10' is not a output device. Additional debug info: v4l2_calls.c(636): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Capabilities: 0x85208000 Setting pipeline to NULL ... Freeing pipeline ... output to /dev/video10 failed

I also tried using gst-launch-1.0:

gst-launch-1.0 v4l2src device=/dev/video0 ! v4l2sink device=/dev/video10

which tells me that /dev/video10 is not an output device:

Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video10' is not a output device. Additional debug info: v4l2_calls.c(636): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Capabilities: 0x85208000 Setting pipeline to NULL ... Freeing pipeline ...

I am running Xubuntu 20.04, kernel version 5.4.0-52-generic, with v4l2loopback-dkms v.0.12.3-1ubuntu0.1, and v4l2loopback-utils.

My goal here is to get a device to be consumed by a desktop Node.js server which will open up a web app using xdg-open (thus the need for both Chrome AND Firefox), which will output a processed videostream that could be consumed by a video chat app, such as Zoom or Jitsi.

Any help will be greatly appreciated.

2 Answers

I just found in this post comment[1], shortly it was about this buggy version:

v.0.12.3-1ubuntu0.1

Then, I opened the link[2], found ppa repositories here[3], run this command:

sudo add-apt-repository ppa:smb/focal

sudo apt upgrade v4l2loopback-dkms

It will upgrade v4l2loopback to v.0.12.3-1ubuntu0.2 version, or just wait on the next software update.

I have tried these method and worked on my zoom client app.

PS: Just run sudo modprobe v4l2loopback , if the file in /etc/modprobe.d/v4l2loopback.conf configured like this:

options v4l2loopback devices=3 video_nr=10,11,12 card_label="Loopback_1","Loopback_2","Virtual_cam" exclusive_caps=1,1,0

To stop, run sudo modprobe -r v4l2loopback. Of course v4l2loopback devices can be checked by v4l2-ctl --list-devices

Reference link:

[1] V4l2 video device suddenly gone from zoom, teams, but ffplay can show it

[2] https://bugs.launchpad.net/ubuntu/+source/v4l2loopback/+bug/1901491

[3] https://launchpad.net/~smb/+archive/ubuntu/focal

[4] https://github.com/umlaeute/v4l2loopback/issues/274

TL;DR

Downgrade to v4l2loopback-dkms 0.12.3-1. Don't upgrade until version 0.12.5-1.

Downgrade v4l2loopback-dkms

$ sudo apt install v4l2loopback-dkms=0.12.3-1

Lock it

This will prevent any upgrade of this pacakge

$ sudo apt-mark hold v4l2loopback-dkms

When the fixed 0.12.5-1 version will be available, unlock this package:

$ sudo apt-mark unhold v4l2loopback-dkms

Details

From the Launchpad Bug:

Impact: The attempt to properly fix the warnings caused by the module in 0.12.3-1ubuntu0.1 caused any other application than Chromium to no longer detect available loopback devices. The tested capability was only set in the capabilities set, but not in the device_caps set.

Fix: The patch was modified to change the IOCTL code as it was done in v4l2loopback 0.12.5-1. This, probably contrary to what the kernel developers tried to achieve, works around the restrictions by additionally modifying the video device capabilities which the tests do check against.

Testcase: Now tested with OBS v4l2sink connected (and exclusive_caps set) against Chromium and Firefox. With 0.12.3-1ubuntu0.1 only Chromium would find the loopback camera but with the proposed update both Chromium and Firefox would work for me. And still no warnings.

Regression Potential: Essentially the difference to the released version is that with exclusive_caps set, then device_caps of the video device change. Which could throw off anything checking there and not expecting any change. On the positive side, this is now exactly the behavior that is exposed in 20.10/Groovy.

After the upgrade from 0.12.3-1 to 0.12.3-1ubuntu0.1 devices created using v4l2loopback are no longer available for use in applications (e.g. MS Teams and Zoom). With version 0.12.3-1 the devices would show up, e.g. modprobe v4l2loopback video nr=2 card label="test" would cause the new device to show up in those UIs as "test". With version 0.12.3-1ubuntu0.1 device "test" is no longer shown. Downgrading to 0.12.3-1 fixes the problem.

Related