geerlingguy / pi-webcam

Automation to configure a Raspberry Pi as a USB OTG webcam
https://www.youtube.com/watch?v=8fcbP7lEdzY
MIT License
1.4k stars 98 forks source link

Low FPS in Google Meet and issues in Microsoft Teams #14

Closed szwecja closed 3 years ago

szwecja commented 3 years ago

Hi @geerlingguy,

Great project. I have made it work on my Mac. It works perfectly with Zoom, FaceTime. I have problems with:

Thanks, Tomasz

geerlingguy commented 3 years ago

I haven't had those issues; Google Meet was actually the most reliable/best experience on the Pi itself in Chromium.

Have you tried rebooting the Mac (and thus also rebooting the camera at the same time) and seeing if that helps?

szwecja commented 3 years ago

Tried to restart all, checked on another Mac. Changing into lower resolution in Meet (to 360p) does not help. It is pretty strange, since in Zoom and FaceTime it works perfectly.

geerlingguy commented 3 years ago

@szwecja - That is very strange! Can you log into the Pi via SSH and view the logs from the piwebcam service (journalctl -f -u piwebcam then Ctrl-C to stop watching the logs). Maybe something in the camera negotiation is kind of blowing up. Definitely a strange issue that I haven't seen before!

szwecja commented 3 years ago
Dec 01 16:46:43 raspberrypi-kamera systemd[1]: Started Pi webcam.
Dec 01 16:46:44 raspberrypi-kamera sudo[274]:       pi : TTY=unknown ; PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uvc-gadget/multi-gadget.sh
Dec 01 16:46:44 raspberrypi-kamera sudo[274]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 01 16:46:48 raspberrypi-kamera sudo[274]: pam_unix(sudo:session): session closed for user root
Dec 01 16:46:49 raspberrypi-kamera sudo[387]:       pi : TTY=unknown ; PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uvc-gadget/uvc-gadget -f1 -s1 -r0 -u /dev/video1 -v /dev/video0
Dec 01 16:46:49 raspberrypi-kamera sudo[387]: pam_unix(sudo:session): session opened for user root by (uid=0)
szwecja commented 3 years ago

I have also noticed, that in Meet for first second the image is good, then it is getting choppy...

szwecja commented 3 years ago

And on Windows laptop it works OK...

geerlingguy commented 3 years ago

@szwecja - Hmm, one other question: How do you have the camera plugged in? Two things I can think of to try:

  1. If it's plugged in through a hub, try plugging in direct (or through a different hub). Some hubs have strange power behavior (even if they have their own power supply).
  2. Try a different micro USB cable. I know one other person had issues (different than yours) that were solved by using a different cable.
szwecja commented 3 years ago

Tried all of that :) plus deinstalling AdBlocks, etc. No luck. I will do a fresh reinstall of the MacOS during the weekend (wanted to do it anyway) and will let you know. Thanks.

maparker commented 3 years ago

Came here just to report the same thing and saw that I was not the only one with the issue. I had a couple meetings today and only saw the low FPS in the Google Meet meetings. On macOS Big Sur, have not yet tested on the Windows side.

szwecja commented 3 years ago

Also just to let you all know, did Google Meet on completely fresh Big Sur install and video was still low DPS.

starbasessd commented 3 years ago

Out of curiosity do you have an older Mac, and does it happen there, too?

On Thu, Dec 3, 2020 at 5:18 PM Tomasz Domagalski notifications@github.com wrote:

Also just to let you all know, did Google Meet on completely fresh Big Sur install and video was still low DPS.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/geerlingguy/pi-webcam/issues/14#issuecomment-738363187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZTUHN2JBMBT2RJTU3JEG3STAFBRANCNFSM4UJC7BZQ .

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

szwecja commented 3 years ago

Not really. I have MacBook Pro 15' 32GB RAM from 2018 with Radeon Pro Vega 16 / 4 GB HBM2. Zoom and others works perfectly.

mackemint commented 3 years ago

Related behavior here, on a Catalina hackintosh with dedicated GPU. Facetime is flawless, Discord misbehaves though. Using Brave browser (Chromium-based) the FPS is really low and choppy. Using the Discord desktop app, the camera works great initially but after about a minute or so the resolution and framerate drop. On my other system (2015 MBP) running Mojave I can confirm the same behavior for Brave browser (slow and choppy video) but using the camera with the Discord app has perfect performance.

Checking the logs through a serial connection (no wifi on the pi) produces the same logs as for @szwecja

silverman commented 3 years ago

I have the same issue with instant Teams crashing on a modern Mac (2017 MacBook Pro on macOS 10.15.7). It is a way different problem from the current title of this issue. Do they have a common cause? Or does it make sense to create a separate issue?

GoToMeeting also has trouble, but it's less of an instant crash so I can't as easily duplicate it all day long. It only started in GoToMeeting after I switched the aspect ratio to 16:9.

mackemint commented 3 years ago

I can confirm the same problem that @silverman reported. This is applicable for both 720p and 1080p Pi Webcams. I've extracted the log from Teams but I can't make much sense of it. The only hint that I can find are these lines that show up here and there. deviceManager: getSelectedDevices: {"camera":"0x141000001d6b0104","microphone":"AppleHDAEngineInput:1B,0,1,0:1","speaker":"AppleHDAEngineOutput:1B,0,1,1:0"} hidDeviceManager: [hidDeviceManager]: enableHidSelectedDeviceFixForWin1809Build is true, recompute selected mic hidService: [registerCallbacksForSpecificDeviceEvents]: Invalid or non-hid device, unable to register callbacks

Attaching diagnostics log from Teams MSTeams Diagnostics Log 2020-12-14_21_46_46.txt

Edit: Installing OBS virtual camera works as a temporary workaround in both Teams desktop and web app, I'll try sending a bug report to MS and see what they say.

mackemint commented 3 years ago

Someone in the comments of the original David Hunt article suggested this change to remedy issues in Teams:

"I was able to get it to work with Teams by changing this line of /home/pi/uvc-gadget/multi-gadget.sh

/sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/1080p/dwFrameInterval 5000000

to

/sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/streaming/mjpeg/m/1080p/dwFrameInterval 333333

and rebooting the pi. It’s been working great for about a week now!"

I'll try this out later and report back.

geerlingguy commented 3 years ago

@mackemint - Ha, someone just emailed me the same note this morning, and he said that it seems to have fixed the issue in Teams for him, for over a week.

It would be great to hear from others if that solves your issues, and if so, maybe the default could be changed...

maparker commented 3 years ago

This change resolved the problem for me.

silverman commented 3 years ago

The 720p version of the solution of @mackemint fixes the Teams problem for me!

szwecja commented 3 years ago

@geerlingguy Indeed the change suggested by @mackemint did change everything. Now both Teams and Google Meet work with correct video. I am running in 720p on MacBook Pro. Thanks all!!

mackemint commented 3 years ago

Tried this with 1080p settings. All the issues I experienced previously seem resolved now

Yay!

edit: Updated my PR to uvc-gadget repo with correct values for dwFrameInterval

mackemint commented 3 years ago

To everyone watching this, if anyone of you have the opportunity to clone my fork and check if my 1080p modifications work out of the box for you too, geerlingguy can merge this into main of his repo. My pull request: https://github.com/geerlingguy/uvc-gadget/pull/4

Install instructions are identical, just clone my repo and follow the other install instructions as usual. :) Swap this line: git clone https://github.com/geerlingguy/pi-webcam.git For this line: https://github.com/mackemint/pi-webcam.git

trek2710 commented 3 years ago

Had same issue with only Teams crashing on Mac (through USB hub). Changing dwFrameInterval to 333333 solved it.

szwecja commented 3 years ago

Thank you all for solving this issue. Merry Christmas to all!!

geerlingguy commented 3 years ago

I believe this has been fixed by https://github.com/geerlingguy/uvc-gadget/pull/5 — thanks!