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()

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

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, capture the camera in OBS, mix it with other content, and output it again as virtual camera.

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.

If the device keyword argument is not given, then pyvirtualcam uses the first available v4l2loopback virtual camera it finds. The camera device name can be accessed with cam.device.

Build from source

Linux/macOS

git clone https://github.com/letmaik/pyvirtualcam
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
cd pyvirtualcam
.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.6.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.6.0
File
pyvirtualcam-0.6.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pyvirtualcam-0.6.0-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.6.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
pyvirtualcam-0.6.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
pyvirtualcam-0.6.0-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
pyvirtualcam-0.6.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
pyvirtualcam-0.6.0-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
pyvirtualcam-0.6.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
pyvirtualcam-0.6.0-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
pyvirtualcam-0.6.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.0 MB

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

Download URL pyvirtualcam-0.6.0-cp39-cp39-win_amd64.whl
Size 106.4 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
cb2152cd677cff402cc6fe3644161fa326eeb5a2ee687db837f1cf6056332846
BLAKE2b-256 checksum
How to use checksums
dcfe98ec81fab51b7d79e542978fd95cd02b60ad3cfbdce5bad59d1f496a0a75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp39-cp39-manylinux2014_x86_64.whl
Size 129.4 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5fd2358e6d3157343c105890cddb2a77129f25cf293cad88b950b647256b8786
BLAKE2b-256 checksum
How to use checksums
7956b24636150ab9201778a108d235ed9fb197d23d76f36a08d9d9a71b287e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 251.7 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
13de95b60a333836e578f3ab4fac6931eb92603dcedf8f91c6e12d8e53704ab3
BLAKE2b-256 checksum
How to use checksums
4f77e8abab90b5996f7902c61e52d3fbf8993fc709e9fd81fcca94079039ae54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp38-cp38-win_amd64.whl
Size 106.8 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
00a183363315cbc50300f2443251005d147f05e880471359fb746c85174ebcdd
BLAKE2b-256 checksum
How to use checksums
d311df3b48bcdac8d9e7b2a79d43607df55c85d738cef25bf91df5fab784312e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp38-cp38-manylinux2014_x86_64.whl
Size 129.0 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2985e5d44578548bfb4a2d7a43c2a1a1ab3ae850190136c2213541f6cfb3c09e
BLAKE2b-256 checksum
How to use checksums
7007fe5fb7ff7f39c08e77496bb6e80edc8ecba083f4a62314070eff7b3f1978
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 251.6 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
5af7d1b50767c1b371ade47cb6e52eacbc1b455440159e3ccf9ed98a231b2197
BLAKE2b-256 checksum
How to use checksums
e7d0da9fa2bd6897925df4530489fd28f835d8f15dc1d7f1ff38148fe1586028
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp37-cp37m-win_amd64.whl
Size 107.1 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
210966d4e0e3e9fcd29b3bef48fb573ecab6d55afc96fb91f4aa02461377d2de
BLAKE2b-256 checksum
How to use checksums
cf0557e1f0b00b25d5096578953e561046432860e70a343aef885eb36c6efcdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp37-cp37m-manylinux2014_x86_64.whl
Size 130.0 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
23e94936aaeadba11d6864bc4363d8ef72a19ed5d6b242f274f020e03c3a60be
BLAKE2b-256 checksum
How to use checksums
1a45dbc584c3a1fb68c84df8ef2d55e6b197874f643a3fec53fee15d51e604d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl
Size 250.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
20d7a0ec3d523d355c317c84c8b3b410267e9e1503e79ab886a92432ac0e72e0
BLAKE2b-256 checksum
How to use checksums
6bf6e13cc2038bc38ba0c86b56e1b9176bf808cd02ddbfc39535b60e616aa221
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp36-cp36m-win_amd64.whl
Size 107.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
9908d12c966c4b72fe72077ac5fceb06cab401c5de13574fb0ec9b2537578e8b
BLAKE2b-256 checksum
How to use checksums
a0c39dfe6c75bd4278fb425107246747c2aa336b4c471fa4634000f01d5b8da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp36-cp36m-manylinux2014_x86_64.whl
Size 130.0 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5664256038771f056876fed86184cb1699bfe5896eab5518032ca112459b16c0
BLAKE2b-256 checksum
How to use checksums
de995f9d28ae093ff8be991c30373b40e1d5d9061d4f1fa14823d27ddcdfefd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

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

Download URL pyvirtualcam-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl
Size 250.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
3ac2ef924b93242cdea60133e35157d680e89e93f36780c61043c5b999278897
BLAKE2b-256 checksum
How to use checksums
40c0a258610263e5ea808ef4cdd4375c79593144aedb38942eae308aac8d4ba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

0.9.1

12 release files

0.9.0

11 release files

0.8.0

12 release files

0.7.0

12 release files

This release

0.6.0 This release

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