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

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.

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

pyvirtualcam-0.8.0-cp39-cp39-win_amd64.whl (206.2 kB view details)

Uploaded CPython 3.9Windows x86-64

pyvirtualcam-0.8.0-cp39-cp39-manylinux2014_x86_64.whl (131.8 kB view details)

Uploaded CPython 3.9

pyvirtualcam-0.8.0-cp39-cp39-macosx_10_9_x86_64.whl (254.2 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pyvirtualcam-0.8.0-cp38-cp38-win_amd64.whl (206.8 kB view details)

Uploaded CPython 3.8Windows x86-64

pyvirtualcam-0.8.0-cp38-cp38-manylinux2014_x86_64.whl (131.5 kB view details)

Uploaded CPython 3.8

pyvirtualcam-0.8.0-cp38-cp38-macosx_10_9_x86_64.whl (254.0 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

pyvirtualcam-0.8.0-cp37-cp37m-win_amd64.whl (207.4 kB view details)

Uploaded CPython 3.7mWindows x86-64

pyvirtualcam-0.8.0-cp37-cp37m-manylinux2014_x86_64.whl (132.6 kB view details)

Uploaded CPython 3.7m

pyvirtualcam-0.8.0-cp37-cp37m-macosx_10_9_x86_64.whl (253.3 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

pyvirtualcam-0.8.0-cp36-cp36m-win_amd64.whl (207.3 kB view details)

Uploaded CPython 3.6mWindows x86-64

pyvirtualcam-0.8.0-cp36-cp36m-manylinux2014_x86_64.whl (132.5 kB view details)

Uploaded CPython 3.6m

pyvirtualcam-0.8.0-cp36-cp36m-macosx_10_9_x86_64.whl (253.2 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 63f224d9c4f23c9feba84f0e11b5fd2a4dfff8b2a6be29dc36a2d00a17c68c60
MD5 88784cbffaa527aace290338694a978d
BLAKE2b-256 24ebf1b98f1e72c67b98c4663d1fcf40fc4b2ee61d8f70cbe65a9b5b86da3f0d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 749a5d6f11be5dfe316dcbc12098450c1b2b7a8edc0872d2c7a7231da5880c80
MD5 39c1976ba2106a9e07325915250347b7
BLAKE2b-256 6966e866f423c9e6ab2f19def815fd8eddcf8e9a0cd9685f3b289bfdd605fc82

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5a7461953dd6f3c4570b67ca198a4921108a104bbc033762096c2b11181abffc
MD5 223080c00505ce003da2e1f5eb3b160d
BLAKE2b-256 d6331e9855799ec53c4ad86351ec234f98975f813082dc42d4b6a54d519d1219

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8672ab7f0e0472f56e1e885d0867e7d2079bc46ff8dbb629c9877dd546d4810a
MD5 e698a6d1d54f02a06f591b9fc4f4458f
BLAKE2b-256 6a2db84bdfe7c96b759b8135fc5046d5ff84e17e1f11d627b59f77de9043923f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3cd497d3c08d9bf6af22951448554cdf6d9387ae8b70b2093a9ec849925c7a12
MD5 146d1cfcb946585a47c6f053502dcd39
BLAKE2b-256 f37d7d590bc1b6fa77382f4348a636beeb632289ea147f01e576cb6ad9ac2eb4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 89b931b39e7f8aca83a4a9950362892cc3a694e86a00385b94bc99083d25cb87
MD5 fa41218601589d9bdbb9193139fba762
BLAKE2b-256 9e1ff72d374c2ad39f53e7585d98d9fa86c048630057ffdeb77ae8fd790d114e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4852ffa282f367a29fb761d35e69574525709b000ec1e3ae68be72a900201a3b
MD5 5726a572e78ecdf431541448fef1feb8
BLAKE2b-256 505aee5f10099f068e656425656ecf7842cca2ecfa1441277827f269ed8e719f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c20c9c7231a9c2e96239f17b6df900896bc886fb6fa6cdfabb5222aa1e291eed
MD5 42a4b9b78215be0fb7b8d38d29f6537a
BLAKE2b-256 44ecd83b6b49407499d178bc56ad5ba2b256704f9e51def61522fccb8022f5da

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8cc405f1f6a054553cdd63bb55dfcb5bc72d10c86c881b86347f89501eee8983
MD5 41acc0022d54ea059768635d123edbc6
BLAKE2b-256 bcb1aa3dd3f169a9069c752916384541975baff59231b90ad082a7e5cf29de28

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 81075adcd76b86a73b122820c879a39c83ab8d49d96c8248047cd7dd4eab151b
MD5 84f781d2e22ddcba06c631faa9ee824e
BLAKE2b-256 e787d29806b0c3ebaeb39bb398860e187eedd711a57ac46bd698ae1a36e3031d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41c61872c91f258f8e6097c30eec325f1d6daa609e96d2dff5948b897ae7937a
MD5 635e24bf5738bc92b05e13ef7f383324
BLAKE2b-256 12eeac88344c5e08e2190d92f4bbc090a2fb2896a1efd4490a6a027909aab92e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyvirtualcam-0.8.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 306906f0f411563ea177811eda14e2dd39207c68b796657178b39e86c1792d23
MD5 0457ad3860d6c089a0643c7bd381c86b
BLAKE2b-256 dabe4e90d2306791a814ebe40cc926a42c33ba3b624ec20ede9eeef292dcd04e

See more details on using hashes here.

Supported by

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