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.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a41f1ebfa9d47ddf0b63c68ba124547511942926fff98d3041ceaf11ef47c23f |
|
MD5 | a262c900ece3ce65e092d848b62d9967 |
|
BLAKE2b-256 | 49295934501efd13da58b631a05734cfa423af33b2adf4932ce10e894a8de555 |
Hashes for pyvirtualcam-0.3.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 365062f55073c8afea6a64ae464d7ec51e7a65efd1e6598dc0f14a0bb0c18516 |
|
MD5 | 0c9a2abf0b428f15c0bed99f245b6668 |
|
BLAKE2b-256 | 4af853c691eca9b7b42538f26f9422cee3c51f55443d29e942a1ce200a898b5f |
Hashes for pyvirtualcam-0.3.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 672b8a670259d8fc92cdb475c7fde2c39c393cb92b911bbf2dd1dd6b5b45f975 |
|
MD5 | 3fdcdacb857ad96fde817c6dd809ddae |
|
BLAKE2b-256 | 1cc6d663e19d2b8d52dbfa0933b65464f96eac937472fe585cda27d50fc11e8a |
Hashes for pyvirtualcam-0.3.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db9b184d0e198086bf0f7c68366b9945bd5c2af748cee250552a0c71d107f85e |
|
MD5 | 8e12a2d8395a111e14c7b69fb8464028 |
|
BLAKE2b-256 | e1219074d519f1a299a007189602c83b45e3536990418463e01ee31f06f38af5 |