Solution to my ffmpeg issue!

Thank you so much woggle from FurNet.

The command I ran was:

ffmpeg -f video4linux2 -input_format mjpeg -framerate 60 -video_size 1920x1080 -i /dev/video0 -c copy -f video4linux2 /dev/video9

I don't know why the arguments need to be in this order, but it gave me the streamcopy I needed.

Well, it gave me one streamcopy. Turns out that only one application can access a virtual webcam, same as only one application can access a physical webcam. So next step is to make more loopback devices and streamcopy to all of them.

#V4L2 #Video4Linux #v4l2loopback #ffmpeg

I've reached the point with ffmpeg where I really need someone to explain something to me because I'm getting inconsistent results.

To get ffplay to show me the video I want to stream to my v4l2loopback device, I did this:

ffplay -f video4linux2 -input_format mjpeg -framerate 60 -video_size 1920x1080 /dev/video0

And it worked! It pops up a window showing video from my webcam at the correct resolution and framerate, in MJPEG as expected.

But when I do this:

ffmpeg -i /dev/video0 -c copy -f video4linux2 -input_format mjpeg -framerate 60 -video_size 1920x1080 /dev/video9

The stream goes back to raw video at 5fps.

Is there something wrong with my syntax? I've noticed that if I move -i /dev/video0 anywhere except as the first argument in the command, I get errors. For example I do:

ffmpeg -c copy -f video4linux2 -input_format mjpeg -framerate 60 -video_size 1920x1080 -i /dev/video0 /dev/video9

And the error I get is:

Unknown decoder 'copy'
Error opening input file /dev/video0.
Error opening input files: Decoder not found

#V4L2 #Video4Linux #v4l2loopback #ffmpeg

I have a #webcam on a #Linux system and hypothetically, if I were to do the video game streamer thing, I might want to use it to feed video from that camera to two apps simultaneously, namely:

  • Head tracking software for a video game
  • Face tracking software for a VTube avatar

But from what I've seen, only one application on a Linux system using V4L2 can get a video stream from a webcam at a time.

The solution I've seen proposed to this problem is v4l2loopback, but none of the sources I've seen bothered to explain how to use it, and the wiki they link to is bare-bones and doesn't seem to explain much either.

Furthermore, I want to be sure that the camera is providing video to these apps at its maximum framerate and not just its maximum resolution, and I don't know how I'd configure this. Or... really anything at all.

Is there any actually relevant documentation I should be reading to solve this problem?

#Video4Linux #V4L2 #V4L2loopback

Linux Fu: Fake Webcams, GUI Edition

Previously, I looked at using the Linux video loopback system from the command line. The basic trick was simple enough: capture video from a real camera, process it with something like ffmpeg, and …

Hackaday
Comme d'habitude, le wiki d'ArchLinux contient la vraie référence sur ce qu'on peut faire ... Ici avec les devices vidéo "virtuels" (genre la webcam MIP, Droidcam ou scrcpy). https://wiki.archlinux.org/title/V4l2loopback #linux #webcam #v4l2loopback #documentation #référence
v4l2loopback - ArchWiki

@avatastic then the setup with #OBSstudio should be even easier as you don't need to fiddle in the #v4l2loopback device...

https://www.youtube.com/watch?v=86IRVp7Bpqo

You're welcome!

How to use OBS to change your Background in Microsoft Teams

YouTube

@avatastic No, that's because the cutout filter is designed to barely exceed human rounded heads.

- You may want to use #v4l2loopback + #OBSstudio with a #GreenScreen to manually add a different background and pipe that in as #Webcam footage.

This is how a lot of folks do it...

Dos horas invertidas en "arreglar" #v4l2loopback porque no conseguía hacer funcionar la cámara virtual de OBS en el navegador...

¡Y no era problema de v4l2-loopback!
 

Bueno sí, un poco, pero la solución no funcionaba porque únicamente estaba haciendo pruebas en #Jitsi... Y resulta que Jitsi es demasiado quisquilloso con los parámetros de cámara para detectarlas (por ejemplo, no las reconoce si se configuran a más de 30 FPS o con un formato de video distinto a YUYV 4:2:2). Otras aplicaciones web de videollamada funcionaban sin necesidad de verificar esos parámetros.

En fin, todo sea por la ciencia...

If anyone, using Fedora Linux 42, has issues with OBS-Studio and the Virtual-Camera mode:

That's because of an incompatibility between OBS-Studio 31.0 and the v4l2loopback Kernel module in version 0.14.0.

The fix for that is in obs 31.0.3, which is on the way from testing to stable right now. Should be offered as an RPM update within the next days.

Fedora Bugfix Update:
https://bodhi.fedoraproject.org/updates/FEDORA-2025-85fcdbf461

Upstream Bug: https://github.com/obsproject/obs-studio/issues/11891

#linux #fedora #obs #v4l2loopback

FEDORA-2025-85fcdbf461 — bugfix update for obs-studio — Fedora Updates System

management of Fedora Project updates