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 examples/ 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).

NOTE: Starting with pyvirtualcam 0.10, only OBS 28 is supported. Install an older version if you need OBS 26 / 27 support.

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:USE_CONDA = '1'
$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 four environment variables. Set USE_CONDA = '0' to build within an existing Python environment.

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.10.0-cp310-cp310-win_amd64.whl (167.7 kB view details)

Uploaded CPython 3.10Windows x86-64

pyvirtualcam-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyvirtualcam-0.10.0-cp310-cp310-macosx_10_9_x86_64.whl (258.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyvirtualcam-0.10.0-cp39-cp39-win_amd64.whl (167.7 kB view details)

Uploaded CPython 3.9Windows x86-64

pyvirtualcam-0.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pyvirtualcam-0.10.0-cp39-cp39-macosx_10_9_x86_64.whl (258.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pyvirtualcam-0.10.0-cp38-cp38-win_amd64.whl (167.7 kB view details)

Uploaded CPython 3.8Windows x86-64

pyvirtualcam-0.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (139.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

pyvirtualcam-0.10.0-cp38-cp38-macosx_10_9_x86_64.whl (258.3 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

pyvirtualcam-0.10.0-cp37-cp37m-win_amd64.whl (167.7 kB view details)

Uploaded CPython 3.7mWindows x86-64

pyvirtualcam-0.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142.3 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

pyvirtualcam-0.10.0-cp37-cp37m-macosx_10_9_x86_64.whl (257.7 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

File details

Details for the file pyvirtualcam-0.10.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ac08c41c0e9bda08f63a069b5112fa36fb4037e9b533eb88611ca02689343a1f
MD5 a1c82b2b8e9846549f82b2d9a7a3007b
BLAKE2b-256 888298823dd636646be1556f3692f065944c94f9b21334b76155726511b19b9f

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b03b811376c7492ddbfe5e636db9695c9b872cee23cc8bd2f2c443e9a25d910
MD5 130d2eaa5f86ce67943ed84349a38674
BLAKE2b-256 c70ebd142051e887116a45d11ced7db51c10019e0ea1f9fd0a8f6abfca27f342

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.10.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fd2305a23dcb72bdab63269195f1c09efc4a577ca698dac58b21daf36d481d41
MD5 efd12f0f0388e192d63f37439c78e968
BLAKE2b-256 47e194899c32444efb08d602e52cf053f732897b37b3b5528bcdbaddec062969

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2241675af6bfabfcdb946cfc740a1002aab047505ddc95feb7815c93f1f95734
MD5 f64cc3d89e5528b5c497b053f0bac754
BLAKE2b-256 f33276d78eb6c6bba55e00e5b7eac49710ae8dc9516604afd89c22fd8dc68c56

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58bc150bff898df406b80af4399f75506ba8f15b1196f1fc8510b64a98734861
MD5 2d68e31e7813d142dc4d4a51b7245dec
BLAKE2b-256 485d75275b91ca273146e7616c088a824dbf1ef89ecaaae06c0bb69c8f746e84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 526c840daac94d340c2a9014761137b1ff82815d7a5b0bad145b29b5ba76591b
MD5 fd09d42676bc0e19f0d6abcc735f2de1
BLAKE2b-256 f2d7f455a77216d7fb6939f6e01eda713ed28e47355a4fbf46036e4ad7026587

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 718bcbcdb7213bc711f7174b71cd486dbe0710fef59f86f488defda8594f946e
MD5 ca313773dd29cefb201dc49ba760b536
BLAKE2b-256 f22f8ed627708ac6fec8f307538c457da6bfdaf2cd1c72e12aed5fe40e8f1c65

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5707d3a7c62f6e1cf7f602eb2b4eaf39e6a825ee9dcf5a55bb7e5c213389518b
MD5 58a7ecd06b70157cb1ff6e7d7d0c5528
BLAKE2b-256 ab010bab0450884b770def57012d1676d819674f04f2ddaef9ca9acab8e7275f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cecb4d15c95f56f47566b8fd3ca1feca02c7410f49b8fbae357824604060c097
MD5 ceb49ad45f0d0126e181e4d9c5007b51
BLAKE2b-256 f7d89c8146a6dfc6d502c2993b97a29afbc3c044b14d02b7e8dacb74a5c1689b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e5050bf8344de685e0ecd12b41df68401db3aafde5c59c311253fb87fc946fc3
MD5 88af3dcb7711ea096f23f8f1a3578ee0
BLAKE2b-256 a31c6013fbc44604c5f405a2a93f79526f040480203d88920325ce1e11a9d424

See more details on using hashes here.

File details

Details for the file pyvirtualcam-0.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc87bdeb0e6129e4ef87615430e36840b56ef9a907ca51b75f3701d46249dce6
MD5 337b8dca45eeabdc928bbb3e848db3b1
BLAKE2b-256 4a1b3354f19e85578d25cc8a2663c90756aec020fad680af167438e3ab6349db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyvirtualcam-0.10.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c63d132a900159283ae9d6a9adfec7489ba2c60e1cfa9e9d98625ebefa473df3
MD5 600c778fb68481ace1985593b0be4f6c
BLAKE2b-256 0362745cbc7f2c822e0f6d2f18ce9c1fa979a50247ae65e786b48f74a5a0773c

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