OBS Studio and v4l2loopback

I am getting into troubles with OBS Studio. I need to create a virtual cam for virtual classrooms. I installed OBS Studio with dnf as well as v4l2loopback and v4l2sink. I gor this error:

device open failed

Trying to load v4l2loopback, i got:

modprobe: ERROR: could not insert ‘v4l2loopback’: Exec format error
As I issued sudo modprobe v4l2sink, i got:

modprobe: FATAL: Module v4l2sink not found in directory /lib/modules/5.9.16-100.fc32.x86_64

Output of dmesg is at:UNTITLED - Pastebin Service

I think it was expected that v4l2sink woud be at /lib/modules/5.9.16-100.fc32.x86_64
but it not the case, it is at /usr/lib64/obs-plugins/
What can be done to solve this?
Thank you!

1 Like

Hi Herli and welcome to the forum! :slightly_smiling_face:

The video4linux driver that I’m using on an old server that I’m currently running Fedora 32 on is called “videodev”. It gets pulled in automatically by the “bttv” driver which is autodetected for my hardware during startup:

# dmesg | grep -i -A 6 bt8xx
[   49.039511] bttv: Bt8xx card found (0)
[   49.039857] bttv: 0: Bt878 (rev 17) at 0000:11:00.0, irq: 16, latency: 32, mmio: 0xd7fff000
[   49.045295] dcdbas dcdbas: Dell Systems Management Base Driver (version 5.6.0-3.3)
[   49.048720] bttv: 0: subsystem: 6f20:4765 (UNKNOWN)
[   49.048728] bttv: 0: using:  *** UNKNOWN/GENERIC ***  [card=0,autodetected]
[   49.081753] bttv: 0: tuner type unset
[   49.085470] bttv: 0: registered device video0
[   49.102263] bttv: Bt8xx card found (1)
[   49.102683] bttv: 1: Bt878 (rev 17) at 0000:11:04.0, irq: 16, latency: 32, mmio: 0xd7ffd000
[   49.102733] bttv: 1: subsystem: 6f21:4765 (UNKNOWN)
[   49.102736] bttv: 1: using:  *** UNKNOWN/GENERIC ***  [card=0,autodetected]
[   49.135807] bttv: 1: tuner type unset
[   49.145412] bttv: 1: registered device video1
[   49.145849] bttv: 1: registered device vbi1
[   49.149268] bttv: Bt8xx card found (2)
[   49.149628] bttv: 2: Bt878 (rev 17) at 0000:11:08.0, irq: 16, latency: 32, mmio: 0xd7ffb000
[   49.149672] bttv: 2: subsystem: 6f22:4765 (UNKNOWN)
[   49.149676] bttv: 2: using:  *** UNKNOWN/GENERIC ***  [card=0,autodetected]
[   49.182704] bttv: 2: tuner type unset
[   49.212272] bttv: 2: registered device video2
[   49.216116] bttv: 2: registered device vbi2
[   49.225671] bttv: Bt8xx card found (3)
[   49.226010] bttv: 3: Bt878 (rev 17) at 0000:11:0c.0, irq: 16, latency: 32, mmio: 0xd7ff9000
[   49.226048] bttv: 3: subsystem: 6f23:4765 (UNKNOWN)
[   49.226051] bttv: 3: using:  *** UNKNOWN/GENERIC ***  [card=0,autodetected]
[   49.259946] bttv: 3: tuner type unset
[   49.307452] bttv: 3: registered device video3
[   49.310416] bttv: 3: registered device vbi3
# lspci -v -s 11:00.0
11:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
	Subsystem: Device 6f20:4765
	Flags: bus master, medium devsel, latency 32, IRQ 16
	Memory at d7fff000 (32-bit, prefetchable) [size=4K]
	Capabilities: [44] Vital Product Data
	Capabilities: [4c] Power Management version 2
	Kernel driver in use: bttv
	Kernel modules: bttv
# modinfo /lib/modules/5.7.10-201.fc32.x86_64/kernel/drivers/media/pci/bt8xx/bttv.ko.xz | grep "^de"
description:    bttv - v4l/v4l2 driver module for bt848/878 based cards
depends:        videobuf-core,videobuf-dma-sg,videodev,tveeprom,tea575x,i2c-algo-bit
# lsmod | grep bttv
bttv                  167936  0
tea575x                16384  1 bttv
tveeprom               28672  1 bttv
videobuf_dma_sg        20480  1 bttv
videobuf_core          32768  2 videobuf_dma_sg,bttv
videodev              270336  2 tea575x,bttv
i2c_algo_bit           16384  2 bttv,radeon
# modinfo videodev
filename:       /lib/modules/5.7.10-201.fc32.x86_64/kernel/drivers/media/v4l2-core/videodev.ko.xz
alias:          char-major-81-*
license:        GPL
description:    Video4Linux2 core driver
author:         Alan Cox, Mauro Carvalho Chehab <mchehab@kernel.org>, Bill Dirks, Justin Schoeman, Gerd Knorr

