Repository navigation
Description
Operating System Info
Ubuntu 21.04
Other OS
No response
OBS Studio Version
27.0.0
OBS Studio Version (Other)
No response
OBS Studio Log URL
OBS Studio Crash Log URL
No response
Expected Behavior
I should be able to toggle Virtual Camera on and off.
Current Behavior
I'm able to start and stop Virtual Camera one time. After that, it will not start again until my next reboot. Each click on the "Start Virtual Camera" button inserts a single line of text into the log:
04:00:54 PM.094: Failed to start virtual camera
Steps to Reproduce
- Reboot
- Launch OBS
- Click "Start Virtual Camera"
- Click "Stop Virtual Camera"
- Click "Start Virtual Camera". The button text remains the same ("Start Virtual Camera") and the VC is never started.
Anything else we should know?
This began happening immediately after an OS upgrade from Ubuntu 20.10 to 21.04. Things worked fine in Ubuntu 20.10 using the same version of OBS (27.0.0).
The attached log shows me launching OBS immediately after a reboot.
I click to start the virtual camera.
I enter my sudo pw.
I click to stop the virtual camera.
So far so good.
I click to start the virtual camera - three times - and all three times result in failure and an error message in the log: "Failed to start virtual camera."
The output of v4l2-ctl --list-devices immediately after reboot:
UVC Camera (046d:0821) (usb-0000:00:14.0-8.4):
/dev/video4
/dev/video5
Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-9):
/dev/video0
/dev/video1
/dev/video2
/dev/video3
The output of v4l2-ctl --list-devices after I've tried and failed to get the Virtual Camera to start:
OBS Virtual Camera (platform:v4l2loopback-000):
/dev/video6
UVC Camera (046d:0821) (usb-0000:00:14.0-8.4):
/dev/video4
/dev/video5
Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-9):
/dev/video0
/dev/video1
/dev/video2
/dev/video3
This is on a Dell XPS 13 laptop, model 9300. If it matters, I'm not using the integrated webcam, I'm using Logitech C910 USB cam.
Activity
bmn001 commentedon Jun 4, 2021
If I quit OBS, then remove the modprobe rule with:
sudo modprobe -r v4l2loopbackI'm able to restart OBS and launch the Virtual Camera successfully (without rebooting) - but again, only one time.
troyhitch commentedon Jun 4, 2021
Hi, for what it's worth, I'm experiencing the exact same thing having updated to 21.04 earlier today. I have been able to reliably restart the VC after a reboot. And I've been able to successfully restart it after killing OBS and running
sudo modprobe -r v4l2loopbackper above and have been able to do it more than once.ajrabassa commentedon Jun 10, 2021
Reporting the same issue, with the exact modprobe solution. Problem started after upgrade from Ubuntu 20.10 to Ubuntu 21.04.
System info:
OS: Ubuntu 21.04
Apt package: obs-studio/hirsute,hirsute,now 27.0.0-0obsproject1~hirsute amd64
Version: OBS Studio 27.0.0 (64 bit)
bmn001 commentedon Jun 12, 2021
OBS 27.0.1 came out today and the issue is still there.
jbrains commentedon Jul 2, 2021
I have the same problem on Pop!_OS 21.04 and the workaround of
sudo modprobe -r v4l2loopbackworks as well for me as the others have described.I built from source just now (commit 16a49eb) and the problem persists.
I also went back to build 26.1 from source (commit 38ad3ba) and the problem persists there.
I wish I had more to offer.
WebrangerC commentedon Aug 11, 2021
Same issue with 21.04 and OBS 27.0.1
pmichaud commentedon Aug 21, 2021
[Edit after post: Swapped "OUTPUT" and "CAPTURE" to correctly identify the capabilities. --Pm]
On my system, the problem appears to be related to the "exclusive_caps=1" option of the v4l2loopback module.
If I remove "exclusive_caps=1" from whatever is creating the virtual camera device, then obs is able to start / stop / restart the virtual camera with no difficulty, both within a single obs-studio invocation and across multiple invocations.
Unfortunately, removing "exclusive_caps=1" means that the v4l2loopback output device is no longer accessible by Chrome and some other programs. The version of Zoom that I have still works -- it finds the virtual device just fine -- but Chrome no longer finds it.
If I understand correctly, exclusive_caps=1 tells v4loopback to start the virtual device in "OUTPUT" capabilities (so that programs such as Chrome won't find it), then switch to "CAPTURE only" capabilities once something like obs starts sending data to the virtual device. However, when the data stream stops, the virtual device remains in "CAPTURE only" mode and I think this prevents OBS from either finding or re-opening the device on second and subsequent attempts. The only reliable solution is to restart the virtual device altogether, either via a reboot or a rmmod/modprobe of the device as mentioned by others above.
Ideally I think the virtual device should reset itself to advertising OUTPUT capabilities when it no longer has an active input data stream -- but that would be a fix to v4l2loopback instead of obs. Alternatively, obs should find/open the device for streaming even if it's not currently advertising OUTPUT capabilities.
Hope this helps point the way to a solution.
Pm
pmichaud commentedon Aug 21, 2021
To follow-up a bit on my previous post: If I set up the loopback device without "exclusive_caps=1", then "v4l2-ctl -d /dev/video0 --all" gives me the following output:
This part of the output remains the same no matter how many times "Start Virtual Camera" and "Stop Virtual Camera" are selected. Zoom recognizes the virtual loopback device just fine, but Chrome does not find it.
If I add "exclusive_caps=1" when loading the virtual device via modprobe, the device initially appears as follows:
Once I hit "Start Virtual Camera" in OBS, the device settings change to:
Stopping the Virtual Camera in OBS (or exiting OBS) results in:
Note that the video device no longer advertises either output or capture capabilities. As a result, OBS won't or can't re-open the device to restart the loopback video stream.
So this looks to me like something that needs to be fixed within v4l2loopback.
Pm
WebrangerC commentedon Sep 10, 2021
@pmichaud THANK YOU.
I haven't duplicated/verified the exclusive_caps BUT using modprobe to re-initialize:
works well for Zoom, even if Zoom has been started and I wanted to switch to using OBS.
prasket commentedon Oct 1, 2021
I was having this issue as well using POP_OS and 27.1.0 but the modprobe was my hotfix. I just one of my machine using Debian Stable and I just built OBS 27.1.1 and the start/stop of the virtual camera appears to be working just fine.
bmn001 commentedon Oct 5, 2021
Just tested OBS 27.1.3 and it looks like the issue is still there.
cmcqueen commentedon Oct 5, 2021
It looks to be a bug in the
v4l2loopbackkernel driver. The issue isn't really in OBS, of any version.bmn001 commentedon Oct 6, 2021
Right you are. Looks like a v4l2loopback bug referencing this one has been filed. v4l2loopback/v4l2loopback#442
bmn001 commentedon Oct 6, 2021
I found a fix for now.
The version of v4l2loopback included with Ubuntu 20.04 is apparently no good. You've got to manually install the latest version.
Download the latest .deb from https://packages.ubuntu.com/groovy/all/v4l2loopback-dkms/download
Install it:
sudo dpkg -i v4l2loopback-dkms_0.12.5-1_all.debThis will replace v4l2loopback version
0.12.5-1ubuntu1with0.12.5-1. I guess this is technically a downgrade, according to the dpkg output...After that, Virtual Camera will work as expected. You can toggle it on and off to your heart's content.
So here's the weird thing - doing an apt upgrade after this point will reverse what you've done and put you back on
0.12.5-1ubuntu1, however Virtual Camera will continue to work properly. EDIT- This only lasted until a reboot. I had to roll back again.62 remaining items
linux-v4l2: Send STREAMON/STREAMOFF on vcam start/stop
linux-v4l2: Send STREAMON/STREAMOFF on vcam start/stop
stephematician commentedon Jan 31, 2025
The fix that was added, fca624e, is very non-compliant with the V4L2 UAPI. The STREAMON that OBS uses will (and should) fail; see the expected return codes from the V4L2 UAPI 7.55. ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF:
I am in the process of hardening v4l2-loopback's compliance with the V4L2 UAPI - and this will return the EINVAL - breaking this fix. Currently, the PR is in draft: v4l2loopback/v4l2loopback#611 - so there is plenty of time to consider a new fix, as it takes time for everything to downstream.
Luckily, the fix should be simple: remove the STREAMON and STREAMOFF when v4l2loopback version is greater than 0.13.2 (might have to get the version from
modinfo v4l2loopback --field=versionsomehow).kkartaltepe commentedon Jan 31, 2025
PRs are welcome, but you should probably make v4l2loopback report its version via the v4l2 api since modinfo is not going to be available on all platforms or even correct since users can update the on disk modules without restarting or reloading.
stephematician commentedon Jan 31, 2025
I'm not aware of a mechanism within the V4L2 API for reporting module version information - and I'm not an OBS expert so I can't say much about which platforms you support that do have v4l2loopback but don't have modinfo (or kmod). The best I can think of is a kludge via VIDIOC_G_CTRL with one control for each of the version numbers; but that's not what controls are meant for.
I'll put up a PR and then the discussion can be moved there.
kkartaltepe commentedon Feb 1, 2025
We only have two supported platforms, flatpak and ubuntu. You can take your guess at which one i'm referring to. Though as a kernel module developer id assume you were aware of the issues folks run into with managing installed and running kernel versions and modules and how tricky it can be.
Last I used v4l2-info it provided a very convenient location for drivers to report their version information. Perhaps you can use that instead of a kludge.
stephematician commentedon Feb 1, 2025
I wish I was! Thanks for the help. I had another thought about using sysfs to report the version, that way the user doesn't need v4l-utils, but perhaps your approach is easier to implement. I'll get back to this once the v4l2-loopback PR is close.
cmosetick commentedon Aug 7, 2025
This issue has returned.
Can we get it re-opened @kkartaltepe @stephematician ?
Flatpak OBS version 31.1.2
I've found this on 2 different machines with different Linux Kernel versions:
5.15
6.8
Only way to resolve without a full reboot is:
sudo modprobe -r v4l2loopbackAnalysis
On system boot you get:
Launch the virtual camera in v31.1.2 and then you get a
/dev/video4If you stop the virtual camera now, the next time that you launch it via OBS, you will get errors:
Fix without a full reboot
sudo modprobe -r v4l2loopbackThis command will remove
/dev/video4And now the virtual camera will start again without a full reboot.
Note that simply doing a
sudo rm /dev/video4will not resolve.The module reload seems required and should be resolved.
stephematician commentedon Aug 8, 2025
@cmosetick I would try the forums for support (I'm checking there as often as I can) as this may not be an issue with OBS and there's a lot of detail about your system and use case is missing (NOTE: the kernel version is almost irrelevant, because v4l2loopback is an out-of-tree module).
Also NOTE: The command
rm /dev/video4is definitely not a solution, and I would advise against anyone using anrmcommand on any contents of the/devfolder unless they have a really specific reason for doing so.jbrains commentedon Aug 8, 2025
FWIW, I experienced this problem before, but I don't experience it now. Here is what I can repeatably do:
v4l2loopback.v4l2loopbackand I see a new video device in/dev./dev.My kernel is 6.12.10.
I hope this information helps somehow. I second @stephematician 's suggestion to move this into the forum. Post a link here to the thread when you do.
Atom02 commentedon Aug 28, 2025
ye it is comming back and the only "work around" is to run sudo modprobe -r v4l2loopback everytime i want to start virtual camera
mrbarletta commentedon Apr 1, 2026
Its happening in Ubuntu 24.04 with version 32.1.0
zDEFz commentedon Apr 3, 2026
Yea, you can absolutely fix it manually.
Not sure why this issue is closed
stephematician commentedon Apr 3, 2026
@zDEFz it's closed because it was closed - there's a new issue because it's failing for a different reason now, see: #12506. Generally speaking it's because some distributions are still using older v4l2loopback. @mrbarletta - if you can install a newer version of v4l2loopback, that would likely resolve the issue.
linux-v4l2: Send STREAMON/STREAMOFF on vcam start/stop