Skip to main content

pyvirtualcam

pyvirtualcam sends frames to a virtual camera from Python.

Usage

import pyvirtualcam
import numpy as np

with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam:
    print(f'Using virtual camera: {cam.device}')
    frame = np.zeros((cam.height, cam.width, 3), np.uint8)  # RGB
    while True:
        frame[:] = cam.frames_sent % 255  # grayscale animation
        cam.send(frame)
        cam.sleep_until_next_frame()

pyvirtualcam uses the first available virtual camera it finds (see later section).

For more examples, including using different pixel formats like BGR, or selecting a specific camera device, check out the samples/ folder.

See also the API Documentation.

Installation

This package works on Windows, macOS, and Linux. Install it from PyPI with:

pip install pyvirtualcam

pyvirtualcam relies on existing virtual cameras which have to be installed first. See the next section for details.

Supported virtual cameras

Windows: OBS

OBS includes a built-in virtual camera for Windows (since 26.0).

To use the OBS virtual camera, simply install OBS.

Note that OBS provides a single camera instance only, so it is not possible to send frames from Python to the built-in OBS virtual camera, capture the camera in OBS, mix it with other content, and output it again to OBS' built-in virtual camera. To achieve such a workflow, use another virtual camera from Python (like Unity Capture) so that OBS' built-in virtual camera is free for use in OBS.

Windows: Unity Capture

Unity Capture provides a virtual camera originally meant for streaming Unity games. Compared to most other virtual cameras it supports RGBA frames (frames with transparency) which in turn can be captured in OBS for further processing.

To use the Unity Capture virtual camera, follow the installation instructions on the project site.

macOS: OBS

OBS includes a built-in virtual camera for macOS (since 26.1).

To use the OBS virtual camera, follow these one-time setup steps:

  • Install OBS.
  • Start OBS.
  • Click "Start Virtual Camera" (bottom right), then "Stop Virtual Camera".
  • Close OBS.

Note that OBS provides a single camera instance only, so it is not possible to send frames from Python, capture the camera in OBS, mix it with other content, and output it again as virtual camera.

Linux: v4l2loopback

pyvirtualcam uses v4l2loopback virtual cameras on Linux.

To create a v4l2loopback virtual camera on Ubuntu, run the following:

sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback devices=1

For further information, see the v4l2loopback documentation.

Build from source

Linux/macOS

git clone https://github.com/letmaik/pyvirtualcam --recursive
cd pyvirtualcam
pip install .

Windows

These instructions are experimental and support is not provided for them. Typically, there should be no need to build manually since wheels are hosted on PyPI.

You need to have Visual Studio installed to build pyvirtualcam.

In a PowerShell window:

$env:PYTHON_VERSION = '3.7'
$env:PYTHON_ARCH = '64'
$env:NUMPY_VERSION = '1.14'
git clone https://github.com/letmaik/pyvirtualcam --recursive
cd pyvirtualcam
powershell .github/scripts/build-windows.ps1

The above will download all build dependencies (including a Python installation) and is fully configured through the three environment variables.

Release files for pyvirtualcam 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyvirtualcam 0.8.0
File
pyvirtualcam-0.8.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pyvirtualcam-0.8.0-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.8.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
pyvirtualcam-0.8.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
pyvirtualcam-0.8.0-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.8.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
pyvirtualcam-0.8.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
pyvirtualcam-0.8.0-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.8.0-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
pyvirtualcam-0.8.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
pyvirtualcam-0.8.0-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.8.0-cp36-cp36m-macosx_10_9_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64 Details

Total release size: 2.4 MB

Release files / pyvirtualcam-0.8.0-cp39-cp39-win_amd64.whl

Download URL pyvirtualcam-0.8.0-cp39-cp39-win_amd64.whl
Size 206.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
63f224d9c4f23c9feba84f0e11b5fd2a4dfff8b2a6be29dc36a2d00a17c68c60
BLAKE2b-256 checksum
How to use checksums
24ebf1b98f1e72c67b98c4663d1fcf40fc4b2ee61d8f70cbe65a9b5b86da3f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp39-cp39-manylinux2014_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp39-cp39-manylinux2014_x86_64.whl
Size 131.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
749a5d6f11be5dfe316dcbc12098450c1b2b7a8edc0872d2c7a7231da5880c80
BLAKE2b-256 checksum
How to use checksums
6966e866f423c9e6ab2f19def815fd8eddcf8e9a0cd9685f3b289bfdd605fc82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp39-cp39-macosx_10_9_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 254.2 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
5a7461953dd6f3c4570b67ca198a4921108a104bbc033762096c2b11181abffc
BLAKE2b-256 checksum
How to use checksums
d6331e9855799ec53c4ad86351ec234f98975f813082dc42d4b6a54d519d1219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp38-cp38-win_amd64.whl

