You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v4l2 Virtual camera - Loopback device conflicts (Including droidcam) #3929
Start OBS and click "Start Virtual Camera" button.
Additional information
The log says "warning: Failed to start virtual camera" when clicking on the button.
I've installed droidcam alongside OBS, and it currently uses the /dev/video0 device. I thought maybe obs is trying to use that device and it conflicts with droidcam, but disabling (not removing) droidcam doesn't solve the issue.
Edit:
I've tried removing droidcam, it turns out that they were indeed in conflict. Removing droidcam solves the issue, reinstalling it works fine, but as long as I reboot droidcam takes over /dev/video0 and I could not find any other ways than removin and reinstalling droidcam... every reboot.
It's solved in a way but that's not very practical.
Reacted by Samuel Guay, Denis LE, Daniel, Jochen, Michael Weibel, Maksim Lebedev, Vicente, MrAn0nym, Matthias Hryniszak, José Arthur Silveira and 8 more
changed the title [-]Virtual camera fails to start[/-][+]Virtual camera fails to start due to Droidcam (or maybe other v42l devices)[/+]on Dec 18, 2020
It seems the issue was that "modprobe v4l2loopback" assigned /dev/video99 to the virtual camera. Removing v4l2loopback and then manually assigning the next available number (in my case /dev/video2) resulting in the virtual camera working.
I wonder if there is a way to force OBS to use /dev/video99.
It seems the issue was that "modprobe v4l2loopback" assigned /dev/video99 to the virtual camera. Removing v4l2loopback and then manually assigning the next available number (in my case /dev/video2) resulting in the virtual camera working.
I wonder if there is a way to force OBS to use /dev/video99.
You wrote about a "modprobe v4l2loopback" and a /dev/video99, but you actually never mentioned them before, what did you mean?
I forgot that I had to run "modprobe v4l2loopback" in order for the "Start Virtual Camera" button to appear. Or at least, the button did not appear until after I ran that command. I found I had to run that command when experimenting with uninstalling and reinstalling v4l2loopback-dkms as well as OBS.
I forgot that I had to run "modprobe v4l2loopback" in order for the "Start Virtual Camera" button to appear. Or at least, the button did not appear until after I ran that command. I found I had to run that command when experimenting with uninstalling and reinstalling v4l2loopback-dkms as well as OBS.
I see. I've noticed something else: maybe it can be a issue with the propting for elevated rigths, 'cause without root access obs has no way to configure a new v4l2loopback device. So my guess is that obs can't prompt you for elevation, then it fails to register a new virtual camera and consequently fails to start it.
changed the title [-]Virtual camera fails to start due to Droidcam (or maybe other v42l devices)[/-][+]Virtual camera fails to start due to Droidcam (or maybe other v4l2loopback devices)[/+]on Dec 22, 2020
The third one is the one that OBS should use (it is not named "OBS Virtual Camera" because I created it in the modprobe conf file... Anyways I checked the OBS code and it seems that the name "OBS Virtual Camera" is never used elsewhere but in the function creating the v4l2loopback conf.).
The fourth one is easy to guess.
The last one is my physical camera.
And of course that order changes across reboots, as reported multiple times.
The problem seems that the code is checking the fact the v4l2loopback module is loaded, but I have no idea how it determines which device to actually use... I 'm guessing the first one.
I tried to use any of the virtual cameras to check if it was not outputing to the wrong virtual camera, but no... It just reports the virtual cam is started and issues no error, while it evidently doesn't work.
I am runnning Ubuntu 18.04 on this machine
OBS 26.1.0 (64)
FYI, with the previous OBS release I was using the obs-v4l2sink plugin and it was fully working (I removed everything regarding this plugin when I upgraded to this version of OBS).
I hope this helps as it's clearly a blocking issue, I am considering falling back, but would definitely prefer to have OBS virtual camera working with no plugin.
I think OBS should have a config flag to specify which virtual camera to use (it was the case with the plugin). Be it by path, by id, or by whatever is secondary. Even if with the plugin, it was painful to each time check if the /dev/videox used was the correct one after a reboot, it was not blocking at all, which it is now...
Reacted by Mike Peralta, Chicken Sandwich, Fabian and stephematician
I confirm that removing all virtual cameras is a workaround (clearly not a fix).
In my case I had to remove both akvcam and v4l2loopback_dc (the module used by Droidcam) modules and the the OBS virtual camera started working. But I insist this is no fix!
The real fix would be to provide a way to specify which v4l2 camera to use as virtual camera, like it was the case with the plugin it supercedes.
@topongo I suggest you modify the issue title once again to:
"Virtual camera fails to start due to the presence of any v4l2loopback device other than the one expected by OBS"
As it is confirmed, akvcam (which is another flavour of v4l2loopback) has to be removed as well...
A much better workaround until this is fixed is to actually continue using the obs-v4l2sink plugin which still allows selecting the relevant virtual camera to use.
Just tested with all modules I use actually loaded and it works (like with previous versions of OBS)...
I am afraid that, for that, you will have to have a look at their respective repos...
I am just a user in this case.
The point is both akvcam and droidcam use their own modules (akvcam for Webcamoid and v4l2loopback_dc for Droidcam) which are somehow derived from v4l2loopback but with at least the name differing... I guess this is what they use to target the correct devices.
In the case of OBS, as it relies on the generic v4l2loopback, I doubt something fully automated could be really achieved unless maybe only one device exists using that module. The best way is clearly to allow to specify which one to use in the OBS config, and to improve regarding the mechanism currently existing within the plugin, use something else than the /dev/videox to ensure consistency across reboots...
Maybe a possibility for something fully automated would be that OBS provides its own forked flavour of the v4l2loopback module to be able to rely on the module name, but honestly I think that this pathway should be avoided.
I'm currently using OBS compiled from source (OBS Studio - 26.1.0-15-g60fed63d6) on elementary (Ubuntu 18.04 base) with the droidcam plugin but not the v4l2loopback_dc. Compiled v4l2loopback myself and in /etc/modprobe.d I have a file v4l2loopback.conf with the following content:
I'm having the same issue. For me at least, it's that I can't select WHICH device to output to. My DSLR is a loopback device, and OBS 26 is overwriting it.
Previously, I could select which v4l2loopback device to output to. After updating to OBS 26, with the new "Start Virtual Camera", I can only output to the first v4l2loopback device. Is there a setting somewhere? How can I select the output path of the virtual camera?
Details:
I'm using a Canon DSLR to USB3 via g2photo & v4l2loopback. This is itself a v4l2loopback device. When I run "v4l2-ctl --list-devices", it lists two devices. I then use g2photo to send a stream from the camera to /dev/video0 . For OBS to detect the camera, it has to be running into a loopback device BEFORE OBS starts. The issue is that since I can't select where to send OBS virtual camera output path, it is overwriting the camera with the output. This is how I output OBS into something like Zoom. It was working fine with OBS 25.
Has the feature: "ability to select which v4l2loopback device" been overlooked?
Definitely, the ability to carry over the setting from the plugin to OBS 26 either isn't there or isn't working.
Reacted by Daniel, quantenProjects, Yann Salmon, Else, Someone and Levi
I am using OBS to do some filtering before using the stream in Microsoft Teams. My Pipeline looks like this:
/dev/video0 -> python opencv -> /dev/video12 -> obs -> /dev/video11 -> teams
I loaded the v4l2loopback module with the option below and had the same problems as described in this issue.
modprobe v4l2loopback devices=2 exclusive_caps=1 video_nr=11,12 card_label=obs,py
After some weeks I came back to this topic and by coincidence created the devices the other way around and the issue was gone.
modprobe v4l2loopback devices=2 exclusive_caps=1 video_nr=12,11 card_label=py,obs
Maybe someone can validate if it is a usefull workaround.
I do not know if my Problem is related but i get the following message from the logs:
10:11:53.177: NV12 texture support not available
10:11:53.177: P010 texture support not available
10:11:53.183: Failed to start virtual camera
There is also strange behavior around the install from my apt repository's and the Flatpack
After Starting the Flatpack will not show any virtual cam button.
The Apt installed version will and up on clicking i get a promt to enter a sudoers password.
After doing that in the apt version Flatpack suddenly shows the button for the virtual cam.
Both do not display anything.
Worked like a charm a few updates ago.
The Log data: obslog.txt
You can use the terminal alone to make virtual camera and you don't need to reboot your system after making any changes 1. Make sure you run as root@... in your terminal. $sudo su - 2. (Required) To remove previously loaded v4l2loopback kernel/module. Note: You can only load v4l2loopback once so we need to unload it but not uninstall $rmmod v4l2loopback Step 3. Run v4l2loopback as root sudo modprobe v4l2loopback 4. Create a new virtual camera named Your Cam Label here with custom path /dev/video69 modprobe v4l2loopback video_nr=69 card_label="Your Cam Label here" 5. Use ffmpeg for flushing the best video output. $ffmpeg -stream_loop -1 -i yourorig.mp4 -c copy tempvideofile.mp4
If you appreciate my answer, consider donate https://www.paypal.com/paypalme/cacansoft?country.x=PH&locale.x=en_US
For me, on Fedora 40, the virtual camera worked fine. After a system update it stopped working. After a long time trying to solve it and only seeing the message warning: Failed to start virtual camera in the OBS log without any other details, using sudo lsof | grep '/dev/video' I noticed that /dev/video0 was busy, then I discovered that stopping the v4l2-relayd service (sudo systemctl stop v4l2-relayd) made the OBS virtual camera work again!
For now I don't know what v4l2-relayd is for or if I need it.
My devices before and after start virtual camera:
$ v4l2-ctl --list-devices
Intel MIPI Camera (platform:v4l2loopback-000):
/dev/video0
For those following, here's what OBS does on Linux (in a nutshell) - I hope this helps identify workarounds:
On startup, OBS checks if the v4l2loopback kernel module is available.
Once you select Start Virtual Camera:
OBS checks if the module is loaded.
If the loopback module is not loaded, OBS will try the command modprobe v4l2loopback exclusive_caps=1 card_label='OBS Virtual Camera' (this is when it asks for your password).
The loopback module will create one node at /dev/video# where # is the first unused integer (starting at 0).
OBS searches through the files that start with /dev/video and grabs the first one that can set an output format. It searches in alpha-numerical order, e.g. /dev/video0, /dev/video1, ….
Crucially, OBS does not check if a node was actually spawned by v4l2loopback. It can output to any V4L2 (device) with output capabilities.
As noted in #12081, it doesn't even check that it was able to select the correct format and size - hence, I believe, what @6ffm70 sees: #3929 (comment). PR #12082 should apply better constraints on this.
It looks like the developers intended for OBS to only use v4l2loopback devices, but maybe this isn't the best option given that there are a number of loopback-like modules available on Linux (droidcam, akvcam, etc).
If there is scope to loosen that requirement, then I would support the user having control over which node is selected - along with a useful default (e.g. the current behaviour), along with an option to (attempt to) create a node with the v4l2loopback module if no output device is found.
How OBS checks if the kernel module is available
First it checks if it is loaded: It reads /proc/modules and searches for any substring match to v4l2loopback - so it can match to things like v4l2loopback_dc too - i.e. it can generate false positives.
If not loaded, it checks if it is available: It tests for errors running modinfo v4l2loopback, which is at least more specific.
The check on whether the module is loaded could (possibly) be replaced by looking at /dev/v4l2loopback instead, which has been available for some time.
When i try to start virtual camera obs goes into 0mb ram usage and i can't use the camera until after a reboot, this is the case for both the obs in my distro's repos (32.0.2 @ OpenMandirva ROME) and the flatpak version (32.1.2).
Activity
[-]Virtual camera fails to start[/-][+]Virtual camera fails to start due to Droidcam (or maybe other v42l devices)[/+]pardomi commentedon Dec 20, 2020
I am experiencing the same issue.
Platform
Operating system and version: Kubuntu 20.10
OBS Studio version: 26.1
Expected Behavior
Clicking on "Start Virtual Camera" button should start the virtual cam flawlessly
Current Behavior
Pressing the button does not create any effect. (button text remains "Start Virtual Camera")
Steps to Reproduce
Install obs-studio 26.1 from ppa:obsproject/obs-studio
Install v4l2loopback-dkms (previously installed)
Start OBS and click "Start Virtual Camera" button.
Additional information
Log File Contents
pardomi commentedon Dec 22, 2020
It seems the issue was that "modprobe v4l2loopback" assigned /dev/video99 to the virtual camera. Removing v4l2loopback and then manually assigning the next available number (in my case /dev/video2) resulting in the virtual camera working.
I wonder if there is a way to force OBS to use /dev/video99.
topongo commentedon Dec 22, 2020
You wrote about a "modprobe v4l2loopback" and a /dev/video99, but you actually never mentioned them before, what did you mean?
pardomi commentedon Dec 22, 2020
I forgot that I had to run "modprobe v4l2loopback" in order for the "Start Virtual Camera" button to appear. Or at least, the button did not appear until after I ran that command. I found I had to run that command when experimenting with uninstalling and reinstalling v4l2loopback-dkms as well as OBS.
topongo commentedon Dec 22, 2020
I see. I've noticed something else: maybe it can be a issue with the propting for elevated rigths, 'cause without root access obs has no way to configure a new v4l2loopback device. So my guess is that obs can't prompt you for elevation, then it fails to register a new virtual camera and consequently fails to start it.
[-]Virtual camera fails to start due to Droidcam (or maybe other v42l devices)[/-][+]Virtual camera fails to start due to Droidcam (or maybe other v4l2loopback devices)[/+]lbriais commentedon Dec 25, 2020
I have "almost" the same issue...
Although for me OBS reports that the virtual camera is actually started:
I can't see the output in any of the virtual cameras of my system.
The point is I have multiple "virtual" cameras already:
And of course that order changes across reboots, as reported multiple times.
The problem seems that the code is checking the fact the
v4l2loopbackmodule is loaded, but I have no idea how it determines which device to actually use... I 'm guessing the first one.I tried to use any of the virtual cameras to check if it was not outputing to the wrong virtual camera, but no... It just reports the virtual cam is started and issues no error, while it evidently doesn't work.
I am runnning Ubuntu 18.04 on this machine
OBS 26.1.0 (64)
FYI, with the previous OBS release I was using the obs-v4l2sink plugin and it was fully working (I removed everything regarding this plugin when I upgraded to this version of OBS).
I hope this helps as it's clearly a blocking issue, I am considering falling back, but would definitely prefer to have OBS virtual camera working with no plugin.
I think OBS should have a config flag to specify which virtual camera to use (it was the case with the plugin). Be it by path, by id, or by whatever is secondary. Even if with the plugin, it was painful to each time check if the
/dev/videoxused was the correct one after a reboot, it was not blocking at all, which it is now...mattboy9921 commentedon Dec 26, 2020
Using Arch - Rolling, OBS 26.1.0.r20. Can confirm, removing Droidcam and rebooting fixed my issue and Virtual Camera is working beautifully now.
lbriais commentedon Dec 26, 2020
I confirm that removing all virtual cameras is a workaround (clearly not a fix).
In my case I had to remove both
akvcamandv4l2loopback_dc(the module used by Droidcam) modules and the the OBS virtual camera started working. But I insist this is no fix!The real fix would be to provide a way to specify which v4l2 camera to use as virtual camera, like it was the case with the plugin it supercedes.
@topongo I suggest you modify the issue title once again to:
"Virtual camera fails to start due to the presence of any v4l2loopback device other than the one expected by OBS"
As it is confirmed,
akvcam(which is another flavour ofv4l2loopback) has to be removed as well...lbriais commentedon Dec 26, 2020
A much better workaround until this is fixed is to actually continue using the obs-v4l2sink plugin which still allows selecting the relevant virtual camera to use.
Just tested with all modules I use actually loaded and it works (like with previous versions of OBS)...
WizardCM commentedon Dec 26, 2020
Out of curiosity, how do akvcam and droidcam handle the mapping? Is there something we could be doing better automatically?
lbriais commentedon Dec 26, 2020
I am afraid that, for that, you will have to have a look at their respective repos...
I am just a user in this case.
The point is both akvcam and droidcam use their own modules (
akvcamfor Webcamoid andv4l2loopback_dcfor Droidcam) which are somehow derived fromv4l2loopbackbut with at least the name differing... I guess this is what they use to target the correct devices.In the case of OBS, as it relies on the generic
v4l2loopback, I doubt something fully automated could be really achieved unless maybe only one device exists using that module. The best way is clearly to allow to specify which one to use in the OBS config, and to improve regarding the mechanism currently existing within the plugin, use something else than the/dev/videoxto ensure consistency across reboots...Maybe a possibility for something fully automated would be that OBS provides its own forked flavour of the
v4l2loopbackmodule to be able to rely on the module name, but honestly I think that this pathway should be avoided.pokgak commentedon Dec 30, 2020
I'm currently using OBS compiled from source (OBS Studio - 26.1.0-15-g60fed63d6) on elementary (Ubuntu 18.04 base) with the droidcam plugin but not the
v4l2loopback_dc. Compiledv4l2loopbackmyself and in/etc/modprobe.dI have a filev4l2loopback.confwith the following content:Works perfectly for me.
JohnDeeBDD commentedon Dec 31, 2020
I'm having the same issue. For me at least, it's that I can't select WHICH device to output to. My DSLR is a loopback device, and OBS 26 is overwriting it.
Previously, I could select which v4l2loopback device to output to. After updating to OBS 26, with the new "Start Virtual Camera", I can only output to the first v4l2loopback device. Is there a setting somewhere? How can I select the output path of the virtual camera?
Details:
I'm using a Canon DSLR to USB3 via g2photo & v4l2loopback. This is itself a v4l2loopback device. When I run "v4l2-ctl --list-devices", it lists two devices. I then use g2photo to send a stream from the camera to /dev/video0 . For OBS to detect the camera, it has to be running into a loopback device BEFORE OBS starts. The issue is that since I can't select where to send OBS virtual camera output path, it is overwriting the camera with the output. This is how I output OBS into something like Zoom. It was working fine with OBS 25.
Has the feature: "ability to select which v4l2loopback device" been overlooked?
Definitely, the ability to carry over the setting from the plugin to OBS 26 either isn't there or isn't working.
32 remaining items
ickedude commentedon Sep 7, 2022
I am using OBS to do some filtering before using the stream in Microsoft Teams. My Pipeline looks like this:
/dev/video0 -> python opencv -> /dev/video12 -> obs -> /dev/video11 -> teams
I loaded the v4l2loopback module with the option below and had the same problems as described in this issue.
modprobe v4l2loopback devices=2 exclusive_caps=1 video_nr=11,12 card_label=obs,py
After some weeks I came back to this topic and by coincidence created the devices the other way around and the issue was gone.
modprobe v4l2loopback devices=2 exclusive_caps=1 video_nr=12,11 card_label=py,obs
Maybe someone can validate if it is a usefull workaround.
linux-v4l2: Update v4l2-output logic
linux-v4l2: Update v4l2-output logic
linux-v4l2: Update v4l2-output logic
linux-v4l2: Update v4l2-output logic
MrCybertux commentedon Feb 28, 2023
I do not know if my Problem is related but i get the following message from the logs:
There is also strange behavior around the install from my apt repository's and the Flatpack
After Starting the Flatpack will not show any virtual cam button.
The Apt installed version will and up on clicking i get a promt to enter a sudoers password.
After doing that in the apt version Flatpack suddenly shows the button for the virtual cam.
Both do not display anything.
Worked like a charm a few updates ago.
The Log data:
obslog.txt
linux-v4l2: Update v4l2-output logic
linux-v4l2: Update v4l2-output logic
heyakyra commentedon Jun 24, 2023
Sadly this doesn't appear to work on Fedora Silverblue due to coreos/rpm-ostree#1091 (comment)
Is there another workaround that would be compatible?
linux-v4l2: Update v4l2-output logic
Cyanic commentedon May 15, 2024
Foung a solution here: https://obsproject.com/forum/threads/huge-amount-of-error-logs-when-camera-doesnt-return-framerate.145191/
mhagnumdw commentedon Sep 16, 2024
For me, on Fedora 40, the virtual camera worked fine. After a system update it stopped working. After a long time trying to solve it and only seeing the message
warning: Failed to start virtual camerain the OBS log without any other details, usingsudo lsof | grep '/dev/video'I noticed that/dev/video0was busy, then I discovered that stopping thev4l2-relaydservice (sudo systemctl stop v4l2-relayd) made the OBS virtual camera work again!For now I don't know what v4l2-relayd is for or if I need it.
My devices before and after start virtual camera:
stephematician commentedon May 20, 2025
For those following, here's what OBS does on Linux (in a nutshell) - I hope this helps identify workarounds:
Start Virtual Camera:modprobe v4l2loopback exclusive_caps=1 card_label='OBS Virtual Camera'(this is when it asks for your password)./dev/video#where#is the first unused integer (starting at 0)./dev/videoand grabs the first one that can set an output format. It searches in alpha-numerical order, e.g./dev/video0,/dev/video1, ….Crucially, OBS does not check if a node was actually spawned by v4l2loopback. It can output to any V4L2 (device) with output capabilities.
As noted in #12081, it doesn't even check that it was able to select the correct format and size - hence, I believe, what @6ffm70 sees: #3929 (comment). PR #12082 should apply better constraints on this.
It looks like the developers intended for OBS to only use v4l2loopback devices, but maybe this isn't the best option given that there are a number of loopback-like modules available on Linux (droidcam, akvcam, etc).
If there is scope to loosen that requirement, then I would support the user having control over which node is selected - along with a useful default (e.g. the current behaviour), along with an option to (attempt to) create a node with the v4l2loopback module if no output device is found.
How OBS checks if the kernel module is available
First it checks if it is loaded: It reads
/proc/modulesand searches for any substring match tov4l2loopback- so it can match to things like v4l2loopback_dc too - i.e. it can generate false positives.If not loaded, it checks if it is available: It tests for errors running
modinfo v4l2loopback, which is at least more specific.The check on whether the module is loaded could (possibly) be replaced by looking at
/dev/v4l2loopbackinstead, which has been available for some time.Humam-Hamdan commentedon Jul 4, 2026
When i try to start virtual camera obs goes into 0mb ram usage and i can't use the camera until after a reboot, this is the case for both the obs in my distro's repos (32.0.2 @ OpenMandirva ROME) and the flatpak version (32.1.2).
stephematician commentedon Jul 12, 2026
@Humam-Hamdan - that seems more like a user support request? Have you tried the forums: https://obsproject.com/forum/list/linux-support.34/