[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#977928: obs-studio: virtual camera not working, modinfo not in path



On Sat, 26 Dec 2020 15:00:38 -0500, Reinhard Tartler wrote:

> Hi Gregor,

Hi Reinhard,
 
> I've applied your patch to our git branch, I think it looks good.

Thank you (and sorry for the late reply).

There may or may not be a second place which might need a similar
change:

plugins/linux-v4l2/v4l2-output.c

    53  static int loopback_module_load()
    54  {
    55          return system(
    56                  "pkexec modprobe v4l2loopback exclusive_caps=1 card_label='OBS Virtual Camera' && sleep 0.5");
    57  }
    58

But that's just a guess, I don't know how pkexec tries to find
modprobe (and I don't have policykit-1 installed and can't test this
codepath)
 
> > The whole virtualcam support currently is a bit fragile (trying to
> > load kernel modules, always using the first of potentially several
> > /dev/video* devices … I wonder if a README would make sense, and I'd
> > be happy to provide a draft.
> I think that'd make a lot of sense, I'm not that familiar with this package.
> I'm happy to look over your draft and apply it with or without
> modifications :-)

Ok, let's try :)
Here are some notes or fragments -- feel free to change/use/… as you
see fit:

Since version 26.1.0+dfsg1-1, obs(1) has support for Virtual Camera
output. This means that it can not only stream or record but also
send the video to a loopback video device (/dev/videoXX) which can
then be used like a "real" webcam in video applications or WebRTC
video conference software.

For the Virtual Camera support the v4l2loopback-dkms package needs to
be installed. In theory this is enough to add a "Start Virtual
Camera" button to the interface; in practice things can go wrong, or
you might want to have more control over the whole process.

In general, if the feature doesn't work, start obs(1) in a terminal,
and it will output helpful diagnostic messages.

The feature is only enabled when obs(1) finds the v4l2loopback kernel
module installed at startup time. This should be guaranteed by having
the v4l2loopback-dkms package installed.

If the kernel module is not loaded, obs(1) will try to do so. For
that purpose it uses pkexec(1) from the policykit-1 package.

But you can also load the module yourself, with root privileges:
- Manually once with
  modprobe v4l2loopback exclusive_caps=1 card_label='OBS Virtual Camera'
- Or you can add 'v4l2loopback' to /etc/modules and
  options v4l2loopback exclusive_caps=1 card_label='OBS Virtual Camera'
  to a file like /etc/modprobe.d/v4l2loopback.conf, then the module
  will be loaded at boottime.

When you want to control which device is created, you can add e.g.
  video_nr=17
the the module options, which will create a /dev/video17 device.

obs(1) will always output to the first loopback video device it finds
(this might become configurable in the future). So if you have more
than one for other purposes make sure to list the one for obs(1)
first in the module options, e.g.
  options v4l2loopback devices=2 video_nr=23,42 card_label="OBS Virtual Camera,Some Other Cam" exclusive_caps=1,1
This will create /dev/video23 and /dev/video42 and give them nice
labels, and obs(1) will use the first one with the correct name.

(Cf. also /usr/share/doc/v4l2loopback-dkms/README.md.gz)



Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   NP: Leonard Cohen: Please Don't Pass Me By (A Disgrace)

Attachment: signature.asc
Description: Digital Signature


Reply to: