Skip to main content

Module webcam

Module webcam 

Source
Expand description

Virtual camera: the browser’s webcam, delivered to applications as a V4L2 capture device.

The client encodes its camera (H.264/VP8/… over the WebRTC media track or WebCodecs over the WebSocket, MJPEG as the last-resort canvas path) and Selkies hands each encoded frame to VirtualCamera::push, which returns at once. A worker thread decodes, fits the picture into the device’s fixed raw format and publishes it to every sink at once:

  • the shared-memory ring served over a Unix socket to the Selkies V4L2 interposer (LD_PRELOAD, no privileges, no kernel module), see ring and server;
  • a v4l2loopback output device where one is configured or found, see v4l2out — the kernel path for hosts and privileged containers, as /dev/uinput is for gamepads;
  • a PipeWire Video/Source node where a daemon is reachable, see pipewire — for PipeWire-native consumers and the pipewire-v4l2 wrapper.

Nothing on the hot path holds the GIL beyond copying the encoded bytes out of the Python buffer, and no worker thread ever calls back into Python.

Modules§

convert
Normalization of decoded frames into the virtual device’s fixed format.
decode
Decoders for the client camera uplink.
pipewire
PipeWire sink: the camera as a Video/Source node.
ring
Shared-memory frame ring consumed by the Selkies V4L2 interposer.
server
Control socket for the Selkies V4L2 interposer.
v4l2out
Kernel-device sink: writes frames into a v4l2loopback output device.

Structs§

VirtualCamera
A virtual camera fed with encoded frames from Python.
VirtualCameraSettings
Configuration for VirtualCamera::start.