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, 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.
pyvirtualcam uses the first available v4l2loopback virtual camera it finds.
The camera device name can be accessed with cam.device
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pyvirtualcam-0.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6fc8cdbd83a2325c20f1b16302dddb06ed2dade36bd16d2ee2c34b2808d41ba |
|
MD5 | e011ec5cc53d227393b76cec0167993f |
|
BLAKE2b-256 | 38bb02b3167bfe45f72cdbc98e74e6fee7247655450e6f4859b6f7d8c2c42902 |
Hashes for pyvirtualcam-0.4.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f566331389ae23a93dddeb821d7bd4c9cf95906fa95009eaa77d166b6d7b3e61 |
|
MD5 | 2d9a8d75f4ce3b34e77310bc23aad14b |
|
BLAKE2b-256 | cb87c56c81336817efdc67e94f05cd43d9131d2e5e736d02a934b153b107b5a8 |
Hashes for pyvirtualcam-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b443435791c561322db9ce09b8915e58caeeff7fae2abf654fea1245d98cce71 |
|
MD5 | b338d73ff7a6f7b9a46657d38d53e186 |
|
BLAKE2b-256 | 5ee6e395fa068e66b64fb8138f0755dae6301a087c0ae18628b6f7446fd068ab |
Hashes for pyvirtualcam-0.4.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f42250d1c5bbe1dc270173877efd3855805d3f8fe4c6c2fa5ad7eaa9a62e8b6 |
|
MD5 | 35b005e822cf09d27527e71dc1d1954b |
|
BLAKE2b-256 | b3d45a5b20427fd8540a372e8689d23102ebdfbecb64f33b1c35b20b885c1723 |
Hashes for pyvirtualcam-0.4.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32e3d2390f4cd098d892bd69772b5b41d73f0192e638f79fb0a5e2a421f5631e |
|
MD5 | 0a7b075013f565040726815d8903cef0 |
|
BLAKE2b-256 | 2e902e582bf0fc5fcdc09f53937370653e498989718d53d9f27087878e5ff615 |
Hashes for pyvirtualcam-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be25cdf62c3b07819ef5ed4cb9094da0828126bf9011b814d3648f3fa9bfcfdb |
|
MD5 | dc25d7bb716790f46f44744000d8c593 |
|
BLAKE2b-256 | 140d93ea5be51ed38f1536131567411d801579f8c27d43275f5bd341314709fd |
Hashes for pyvirtualcam-0.4.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05de747f8f2d855b189b77299e7d9a8a6d3f51c48e349d035360b5b52f5b6476 |
|
MD5 | da28c4a1adfa099143a3f359f6c1d7a5 |
|
BLAKE2b-256 | 0e8e87af2e0bd04d9a5f51aa848eeb4f4782a77a105a648e03ff38ddd6de639f |
Hashes for pyvirtualcam-0.4.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cfbc7f282d3f21e9b051907dc2270db0b03cfaad640de8dd40865637115b469 |
|
MD5 | 4903c9a18374da8e21653292afae48ee |
|
BLAKE2b-256 | b5ad5216787d9382ec63fba5de243996cf21507698ee6497f46435b3f65d3db8 |
Hashes for pyvirtualcam-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b22432d39548abd6b25ab941c9d886706024ac56141a3cb726e2e62f6b821e75 |
|
MD5 | 4c42a796ae35ce44d55b0c2e8a9b0d8c |
|
BLAKE2b-256 | 0773535e66d704a1d42a40ccc74c3e7abba1480a6ffd463223b63529d31ea045 |
Hashes for pyvirtualcam-0.4.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bf694975066a46dc36f4ef775c194dc1b62a9315eb0b59f7dca02dd71d90dc5 |
|
MD5 | a190b168aa894b19537404ec7a555167 |
|
BLAKE2b-256 | 442d0f94e25f8997f7907bb3e0dabef8156d00455394dfdbc986580b9cc765e5 |
Hashes for pyvirtualcam-0.4.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23cb4502c980b586e09bff475d8f76a50827f65e012b69a863a7637d065b2655 |
|
MD5 | 184decd332b5d5d56ca345e76894c54f |
|
BLAKE2b-256 | ca8d1488ff85414b541835d0c6a427be8249f2def79ea6abd870794bdd2d8967 |
Hashes for pyvirtualcam-0.4.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08e15648930fa8f5eaa48d476223787d37a45d1f228af2ecb8a100f9823d454f |
|
MD5 | 158fd5d6122f94ee1f907227f7725468 |
|
BLAKE2b-256 | b7f6d8ca59bb224191c8ddb1ca61d4feb106b05cae85d02f7dc0c376b351488c |