Faking your webcam background under GNU/Linux, now supports background blurring, animated background, colour map effect, hologram effect and on-demand processing.
GNU General Public License v3.0
1.61k
stars
161
forks
source link
Google Meet switching from real cam to fake cam results in black screen #194
I was trying to use this project in Google Meet. When the website is loaded the first time, it is using the real cam (I guess it's just determined by the order of the video devices). When switching to fake-cam, the following output is printed by fake.py:
[ WARN:0@7.411] global cap.cpp:204 open VIDEOIO(V4L2): backend is generally available but can't be used to capture by name
Real camera original values are set as: 0x0 with 0 FPS and video codec 0
Cannot set camera property 6 to 1196444237. Defaulting to auto-detected property set by opencv
Cannot set camera property 3 to 1280. Defaulting to auto-detected property set by opencv
Cannot set camera property 4 to 720. Defaulting to auto-detected property set by opencv
Cannot set camera property 5 to 30. Defaulting to auto-detected property set by opencv
Real camera new values are set as: 0x0 with 0 FPS and video codec 0
The problem here is most likely due to Google Meet trying to open the new video device before closing the old one, so the video device could not be opened by fake.py since it's still acquired by Google Meet. This could be solved by a simple change:
diff --git a/fake.py b/fake.py
index 629c5b9..946e951 100755
--- a/fake.py
+++ b/fake.py
@@ -18,6 +18,10 @@ from cmapy import cmap
class RealCam:
def __init__(self, src, frame_width, frame_height, frame_rate, codec):
self.cam = cv2.VideoCapture(src, cv2.CAP_V4L2)
+ while not self.cam.isOpened():
+ print("Failed to open camera: {}. retrying...".format(src))
+ time.sleep(1)
+ self.cam.open(src, cv2.CAP_V4L2)
self.get_camera_values("original")
c1, c2, c3, c4 = get_codec_args_from_string(codec)
self._set_codec(cv2.VideoWriter_fourcc(c1, c2, c3, c4))
I just hope there is nothing I am missing since nobody else seems to have this issue.
I was trying to use this project in Google Meet. When the website is loaded the first time, it is using the real cam (I guess it's just determined by the order of the video devices). When switching to
fake-cam
, the following output is printed byfake.py
:The problem here is most likely due to Google Meet trying to open the new video device before closing the old one, so the video device could not be opened by
fake.py
since it's still acquired by Google Meet. This could be solved by a simple change:I just hope there is nothing I am missing since nobody else seems to have this issue.