Skip to main content

Send frames to a virtual camera

Project description

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.

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, 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 --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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyvirtualcam-0.7.0-cp39-cp39-win_amd64.whl (108.7 kB view details)

Uploaded CPython 3.9Windows x86-64

pyvirtualcam-0.7.0-cp39-cp39-manylinux2014_x86_64.whl (131.6 kB view details)

Uploaded CPython 3.9

pyvirtualcam-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl (254.0 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pyvirtualcam-0.7.0-cp38-cp38-win_amd64.whl (109.0 kB view details)

Uploaded CPython 3.8Windows x86-64

pyvirtualcam-0.7.0-cp38-cp38-manylinux2014_x86_64.whl (131.2 kB view details)

Uploaded CPython 3.8

pyvirtualcam-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl (253.8 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

pyvirtualcam-0.7.0-cp37-cp37m-win_amd64.whl (109.3 kB view details)

Uploaded CPython 3.7mWindows x86-64

pyvirtualcam-0.7.0-cp37-cp37m-manylinux2014_x86_64.whl (132.2 kB view details)

Uploaded CPython 3.7m

pyvirtualcam-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl (253.0 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

pyvirtualcam-0.7.0-cp36-cp36m-win_amd64.whl (109.3 kB view details)

Uploaded CPython 3.6mWindows x86-64

pyvirtualcam-0.7.0-cp36-cp36m-manylinux2014_x86_64.whl (132.2 kB view details)

Uploaded CPython 3.6m

pyvirtualcam-0.7.0-cp36-cp36m-macosx_10_9_x86_64.whl (253.0 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file pyvirtualcam-0.7.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 108.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 abb844c78014d17e1fb41e68cf2371d40027c11905df0b88937187efd7b62240
MD5 33b1d60fbd4262685bc756b3c3297c2b
BLAKE2b-256 9fa17d169100008b241847652b72f58d2f0c65ceddba6f6bbf6884f84b953713

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp39-cp39-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 131.6 kB
  • Tags: CPython 3.9
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e40ee935942f9b0f78ff23967a9c0b352052a5c45e7c34dbd84f465fe09643c1
MD5 600a08ce1497a9e8ea779510e98ee99c
BLAKE2b-256 57fd37d95afee77158f9a79bf976cc041c5fa7c3daa9f3d1c2e91b832b6a2a2e

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 254.0 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06768dda511d635d2eed48e592c7397f86ccf7e2d9d9738ef064597f9978b4ec
MD5 8c1a7d19134ccd21508494ec9a62693b
BLAKE2b-256 ee4ccc2cdb6f8549c3153a472bce8034030a9a9a992b7ea7e2b22193e606257e

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 109.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0a8dde4538002a8982773fe5c4014972b4471aa400d88472bd9f7cb8611ae5e1
MD5 59998ae9ca6420ebbef731378527e75b
BLAKE2b-256 22d3ccd407241cd9cf4b6e9633ca5e299e90fc1a80f5b2c26cd40b67e241863a

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 131.2 kB
  • Tags: CPython 3.8
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f96fd10d8e33afa57177aa3e71b5674d602c90906fcd1b58c69c2f9a3aa7018
MD5 07e23bd6179613c318dbc41a46e68719
BLAKE2b-256 a5d9205a6681ae259b790a5ce3c2a51013defa82fa876f607ab731b69adaa874

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 253.8 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0699f0ea85847022986380bced884272cb1736cc7739c5ac2866e23a75202ea8
MD5 49974e1b941cb4fb6921af53fa7540c3
BLAKE2b-256 d175ec8277cce5ea0dacb789d855803edef9c871e0de9b49b6fc9d993281cb84

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 109.3 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0bf86427f75b9937a3a5c3d37654d2059f8df3cec7210805781fef9fa029dc14
MD5 a3eed3a44af8cd281c6e09d06859d18f
BLAKE2b-256 7d29efcfb87db19b46c89b61feb29bc3a61c897884455cbf95e2753a155889bb

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 132.2 kB
  • Tags: CPython 3.7m
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 858a9d25eba46bda40b22df1ea072fb97c7bc81068e7e4ab576863cf5d60dc81
MD5 95836df3a428d2cc8f9e3305eb3e1bf9
BLAKE2b-256 1916f860146e485e19af9cd5c31d54b90458a8a263c935acbbaeb4ee8f967236

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 253.0 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 59ae9c44ec4b1eaa24c8224fc1d7275e85b7fcc57ffdae424c8a57ad40804350
MD5 57b1944a5c428879daa7510b22f743ff
BLAKE2b-256 aa549f56cd50e836976d69aef689868c323236a464e355fcad1db51fa75e8db2

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 109.3 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a649f11e61a4ea4738dffe86deb6eacc08bd3408d73ea983e94c4d7a38bf8e22
MD5 80810d6179d0963b7452ef0f11e3ec00
BLAKE2b-256 a0b98bd251aa54c834b0cd3c5cabb1fc9ae3d3cd4ac505047b9d64723b324ad4

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 132.2 kB
  • Tags: CPython 3.6m
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 536047a1133fa6fd59625a18d0f92ec54d846a8f2daeb84dd4aafe24a8a5fe14
MD5 b0c222f3b7a9e1dfab6d27492fdb3052
BLAKE2b-256 30fc05cecb2e21dfc2b5624d5f72cd053689ab460c5f6fac518c629540f7539e

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.7.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pyvirtualcam-0.7.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 253.0 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for pyvirtualcam-0.7.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ea8cce34203123c13c671ab8d5ecea6cab8d8679cb7faf19c3a5959d43388505
MD5 39ed3611c9696bdd9a7a2dfeba2bb490
BLAKE2b-256 afd78aeb5cd9fb04ab6a8b2e0dda0ae476e811631d450a4e647df7956c057e0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page