How to write on a virtual webcam in Linux?
You can also use a combination of v4l2loopback
, OBS Studio
and obs-v4l2sink
.
Use OBS Studio
to capture video from your device, then obs-v4l2sink
is a small plugin that writes output into /dev/video*
of your choice.
https://github.com/umlaeute/v4l2loopback/wiki/OBS-Studio
https://github.com/CatxFish/obs-v4l2sink
Well, actually this is possible. A quick and dirty way to do this is to use WebcamStudio. That will create a new video device (e.g., /device/video2) that other programs see as a normal video device and can take its input from desktop, so you just set it up to capture a part of the screen that OpenCV's output is shown there.
A better but more technical way is to use the V4L2 loop back module. This way you can simply pipe the output of OpenCV to the module which is seen as a regular video device by the other programs. See the readme at the bottom of this page: https://github.com/umlaeute/v4l2loopback and the wiki page: https://github.com/umlaeute/v4l2loopback/wiki for more information.
Hope that helps.