I’m new to silverblue and I tried installing both rpm-ostree version and flathub version. Both of them do not show virtual camera option. I think it has something to do with v4l2loopback but I don’t know how to modprobe it or install it properly. If it is something else, please do help me with it. I would prefer entire command lines if any, because I’m new to linux.
I found the solution:
sudo -s
cd /etc/yum.repos.d/
wget *link* (get the repo from here https://copr.fedorainfracloud.org/coprs/sentry/v4l2loopback/)
rpm-ostree install v4l2loopback ffmpeg
then reboot twice to get it working.
An alternative, if you don’t want to overlay software from third party repos.
v4l2loopback is really easy to compile, it takes just few seconds and you can use it without installing it.
On the positive side: you will have a clean boot process and will load the loopback driver only when you need it, and you don’t need a reboot.
Negative: You need to recompile it whenever there are kernel upgrades. If you forget to do it, it does not matter - on loading you will get an error and then it is just a few seconds to recompile it.
Download source from git:
mkdir -p ~/sources
cd ~/sources
git clone https://github.com/umlaeute/v4l2loopback.git
Compile (needed on first run, and after a kernel-relate upgrade):
cd ~/sources/v4l2loopback
make clean
make
Load the module before starting OBS with the options you need (I use a script for this that looks like this):
echo Removing module in case it's there and you need a new version ...
sudo rmmod -v -f v4l2loopback
echo Loading v4l2loopback module with needed params ...
sudo insmod ~/sources/v4l2loopback/v4l2loopback.ko video_nr=11,12 max_buffers=2 exclusive_caps=1 card_label=vcam_OBS,vcam_Effects
echo Loaded.
ls /dev/video*
If the last line lists /dev/video11 and /dev/video12 than it’s loaded.
Then you can use OBS from flatpak and it will find the virtual camera without issues.
Regarding ffmpeg. I don’t think you need to overlay it. In case you need it, you can just download it from the official website as a static executable build and put it in /usr/local/bin (or ~/.local/bin which you put in your users PATH). This what I do when I need it.
On Fedora 36, when running make clean
I get the following error:
make[1]: *** /lib/modules/5.17.8-300.fc36.x86_64/build: No such file or directory. Stop.
make: *** [Makefile:71: clean] Error 2
Do I need to install anything else before compiling?
Hello @entodoays,
Welcome to !
My personal preference is to use a toolbox container to build anything on Silverblue since I can configure them exactly how the build system requires. That would be my approach even for something I use installed from my home dir normally, since I like to avoid adding any libraries to my immutable system portion.
You create a toolbox with toolbox create
then use it with toolbox enter
. Toolbox uses Podman for the container and they are already installed ootb on Silverblue. Inside the toolbox container you get a command line just as normal terminal, but you get to use dnf, and toolbox shares your user namespace and your user home. If it breaks something in the container, no problem just delete it and create a new one, easy peasey.
I just checked this in F36 and it seems make and kernel-devel are missing and you need to overlay them.
rpm-ostree install make --apply-live
rpm-ostree install kernel-devel --apply-live
… and then you follow my original instructions from the post above.
I have been using this approach for nearly a year for teaching my classes. It worked without issues. If a new kernel version is installed, you can rebuild v4l2loopback in less than a minute just before the live stream.
As for the toolbox approach, I had lot’s of issues with building modules for the main system - namely the kernel and kernel-modules in the toolbox need to be the same as the ones in the main system, and in many occasions this is not the case. For example, if the level of upgrades are not the same in the toolbox and main system. In such cases you will need to upgrade both the main system and the toolbox container to the same versions of the kernel and this will take way too long.
For me it’s much simpler and faster to overlay the missing packages on the main system.