Install
For installation rpmfusion see here.
dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates --refresh install v4l2loopback
dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates --refresh install ffmpeg
dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates --refresh install v4l-utils
Let's see video devices before modprobing
ls /dev/ | grep "video"
Activate kernel module
# don't send video_nr=99 because Firefox can't handle non-sequential video device id
modprobe v4l2loopback card_label="Fake cam" exclusive_caps=1
If you get after system upgrade
modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.18.17-200.fc36.x86_64
then you need invoke depmod
depmod
List video devices again
# it's last /dev/video4 on my host
ls /dev/ | grep "video"
Then play file (root is not required)
ffmpeg -re -i file:/home/nkonev/Videos/Borat.2006.BDRip.1080p.Rus.mkv -an -f v4l2 -filter:v "format=pix_fmts=yuv420p" /dev/video4
Then start WebRTC in Firefox
Misc
Open existing (real) camera
ffplay /dev/video0
ffprobe /path/file.mkv 2>&1 | grep Stream
We identify that #0:0 is the audio stream and #0:1 is the video stream.
ffmpeg -re -i file:/home/nkonev/Videos/GMT20220408-160519_Recording_1760x900.mp4 -an -f v4l2 -filter:v "format=pix_fmts=yuv420p" /dev/video4
Unload kernel module
modprobe --remove v4l2loopback
Links
https://girishjoshi.io/post/use-your-mobile-camera-as-webcam-on-fedora-with-v4l2-loopback/
https://www.city17.xyz/trick-firefox-cam/
https://github.com/jitsi/jitsi-meet/issues/5186#issuecomment-602895921
https://community.jitsi.org/t/using-virtual-camera-as-video-device-for-jitsi-meet/30205/14