Download URL pyvirtualcam-0.8.0-cp38-cp38-win_amd64.whl
Size 206.8 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
8672ab7f0e0472f56e1e885d0867e7d2079bc46ff8dbb629c9877dd546d4810a
BLAKE2b-256 checksum
How to use checksums
6a2db84bdfe7c96b759b8135fc5046d5ff84e17e1f11d627b59f77de9043923f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp38-cp38-manylinux2014_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp38-cp38-manylinux2014_x86_64.whl
Size 131.5 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3cd497d3c08d9bf6af22951448554cdf6d9387ae8b70b2093a9ec849925c7a12
BLAKE2b-256 checksum
How to use checksums
f37d7d590bc1b6fa77382f4348a636beeb632289ea147f01e576cb6ad9ac2eb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp38-cp38-macosx_10_9_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 254.0 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
89b931b39e7f8aca83a4a9950362892cc3a694e86a00385b94bc99083d25cb87
BLAKE2b-256 checksum
How to use checksums
9e1ff72d374c2ad39f53e7585d98d9fa86c048630057ffdeb77ae8fd790d114e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp37-cp37m-win_amd64.whl

Download URL pyvirtualcam-0.8.0-cp37-cp37m-win_amd64.whl
Size 207.4 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
4852ffa282f367a29fb761d35e69574525709b000ec1e3ae68be72a900201a3b
BLAKE2b-256 checksum
How to use checksums
505aee5f10099f068e656425656ecf7842cca2ecfa1441277827f269ed8e719f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp37-cp37m-manylinux2014_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp37-cp37m-manylinux2014_x86_64.whl
Size 132.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c20c9c7231a9c2e96239f17b6df900896bc886fb6fa6cdfabb5222aa1e291eed
BLAKE2b-256 checksum
How to use checksums
44ecd83b6b49407499d178bc56ad5ba2b256704f9e51def61522fccb8022f5da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp37-cp37m-macosx_10_9_x86_64.whl
Size 253.3 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
8cc405f1f6a054553cdd63bb55dfcb5bc72d10c86c881b86347f89501eee8983
BLAKE2b-256 checksum
How to use checksums
bcb1aa3dd3f169a9069c752916384541975baff59231b90ad082a7e5cf29de28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp36-cp36m-win_amd64.whl

Download URL pyvirtualcam-0.8.0-cp36-cp36m-win_amd64.whl
Size 207.3 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
81075adcd76b86a73b122820c879a39c83ab8d49d96c8248047cd7dd4eab151b
BLAKE2b-256 checksum
How to use checksums
e787d29806b0c3ebaeb39bb398860e187eedd711a57ac46bd698ae1a36e3031d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp36-cp36m-manylinux2014_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp36-cp36m-manylinux2014_x86_64.whl
Size 132.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
41c61872c91f258f8e6097c30eec325f1d6daa609e96d2dff5948b897ae7937a
BLAKE2b-256 checksum
How to use checksums
12eeac88344c5e08e2190d92f4bbc090a2fb2896a1efd4490a6a027909aab92e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pyvirtualcam-0.8.0-cp36-cp36m-macosx_10_9_x86_64.whl

Download URL pyvirtualcam-0.8.0-cp36-cp36m-macosx_10_9_x86_64.whl
Size 253.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
306906f0f411563ea177811eda14e2dd39207c68b796657178b39e86c1792d23
BLAKE2b-256 checksum
How to use checksums
dabe4e90d2306791a814ebe40cc926a42c33ba3b624ec20ede9eeef292dcd04e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

0.9.1

12 release files

0.9.0

11 release files

This release

0.8.0 This release

12 release files

0.7.0

12 release files

0.6.0

12 release files

0.5.0

12 release files

0.3.2

4 release files

0.3.1

4 release files

0.2.0

4 release files

0.1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page