mjacobus / jw-play

A prototype of a player/slideshow for zoom meetings
15 stars 3 forks source link

Using Virtual Cameras for Displaying Photos and Video #27

Open JoelMon opened 3 years ago

JoelMon commented 3 years ago

Virtual Cameras

Being able to use a virtual camera for sharing video or images in virtual congregational meetings is beneficial in these ways:

OBS does all these things and more but it's overkill and becomes unwieldy with large amounts of photos and videos as used in Sign Language congregations. With so many options and capabilities, it's confusing and hard to use for many.

Virtual Cameras in Linux

Accessing real-time camera features under Linux can be done via the V4L2, video for Linux, driver. The V4L2 driver provides a standard API for working with firmware-based cameras and webcams. More information about the V4L2 Linux driver can be found at Kernel.org: Part I - Video for Linux API.

Accessing V4L2 can be done via a Ruby OpenCV wrapper called ruby-opencv but might be simpler by taking advantage of the V4L2Loopback kernel module.

V4L2Loopback

The V4L2Loopback is a Linux kernel module that creates V4L2, loopback devices. In other words, it creates a virtual V4L2 camera that can be used by any programs capable of writing to a v4l2 device to output video or images to any application that can be read by any v4l2-capable application, e.g. Zoom.

This is the method that OBS uses to output a video feed to a virtual webcam. 2021-05-18_19-48

The V4L2Loopback's Github repository lists two feeders as examples that can be used to feed a video stream to v4l2:

ffmpeg can also be used.

Virtual Cameras on other systems

I haven't done too much research on other systems but ffmpeg can be used on Linux, macOS, and Windows. With ffmpeg you give it a source or device and you can stream it to another source or device with the format needed.

Implementation

A possible quick and extremely hacky way to implement ~not taking into account the live video feed of the speaker~:

Resources

Examples

Using ffmpeg and v4l2loopback

An example of using ffmpeg and v4l2loopback to stream a video to a virtual cam

JoelMon commented 3 years ago

I have added an example of how v4l2loopback can be used with ffmpeg to stream a video file to the virtual camera and shown live on Zoom.