Send frames to a virtual camera
Project description
pyvirtualcam
NOTE: This package is a work-in-progress. No support is provided, use at own risk.
Usage
import pyvirtualcam
import numpy as np
with pyvirtualcam.Camera(width=1280, height=720, fps=30) as cam:
while True:
frame = np.zeros((cam.height, cam.width, 4), np.uint8) # RGBA
frame[:,:,:3] = cam.frames_sent % 255 # grayscale animation
frame[:,:,3] = 255
cam.send(frame)
cam.sleep_until_next_frame()
Installation
This package is Windows-only for now. Binary wheels are provided on PyPI.
pip install pyvirtualcam
The package uses obs-virtual-cam which has to be installed separately. Note that the obs-virtual-cam installer assumes an OBS Studio installation and will fail otherwise. You can also download and extract the obs-virtual-cam zip package directly without installing OBS Studio. After unzipping, simply run regsvr32 /n /i:1 "obs-virtualcam\bin\32bit\obs-virtualsource.dll"
from an elevated command prompt to install the virtual camera device. Use regsvr32 /u "obs-virtualcam\bin\32bit\obs-virtualsource.dll"
to uninstall it again.
Contributions
The most useful contributions would be to add support for macOS or Linux.
Similar to Windows, it may be possible in macOS to piggyback on https://github.com/johnboiles/obs-mac-virtualcam.
For Linux, it seems like https://github.com/umlaeute/v4l2loopback is the right dependency. Code from https://github.com/CatxFish/obs-v4l2sink may be useful as inspiration on how to send frames to the loopback 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.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f3a9fc10457b04028bfe4ec8a5886554526ece83841934976dcca0aeec62876 |
|
MD5 | 5c581b718362f15c1b90d89000b65ae8 |
|
BLAKE2b-256 | dbdfd3643a4d7c1ab93ab0fa42cbd262e90d832f0630a8a3e5b57fd613d9051f |
Hashes for pyvirtualcam-0.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a91640e7d32f3ba9f593cd698f9b22bf38e2999df398a7fbe369c64f8a42a61a |
|
MD5 | 50dcdf101f8092145a25c2a198456dfb |
|
BLAKE2b-256 | de3bc0e1ccc30e6bd5115c2c147df9e615f442aeaffe49c450267d5db3ac377a |
Hashes for pyvirtualcam-0.2.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c45eed81caf93ff2cac17afdb26f29c86d08d975087f24455e35e5880ccb2fa9 |
|
MD5 | 1d6fcbda6a8e9b7a83f6702d71f9114c |
|
BLAKE2b-256 | abc99e20dc0cacfbe571a2e9ddd20c6738fa71c36831136018e6f5af1966c167 |
Hashes for pyvirtualcam-0.2.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f82ab5a2b6bb3f6ca5a83c7c8a0c4e5e033bfe8d3a6c90e9dcbf50370dd41f6 |
|
MD5 | 92837263ea68c42c53abe1783a14042c |
|
BLAKE2b-256 | 6fa09e2d12009508d5dedf3d47547ad3d48b06636c75f92d2013fd0ab4520610 |