Search code examples
virtualwebcamgstreamer

Create 2 virtual camera devices streaming the same images one actual webcam does


I would like to use the images of one webcam in two different systems that require exclusive access to the video device simultaneously. Therefore I created two virtual cameras with v4l2loopback, one for each of the systems, and now I am trying to stream the data from the actual webcam to both virtual cameras. I tried to use GStreamer, but it only allows me to stream the data to one single virtual camera. If I try to stream to the other one also, I end up with my original problem of the webcam being already busy. I can't figure out a way to solve this problem, help would be greatly appreciated!


Solution

  • Just a thought I haven’t actually tried it, suppose you have a webcam attached and its /dev/video0, now create two virtual devices using v4l2loopback say /dev/video1 & /dev/video2 and now create a gstreamer pipeline with a tee element which outputs to 2 v4l2sink's /dev/video1 and /dev/video2.

    Hope that helps!