---
title: "Virtual camera"
description: "Present any picture in a stream as a camera that Zoom, Google Meet, OBS or a browser can select. Linux only."
type: "docs-page"
url: "https://tatolab.com/docs/build/virtual-camera"
site: "Tatolab"
section: "Build in code"
---

# Virtual camera

> Present any picture in a stream as a camera that Zoom, Google Meet, OBS or a browser can select. Linux only.

`VirtualCameraSink`, from the `tatolab-virtualcamera` module, turns a picture output into a camera every other application on the machine can pick, like a webcam you plugged in. Put an effect, an overlay or a model's annotations on your video, and use the result in a video call or a streaming tool.

> **Note: Linux only**
>
> `VirtualCameraSink` works on Linux. On macOS it refuses by name.

Add it from **File › Marketplace…** in Tato Studio, or from a terminal:

```sh
uv add tatolab-virtualcamera
```

## A camera with an effect

Make a stream of the camera, an effect and a `VirtualCameraSink`:

```txt
camera (tatolab.camera:CameraSource)
  video ──▶ vignette (nodes.vignette:SoftVignette)
              result ──▶ call-camera (tatolab.virtualcamera:VirtualCameraSink)
```

`SoftVignette` is the shader node from [GPU effects](https://tatolab.com/docs/build/gpu-effects). Give the sink a `name`, `Desk Camera`, in Tato Studio or in its `input_values`. Play the project, then open your video app's camera settings and choose **Desk Camera**.

A camera exists while its node runs: it appears when the project plays and disappears when it stops, like a USB camera plugged in and pulled out. Each `VirtualCameraSink` is a separate camera. The `camera-virtual-camera` example presents the plain camera and an inverted copy side by side.

The engine converts each RGBA frame to YUYV on the GPU. The camera's format follows the first frame's size and colour, and a change of size renegotiates it. A frame of odd width is refused.

## Choose a route: v4l2loopback or PipeWire

Linux has two routes for presenting a camera, and the `door` setting picks one:

| `door` | How it works | Who can see it |
|---|---|---|
| `auto` (default) | v4l2loopback where it's permitted, PipeWire otherwise | Depends on which it picked |
| `v4l2loopback` | A standard video device, `/dev/videoN` | Every application that uses cameras |
| `pipewire` | A PipeWire camera. Needs no kernel module and no grant. | Applications that use the camera portal |

The v4l2loopback route works with everything, including Zoom, browsers and OBS, so it's the one to set up if you can.

## Set up v4l2loopback (once)

v4l2loopback is a Linux kernel module. Install it, then grant your user the permission to create cameras with it:

```sh
sudo apt install v4l2loopback-dkms        # Debian and Ubuntu
tatolab enable-virtual-camera
```

`tatolab enable-virtual-camera` makes one privileged change, behind your desktop's password prompt, or `sudo` in a terminal without one: it loads the module at boot with no devices of its own, and lets the logged-in user create cameras through it. You do this once per machine. `tatolab enable-virtual-camera --print` shows what it would change, and changes nothing.

Without the grant, `door: v4l2loopback` refuses, naming `tatolab enable-virtual-camera`.

## Names

The `name` setting is what applications show in their camera list, at most 31 bytes. Without one, the camera is called `StreamLib Camera` plus four characters that stay the same across runs of the same stream and node.

## Ask an agent to do it

The runtime gives agents a recipe for this, the `show_channel_on_virtual_camera` prompt: it adds a `VirtualCameraSink` to a running stream and links any picture output into it. Ask your agent to put the detector's output on a virtual camera, and it can do it without stopping the stream. See [Agents and MCP](https://tatolab.com/docs/share/agents).

## Troubleshooting

- **The camera doesn't appear in my app.** If it took the PipeWire route and your app lists only `/dev/video*` devices, set up v4l2loopback as above. Some apps look for cameras only when they start, so restart the app.
- **`door: v4l2loopback` is refused.** Run `tatolab enable-virtual-camera`, and install `v4l2loopback-dkms` first if it asks for the module.
- **The picture is mirrored in my video call.** That's usually the app mirroring your self-view; other people see it the right way round.
