-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Description
Platform
Operating system and version: Windows 7 64 bit
OBS Studio version: 26.0.2 64 bit
Python version: Python 3.6 64 bit
Expected Behavior
Built-in virtual camera should be usable with OpenCV python package
Current Behavior
OpenCV window shows black screen if OBS Virtual Camera
is selected.
Steps to Reproduce
- Start virtual camera
- Run
check_cv.py
Additional information
Black screen
However OpenCV works with obs-virtual-cam plugin, if OBS-Camera
is selected.
Code used to check it:
# check_cv.py
import numpy as np
import cv2 as cv
def check_cam_by_index(i):
cap = cv.VideoCapture(i)
cap.set(cv.CAP_PROP_FRAME_WIDTH, 1280)
cap.set(cv.CAP_PROP_FRAME_HEIGHT, 720)
if not cap.isOpened():
print("Cannot open camera")
exit()
while True:
# Capture frame-by-frame
ret, frame = cap.read()
# if frame is read correctly ret is True
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
cv.imshow('frame',frame)
if cv.waitKey(1) == ord('q'):
break
# When everything done, release the capture
cap.release()
cv.destroyAllWindows()
def check_multiple():
for i in range(-1,10):
try:
print(f'checking camera #{i}')
check_cam_by_index(i)
except:
continue
#check_multiple() # 2 is index of OBS Virtual Camera , 0 is index of OBS-Camera
check_cam_by_index(2)
I've tried reinstalling OBS, virtual cam drivers, running it as admin - same result.
Also, built-in virtual webcam is accessible from imageio by index, but with high CPU usage.
chop0, Unmoon, bartlomiejzuber, Denbergvanthijs, janeoa and 15 more
Metadata
Metadata
Assignees
Labels
No labels