# New Virtual Cam - choose device?



## wenger.simon (Jan 23, 2021)

I use Iriun Webcam and OBS. Both write to the same video device, the output is a flickering mix of both streams. Is there a way to choose a different /dev/video device for the two applications?
I have a modprobe.d/iriunwebcam.config file, and I tried adding a second device (in v4l2loopback) there. But OBS will always choose the same device as Iriun.
I know there was the option to choose the /dev/video in the old VC plugin. Is this also possible in the newly integrated Virtual Cam function?
(System Ubuntu 20.10
AFAIK log and video devices list doesn't make sense in this case.)

Thanks!
Simon


----------



## Producer John (Jan 24, 2021)

You actually got the VC to show up? I followed the plugin install directions, and no V4L2 or Virtual Cam options present themselves in the tools section. I also have Iriun, and Droidcam, installed. I have been toying with obs, trying to learn abit. Tried connecting 2 cells as webcams and got the same flicker (switching from cam to cam) as you mention on your output. Sounds as if V4L2 can only handle one device at a time. Enough to give me a migraine, and give the wall a few holes where my head hit it.


----------



## wenger.simon (Jan 24, 2021)

Producer John said:


> You actually got the VC to show up? I followed the plugin install directions, and no V4L2 or Virtual Cam options present themselves in the tools section. I also have Iriun, and Droidcam, installed. I have been toying with obs, trying to learn abit. Tried connecting 2 cells as webcams and got the same flicker (switching from cam to cam) as you mention on your output. Sounds as if V4L2 can only handle one device at a time. Enough to give me a migraine, and give the wall a few holes where my head hit it.


The new version of OBS has the virtual cam integrated as function. No need for a plugin. And it works nicely i.e. streaming local to vlc.




v4l2 must be capable of multiple devices as it has a devices=x option.


----------



## Producer John (Jan 24, 2021)

Mine doesn't have that option. :(  Should I uninstall, reinstall?


----------



## Tuna (Jan 25, 2021)

Producer John said:


> Mine doesn't have that option. :(  Should I uninstall, reinstall?


Make sure you have the applications "modinfo" and "pkexec" in you path. OBS requires them to even show the Virtual Cam button.



wenger.simon said:


> But OBS will always choose the same device as Iriun.


Looking at the code it looks like OBS will iterate over /dev/videoX devices and use the first one available. So if you can tell Iriun to select another this is probably the way to go.


----------



## wenger.simon (Jan 25, 2021)

Thanks, Tuna!
I have asked in a Linux Multimedia Forum if there is a way to start Iriun on another device, waiting for replies.
Unfortunately Iriun is hard to reach, no customer service, no FAQ, forum or even contact.
I take it, there is no way then, to change the setting in OBS (without compiling myself)?
I will post here, if I find a solution.


----------



## Producer John (Jan 26, 2021)

Good luck Simon. I eagerly await your solve ;-)


----------



## teilnehmer (Jan 26, 2021)

Tuna said:


> Make sure you have the applications "modinfo" and "pkexec" in you path. OBS requires them to even show the Virtual Cam button.



Hi Tuna, I was combing through the web to understand why my 26.1.1 version doesn't have the button. Glad I found your post!
I'm on a Linux Mint machine.
I've added the official repository and installed OBS Studio as advised in the official install instructions. I also have pkexec and modinfo installed.

```
janp@jan-aorus:~$ which pkexec
/usr/bin/pkexec
janp@jan-aorus:~$ which modinfo
/sbin/modinfo
```

Alas, I don't have the button. I don't know what you mean by needing those two tools "in my path". Would I have to copy them somewhere?

EDIT: Nevermind, I figured it out! Even with the out of the box functionality, OBS still nees the v4l2loopback package installed. 
Wanderer, in case you've found your way here, I did


> sudo apt-get install v4l2loopback-dkms



I then did a 


> sudo modprobe v4l2loopback


but must admit I'm not entirely sure if that was necessary. But now it works.


----------



## Producer John (Jan 28, 2021)

Tuna said:


> Looking at the code it looks like OBS will iterate over /dev/videoX devices and use the first one available. So if you can tell Iriun to select another this is probably the way to go.



Unless I find some Linux coding help, i'm just screwed. The more I read up on Video4linux, the more my head hurts. I feel an answer is here, I just can't grasp it.


----------



## mcpinto (Apr 22, 2021)

wenger.simon said:


> I use Iriun Webcam and OBS. Both write to the same video device, the output is a flickering mix of both streams. Is there a way to choose a different /dev/video device for the two applications?
> I have a modprobe.d/iriunwebcam.config file, and I tried adding a second device (in v4l2loopback) there. But OBS will always choose the same device as Iriun.


Hi Simon.

I've installed Iriun Webcam today in my Ubuntu and I've had the same problem here.

Good news: I've managed to fix it using 2 devices for v4l2loopback. Here is how I did:

1. Edit (using sudo) the file /etc/modprobe.d/iriunwebcam-options.conf
#
options v4l2loopback exclusive_caps=1 *devices=2 video_nr=8,9 card_label="OBS Virtualcam,Iriun Webcam"*
options snd-aloop index=1 

Note: Don't change the number at snd-aloop line: it is specific to your system (in my case it is 1). Watch for video_nr numbers. Be sure you are not using one already in use (check it --- no need for sudo --- in terminal: v4l2-ctl --list-devices)

2. Edit (using sudo) the file /etc/modules-load.d/iriunwebcam.conf
# 
v4l2loopback
*options v4l2loopback video_nr=8,9
options v4l2loopback card_label="OBS Virtualcam,Iriun Webcam"*
snd-aloop

Note: Use the same parameters as in the previous file for video_nr and card_label (not sure if it is mandatory, I've not checked this). This file ensures that Ubuntu will load these two virtual video devices at startup.

3. I'm not sure if the next (and final) step is needed or just a system reboot is good enough. But before rebooting Ubuntu, I did in terminal:
sudo update-initramfs -u

After reboot, both Iriun Webcam and OBS Virtualcam are visible in the system and do not interfere with each other (I've used the Iriun Webcam as a source in OBS Studio and the OBS Virtualcam as video device for MS Teams and G Meet).

The references for this solution started at https://stackoverflow.com/questions...back-devices-with-their-individual-properties

Hope it works for you!


----------



## wenger.simon (Apr 22, 2021)

Thanks mcpinto for your reply!
I applied those config's (using the same numbers). But both Iriun and OBS connect to /dev/video8. I was at this point before. How on earth do you tell either of those programs to use a specific (that is 'the other') device? I was searching for an option in both programs in vain. Did you do anything specific?
Both devices are available in the system.

Side Comment: I did not have the snd-aloop module enabled in either file. Finally I have sound in Iriun :-) (but the quality atm is atrocious... No time to look into this right now, though.)


----------

