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. Check out pyfakewebcam for something that works on Linux.
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 the obs-virtual-cam zip package from https://github.com/CatxFish/obs-virtual-cam/releases without installing OBS Studio. After unzipping, from an admin command prompt, run:
regsvr32 /n /i:1 "obs-virtualcam\bin\32bit\obs-virtualsource.dll"
regsvr32 /n /i:1 "obs-virtualcam\bin\64bit\obs-virtualsource.dll"
To uninstall, run:
regsvr32 /u "obs-virtualcam\bin\32bit\obs-virtualsource.dll"
regsvr32 /u "obs-virtualcam\bin\64bit\obs-virtualsource.dll"
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. Also, there is https://github.com/jremmons/pyfakewebcam which may be a good candidate.
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.3.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f92d40f45d5fb83ca2edd3304532ef4d5f8ad3d0cee32378dcb63e67c7d98938 |
|
MD5 | 4095393c688d1846e774eab2572ada07 |
|
BLAKE2b-256 | 08ce91b230aa578df585d98ae9a8792d53233c5ae96316bd849c9d251214be94 |
Hashes for pyvirtualcam-0.3.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a40e0e7176de19d7669ac450cc64b3f499e36c1b2e957053dd6cf2ac678e64e |
|
MD5 | 9d6ca2f1333f2adb331a5e2b053a1e7b |
|
BLAKE2b-256 | fc35e632050cb67dee970fa5b209ed7689abfc20c5f97674d5d686f9a79eca91 |
Hashes for pyvirtualcam-0.3.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3174ad2471d55eeb449ae056d85c862fe7e7aec577a689b064bc6bb03bf0061 |
|
MD5 | aa5106bb489d8be62e87e14cb1f0273e |
|
BLAKE2b-256 | 4a6118ffdb3457c5358b1ce37fa1fbf6a7be21b7bbc100e7cdf944603a07d072 |
Hashes for pyvirtualcam-0.3.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 340432425023cc34091bdfc3b4a94dc6993fae6bb1a534102ab2190fbb876738 |
|
MD5 | 080d74b4c37179a31aa4c882dbb5da75 |
|
BLAKE2b-256 | 0fba01a86296ef259b760e5c88db8d0bd6013fd9637bf1942ce05383ce5f5ab3 |