How to write on a virtual webcam in Linux?
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.
Sending a webcam input to zoom using a recorded clip
Apparently, there are two types of /dev/video* files. One for the metadata and the other is for the actual stream from the webcam. Creating a virtual device of the same type as the stream in the /dev directory did result in Zoom recognizing it as an independent webcam, even without creating its metadata file. I did finally achieve what I wanted, but I used OBS Studio virtual camera feature that was added after update 26.0.1, and it is working perfectly so far.
Using v4l2loopback virtual cam with google-chrome or chromium on linux while having real webcam in use
Answering my own post to flag it "answered".
How to write/pipe to a virtual webcam created by V4L2loopback module?
I have found an answer in the old V4L2loopback module's page on Google code.
http://code.google.com/p/v4l2loopback/source/browse/test.c
newer link: https://github.com/umlaeute/v4l2loopback/blob/master/examples/test.c
This has helped me so far just to write to the device.
How to make a virtual camera with python?
This may be late but check this out pyvirtualcam
install it first:
pip install pyvirtualcam
You can make it like this:
import pyvirtualcam
import numpy as np
with pyvirtualcam.Camera(width=1280, height=720, fps=30) as cam:
while True:
frame = np.zeros((cam.height, cam.width, 4), np.uint8) # RGBA
frame[:,:,:3] = cam.frames_sent % 255 # grayscale animation
frame[:,:,3] = 255
cam.send(frame)
cam.sleep_until_next_frame()
cam.sleep_until_next_frame()
Related Topics
Sending an Email from a C/C++ Program in Linux
Detecting If Computer Is Idle Based on Mouse and Keyboard Interactions
Why Is Std::Function Not Equality Comparable
How Do Exceptions Work (Behind the Scenes) in C++
Does There Exist a Static_Warning
Function Pointers Casting in C++
Using \ in a String as Literal Instead of an Escape
Get 3D Coordinates from 2D Image Pixel If Extrinsic and Intrinsic Parameters Are Known
Differencebetween "New" and "Malloc" and "Calloc" in C++
Determine If Linux or Windows in C++
Mpirun: Unrecognized Argument Mca
In C++, What Is a "Namespace Alias"
Floating Point Format for Std::Ostream
How Do Sizeof(Arr)/Sizeof(Arr[0]) Work
Double or Float, Which Is Faster
Access Variable Value Using String Representing Variable's Name in C++