Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fake.py freaks out when trying to access with chrome #25

Closed
mtedaldi opened this issue May 16, 2020 · 6 comments
Closed

fake.py freaks out when trying to access with chrome #25

mtedaldi opened this issue May 16, 2020 · 6 comments

Comments

@mtedaldi
Copy link

Hi. Since I have no Webcam on my system I had to do a few more tricks. I'm using my DSLR as webcam via gphoto2 and v4l2loopback. So my modprobe looks like this

sudo modprobe v4l2loopback video_nr=0,2 exclusive_caps=1,1 card_label="EOS 7D mkII","Fake Webcam"
(Creating 2 devices, video0 and video2, each with exclusive_caps=1).

This way I can run the software without any changes. I can access both streams with VLC and everything runs fine.

BUT when I want to access the Webcams from google chrome (using jitsi for video chat), fake.py "freaks out". Seems, it can't get the mask anymore.

marco@schwipschwap:~/build/Linux-Fake-Background-Webcam/fakecam$ python3 fake.py -f 12
Running...
Please CTRL-C to reload the background / foreground images
Please CTRL-\ to exit
Mask request failed, retrying: OpenCV(4.2.0) /io/opencv/modules/imgproc/src/resize.cpp:4045: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

Traceback (most recent call last):
  File "fake.py", line 106, in get_frame
    mask = await self._get_mask(frame, session)
  File "fake.py", line 56, in _get_mask
    frame = cv2.resize(frame, (0, 0), fx=self.scale_factor, fy=self.scale_factor)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/imgproc/src/resize.cpp:4045: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

It's the same behaviour with or without the option "- f 12". That's just that my camera doesn't deliver more FPS over USB, so why should I waste a lot of processing power.

Tested jitsi with Firefox and there is no issue (but Jitsi is unbearably sluggish in firefox).

There are quite some people having issues accessing v4l2loopback "cameras" with chrome. But they normally just get "no picture" or "device not detected". But that chrome seems to be able to crash the video source seems really strange!

@fangfufu
Copy link
Owner

This is the limitation of v4l2loopback, please refer to umlaeute/v4l2loopback#78.

@mtedaldi
Copy link
Author

Sadly, this does not really help. In my case, the "cam" IS detected but fake.js stops working as soon as I connect with chrome.
I'm guess, it's really a problem with chrome but the behaviour is different (or I missed the relevant information there).
(No, I did not read the whole thing in 6 minutes, I've read this stuff before opening the issue here)

@fangfufu
Copy link
Owner

Well, my point is that this problem has got nothing to do with these scripts. It has got to do with Chrome or v4l2loopback.

@fangfufu
Copy link
Owner

@mtedaldi, you could potentially output stream of this webcam to webcamoid + akvcam, if you are desperate for chrome.

@fangfufu
Copy link
Owner

fangfufu commented Jun 3, 2020

@mtedaldi , I added support for akvcam, it should work with Chrome.

@mtedaldi
Copy link
Author

Thank you very much! I'll try as soon as possible!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants