Slow framerate on some software that reads OBS Virtual Camera #94
-
I'm using a copy of the web_cam filter program to just use the camera as a passthrough for some testing (will add open cv on top of it). Here's the modified version: # This script is the sample from the README.
import cv2
import pyvirtualcam
cap = cv2.VideoCapture(1)
pref_width = 1280
pref_height = 720
pref_fps_in = 30
cap.set(cv2.CAP_PROP_FRAME_WIDTH, pref_width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, pref_height)
cap.set(cv2.CAP_PROP_FPS, pref_fps_in)
# native format UYVY
with pyvirtualcam.Camera(width=pref_width, height=pref_height, fps=15, fmt=pyvirtualcam.PixelFormat.BGR, print_fps=True) as cam:
print(f'Using virtual camera: {cam.device}')
print(f'Using {cam.native_fmt}')
# RGB
while True:
ret, frame = cap.read()
og_frame = frame
cam.send(og_frame)
cam.sleep_until_next_frame()
cv2.imshow('preview', og_frame)
cv2.waitKey(1) I noticed there's slow (really slow about 5ps) frame rate on MS Teams when it reads from the Compared to just using obs directly: For sanity, I also compared zoom with pyvirtualcamera and obs and the frame rate didn't seem to differ: I'm not entirely sure what other things I can do to diagnose this. I compared a bit what exists in: https://github.com/letmaik/pyvirtualcam/tree/main/pyvirtualcam/native_macos_obs vs https://github.com/obsproject/obs-studio/tree/master/plugins/mac-virtualcam And there seems to be a couple of changes around a memory leak and some IOSource stuff. I'm on an M1 Mac. To further muddle this, a test on a non M1 mac doesn't seem to suffer from the same problem, so I'm guessing it may be related to something with newer macs. I appreciate any insight you have and any time you take to read this through. Specs
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
On the non M1 Mac, did that run the same macOS version and OBS version? |
Beta Was this translation helpful? Give feedback.
-
This can be closed, see #100 |
Beta Was this translation helpful? Give feedback.
This can be closed, see #100