Webcam freezing after a few seconds

Camera model
[https://www.amazon.de/gp/product/B07XCQKTQR/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

What is the problem?
Camera is freezing in Octoprint UI and if i view it directly over the Browser. It works for a few seconds again after a website refresh.
It worked a few days and then the problem started.

What did you already try to solve it?
-reboot in safe mode
-check if the webcam still works vorrectly (via windows 10)
-Check for too high temperature (36°C) or undervoltage (ok)
-down the resolution to 480p and frames to 1
-restart webcamd (got a timeout)

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)
octoprint.log (276.2 KB)
webcamd_recommended commands_after_timeout.log (3.0 KB)
webcamd.log (2.5 KB)

Additional information about your setup (OctoPrint version, OctoPi version, ...)
-latest stable Octoprintversion
-Raspberry Pi 4, 4GB
-3A power supply

Thanks for the help and thanks for the great software that Octoprint is! its amazing what some people can do with the right hardware and the right skills... always seems like magic to me :relaxed:

Had a similar problem with my two USB web cams on my pi 4+. I found somewhere that USB web cams had problems on USB3 so I changed them to the USB 2 ports, two printers, pi4's and cameras, and all is well.
A no cost solution that worked for me.

1 Like

Sorry for the late reply, a construction company dug on the street next to my house and cut my glass fiber in the process. not its working again :+1:
i tried using the USB2 Ports but the problem is still there.

I just purchased a new wlan-router because the one im using now seems to die soon (wlan cuts of from time to time and only works after a reboot) maybe the router is the problem.
Will write here when it is here and everything is set up and tested

1 Like

ok, installed the new router and the stream runs smoother (fps-wise) but it still freezes after 10-20 seconds and stays that way till i refresh

Not sure if it's same issue or different, but I noticed that systemd constantly restarts webcamd, and the stream freezes right when it restarts. I fixed the problem by changing Type=forking to Type=simple in /etc/systemd/system/webcamd.service and then running systemctl daemon-reload; systemctl stop webcamd; systemctl start webcamd.

6 Likes

That worked for me. Thank you.

1 Like

Spot on. Worked for me to!

Thanks Dude!

1 Like

THANKS!! Suffered with this too long.

1 Like

Over a year later, I just had the same issue, and this worked perfectly. It was also the first search result! Thanks!

Just in case this helps anyone: I've tried just about everything suggested for webcam issues from forking->simple to setting camera options but none of this worked for my Raspberry Pi Zero 2 W setup. I decided to test on my Raspberry pi 4 and everything worked just fine. Finally, I realized that the Zero 2 may not be outputting enough power on its micro USB port.

In /boot/config.txt I added this line: max_usb_current=1 at the bottom of the file and all my problems went away. I suspect the camera kept power cycling because it wasn't getting enough power from the USB port.

The default frame rate and resolution worked but I couldn't get stable behavior at 720p or 1080p like I could on my Raspberry Pi 4. I think to keep the build tidy and for monitoring purposes the default resolution is fine though. Hope this helped someone out.

I vhanged from simple to forking and that fixed it too