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.

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.

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.6.0-cp39-cp39-win_amd64.whl (106.4 kB view details)

Uploaded CPython 3.9Windows x86-64

pyvirtualcam-0.6.0-cp39-cp39-manylinux2014_x86_64.whl (129.4 kB view details)

Uploaded CPython 3.9

pyvirtualcam-0.6.0-cp39-cp39-macosx_10_9_x86_64.whl (251.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pyvirtualcam-0.6.0-cp38-cp38-win_amd64.whl (106.8 kB view details)

Uploaded CPython 3.8Windows x86-64

pyvirtualcam-0.6.0-cp38-cp38-manylinux2014_x86_64.whl (129.0 kB view details)

Uploaded CPython 3.8

pyvirtualcam-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl (251.6 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

pyvirtualcam-0.6.0-cp37-cp37m-win_amd64.whl (107.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

pyvirtualcam-0.6.0-cp37-cp37m-manylinux2014_x86_64.whl (130.0 kB view details)

Uploaded CPython 3.7m

pyvirtualcam-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl (250.8 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

pyvirtualcam-0.6.0-cp36-cp36m-win_amd64.whl (107.1 kB view details)

Uploaded CPython 3.6mWindows x86-64

pyvirtualcam-0.6.0-cp36-cp36m-manylinux2014_x86_64.whl (130.0 kB view details)

Uploaded CPython 3.6m

pyvirtualcam-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl (250.8 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 106.4 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.6.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cb2152cd677cff402cc6fe3644161fa326eeb5a2ee687db837f1cf6056332846
MD5 aa80390dd68f628e496a1889d5ac566e
BLAKE2b-256 dcfe98ec81fab51b7d79e542978fd95cd02b60ad3cfbdce5bad59d1f496a0a75

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp39-cp39-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 129.4 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.6.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5fd2358e6d3157343c105890cddb2a77129f25cf293cad88b950b647256b8786
MD5 d9eeba7f8bdf6574976b0e16c3ec1ba8
BLAKE2b-256 7956b24636150ab9201778a108d235ed9fb197d23d76f36a08d9d9a71b287e44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 251.7 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.6.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 13de95b60a333836e578f3ab4fac6931eb92603dcedf8f91c6e12d8e53704ab3
MD5 b58dc865c18b6b3415b79d4be1dfb2d1
BLAKE2b-256 4f77e8abab90b5996f7902c61e52d3fbf8993fc709e9fd81fcca94079039ae54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 106.8 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.6.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 00a183363315cbc50300f2443251005d147f05e880471359fb746c85174ebcdd
MD5 bde4ac037079cacc83a2fe318bdf2fe4
BLAKE2b-256 d311df3b48bcdac8d9e7b2a79d43607df55c85d738cef25bf91df5fab784312e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 129.0 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.6.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2985e5d44578548bfb4a2d7a43c2a1a1ab3ae850190136c2213541f6cfb3c09e
MD5 a042db98e4b89887d1d57d14e4dcb4cf
BLAKE2b-256 7007fe5fb7ff7f39c08e77496bb6e80edc8ecba083f4a62314070eff7b3f1978

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 251.6 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.6.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5af7d1b50767c1b371ade47cb6e52eacbc1b455440159e3ccf9ed98a231b2197
MD5 dcf3a95e08ae628c6b8df9a9759093d5
BLAKE2b-256 e7d0da9fa2bd6897925df4530489fd28f835d8f15dc1d7f1ff38148fe1586028

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 107.1 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.6.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 210966d4e0e3e9fcd29b3bef48fb573ecab6d55afc96fb91f4aa02461377d2de
MD5 56be2f333477e1af3dbc88787f227803
BLAKE2b-256 cf0557e1f0b00b25d5096578953e561046432860e70a343aef885eb36c6efcdf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 130.0 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.6.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23e94936aaeadba11d6864bc4363d8ef72a19ed5d6b242f274f020e03c3a60be
MD5 2fc403a757d1e1e133cd502560328a43
BLAKE2b-256 1a45dbc584c3a1fb68c84df8ef2d55e6b197874f643a3fec53fee15d51e604d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 250.8 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.6.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 20d7a0ec3d523d355c317c84c8b3b410267e9e1503e79ab886a92432ac0e72e0
MD5 028545db8b74c6e0381c58c1afc7ae2e
BLAKE2b-256 6bf6e13cc2038bc38ba0c86b56e1b9176bf808cd02ddbfc39535b60e616aa221

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 107.1 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.6.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 9908d12c966c4b72fe72077ac5fceb06cab401c5de13574fb0ec9b2537578e8b
MD5 5122847a663357736fe95205202c0bfb
BLAKE2b-256 a0c39dfe6c75bd4278fb425107246747c2aa336b4c471fa4634000f01d5b8da6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 130.0 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.6.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5664256038771f056876fed86184cb1699bfe5896eab5518032ca112459b16c0
MD5 9e6ba2bc83f0bb09da518a249f12675b
BLAKE2b-256 de995f9d28ae093ff8be991c30373b40e1d5d9061d4f1fa14823d27ddcdfefd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyvirtualcam-0.6.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 250.8 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.6.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3ac2ef924b93242cdea60133e35157d680e89e93f36780c61043c5b999278897
MD5 5bd75dbd7cd139b5939e81e3547835c3
BLAKE2b-256 40c0a258610263e5ea808ef4cdd4375c79593144aedb38942eae308aac8d4ba9

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