I use the “v4l2-ctl” command (provided by the v4l-utils package) to manage the card. For example:

# v4l2-ctl -d /dev/video0 --set-standard=1
# v4l2-ctl -d /dev/video0 --set-fmt-video=width=768,height=480,pixelformat=YUYV

I can then use ffmpeg to stream the video from the remote server to mplayer runnig on a local PC (or do whatever else I want with the video):

$ ssh <server> ffmpeg -i /dev/video0 -f mjpeg - | mplayer -cache 1024 -noconsolecontrols -

Are you sure that the file under /usr/lib64/obs-plugins/ is a kernel driver? What does the modinfo command say if you pass it the full path to the filename? What response do you get if you use the file command instead of modinfo?

Hi, thank you for your answer.
Let me tell you what is my problem. I want to use OBS Studio virtual cam and use in live streams with Jitsi. As web cam I’m using droidcam-obs, so that my smarphone acts as webcam.

I am not sure if it is a kernel module but I searched for obs-plugins and i got this
Output of ls /usr/lib64/obs-plugins is at UNTITLED - Pastebin Service
I am lost, because, athough v4l2loopback is installed (so I guess) when I issue

sudo modprobe v4l2loopback
I get this error:

modprobe: ERROR: could not insert ‘v4l2loopback’: Exec format error

I googled for this kind of error witho no success.

I’m not familiar with droidcam-obs, but I just googled it and it appears that it works over the PCs usb connection. The USB drivers are very likely already loaded, so you shouldn’t need to load any further hardware drivers with modprobe.

It looks like droidcam-obs uses a special intermediate program/service called “usbmuxd” that must be installed and running to “relay” the data stream through the USB connection and to the other software running on your PC.

According to the documentation, usbmuxd can be installed with:

$ sudo dnf install usbmuxd

The documentation also states that the android-tools package must be installed with:

$ sudo dnf install android-tools

Sorry, I’m not familiar with droidcam-obs, so all I can really do is repeat what is stated in the documentation. Maybe someone else on this forum has some experience with it.

P.S. The documentation also indicates that you need to run the following commands:

$ mkdir -p ~/.config/obs-studio/plugins
$ cp -r droidcam-obs ~/.config/obs-studio/plugins

The droidcam-obs directory is packaged in the zip archive that is downloadable from DroidCam OBS by Dev47Apps.

I think you’re mixing a few things together here, and I suggest untangling them to get you going:
droidcam-obs and virtual cam are independent of each other (even though you want to use use them together in the end).

virtual cam means that obs provides its output in the form of a webcam like device that you can specify as the “webcam” in jitsi (i.e. your browser’s webrtc), zoom etc. obs studio used to need the obs-v4lsink plugin for providing the virtual webcam - obs-studio 26 has the virtual webcam built in, no need for the extra obs-v4lsink plugin any more!

The built in virtual cam (as well as the old v4lsink plugin it replaced) need v4l2loopback because it provides the v4l device which obs’s virtual cam writes its output to. This is a kernel module, and I’m note sure where you got it from. As a kernel module, it needs to be compiled specifically for your kernel version. I do this manually, and a package like akmod-v4l2loopback can do it for you. But: if you use secure boot (use mokutil --sb-state to check) then your kernel module needs to be signed. (This is why I compile the module myself, it requires quite a few steps to set up kernel module signing.)

So, I suggest you produce some obs simple output scene first (instead of droidcam) and try to get the virtual cam to work. (You can use vlc or such to check the output once v4l2loopback is there.)

droidcam-obs is an obs plugin. Droidcam is actually a family of solutions to get your android phone camera video to your computer. There are 2 android apps, and then something on your computer that connects to it: either a program which provides the camera video in a v4l device (which obs or others can use as input), or the obs-plugin which connects directly to your android phone (without intermediate v4l device, using the newer droidcam obs app on android). The obs-plugin method does not need v4l2loopback, so you can test this independent of the virtual camera. The plugin is easy to install - it is a binary module, the current version 1.2.1 works at least with my Fedora 33 version of obs. It may break easily through upgrades, though.

There are two methods for the actual connection between the droidcam android apps and your computer (droidcam program or obs plugin): via wifi or via usb. Wifi is actually much easier to set up, usb needs android-tools and developer mode. So I suggest you try to get droidcam-obs to work over wifi first.