PiCam stream stopped working after a reboot

The Raspberry Pi camera worked properly until today morning. Currently I got the error

"Webcam stream not loaded"

If I check the webcamd status I get:

webcamd.service - the OctoPi webcam daemon with the user specified config
Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Wed 2020-07-08 17:57:18 CEST; 4min 54s ago
Process: 571 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
Jul 08 17:57:18 octopi systemd[1]: webcamd.service: Service RestartSec=100ms expired, scheduling restart.
Jul 08 17:57:18 octopi systemd[1]: webcamd.service: Scheduled restart job, restart counter is at 5.
Jul 08 17:57:18 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.
Jul 08 17:57:18 octopi systemd[1]: webcamd.service: Start request repeated too quickly.
Jul 08 17:57:18 octopi systemd[1]: webcamd.service: Failed with result 'start-limit-hit'.
Jul 08 17:57:18 octopi systemd[1]: Failed to start the OctoPi webcam daemon with the user specified config.

I get an appropriate response with the commands:
raspivid -v -o testvideo.h264 -t 5000
raspistill -v -o test.jpg
so I don't think it's a camera problem (Anyway I tried to replace the cable, but I got the same result).

Tried also to update and upgrade...

Any suggestion?

octoprint.log (25.4 KB)

/var/log/webcamd.log not found

I'm running octoprint 1.4.0 on Rasperry Pi 3B+

Edit 1:
I managed to get it to work with the commands:

git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
export LD_LIBRARY_PATH=.
make
./mjpg_streamer -i "./input_raspicam.so -fps 15" -o "./output_http.so"

So it's definitely not an hardware problem.

The question now is: what caused the previous problem? and how do I solve it? with this method the stream starts but I should write a script to lunch it at every reboot

Edit 2:
Doing a

sudo service webcamd restart
service webcamd status

I get this output:

  • webcamd.service - the OctoPi webcam daemon with the user specified config
    Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
    Active: activating (start) since Wed 2020-07-08 20:44:05 CEST; 505ms ago
    Cntrl PID: 2102 (webcamd)
    Tasks: 2 (limit: 2077)
    Memory: 872.0K
    CGroup: /system.slice/webcamd.service
    |-2102 /bin/bash /root/bin/webcamd
    `-2116 sleep 1
    Jul 08 20:44:05 octopi webcamd[2102]: /dev/video0
    Jul 08 20:44:05 octopi webcamd[2102]: /dev/video10
    Jul 08 20:44:05 octopi webcamd[2102]: /dev/video11
    Jul 08 20:44:05 octopi webcamd[2102]: /dev/video12
    Jul 08 20:44:05 octopi webcamd[2102]: raspi
    Jul 08 20:44:05 octopi webcamd[2102]: config file='/boot/octopi.txt':USB device was not set in options, start MJPG-strea
    Jul 08 20:44:05 octopi root[2114]: Starting USB webcam
    Jul 08 20:44:05 octopi webcamd[2102]: <13>Jul 8 20:44:05 root: Starting USB webcam
    Jul 08 20:44:05 octopi webcamd[2102]: Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 64
    Jul 08 20:44:05 octopi webcamd[2102]: /root/bin/webcamd: l< C3>< AD>nia 120: ./mjpg_streamer: El fitxer o directori no exi

Could my problem be related to the last line?

Edit 3:
I tried to set "raspi" (instead of "auto") in octopi.txt and now in journalctl -u webcamd

Jul 09 17:37:38 octopi webcamd[20528]: Starting up webcamDaemon...
Jul 09 17:37:38 octopi webcamd[20528]: --- Configuration: ----------------------------
Jul 09 17:37:38 octopi webcamd[20528]: cfg_file: /boot/octopi.txt
Jul 09 17:37:38 octopi webcamd[20528]: camera: raspi
Jul 09 17:37:38 octopi webcamd[20528]: usb options: -r 640x480 -f 10
Jul 09 17:37:38 octopi webcamd[20528]: raspi options: -fps 10
Jul 09 17:37:38 octopi webcamd[20528]: http options: -w ./www-octopi -n
Jul 09 17:37:38 octopi webcamd[20528]: Explicitly USB device:
Jul 09 17:37:38 octopi webcamd[20528]: -----------------------------------------------
Jul 09 17:37:38 octopi webcamd[20528]: Found video devices:
Jul 09 17:37:38 octopi webcamd[20528]: /dev/video0
Jul 09 17:37:38 octopi webcamd[20528]: /dev/video10
Jul 09 17:37:38 octopi webcamd[20528]: /dev/video11
Jul 09 17:37:38 octopi webcamd[20528]: /dev/video12
Jul 09 17:37:38 octopi webcamd[20528]: raspi
Jul 09 17:37:38 octopi webcamd[20528]: config file='/boot/octopi.txt':Start MJPG-streamer with video device: raspi
Jul 09 17:37:38 octopi root[20539]: Starting Raspberry Pi camera
Jul 09 17:37:38 octopi webcamd[20528]: <13>Jul 9 17:37:38 root: Starting Raspberry Pi camera
Jul 09 17:37:38 octopi webcamd[20528]: Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_raspicam.so
Jul 09 17:37:38 octopi webcamd[20528]: /root/bin/webcamd: lnia 120: ./mjpg_streamer: El fitxer o directori no ex
Jul 09 17:38:09 octopi webcamd[20528]: Done bring up all configured video device
Jul 09 17:38:09 octopi webcamd[20528]: Goodbye...
Jul 09 17:38:09 octopi systemd[1]: webcamd.service: Succeeded.
Jul 09 17:38:09 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Jul 09 17:38:10 octopi systemd[1]: webcamd.service: Service RestartSec=100ms expired, scheduling restart.
Jul 09 17:38:10 octopi systemd[1]: webcamd.service: Scheduled restart job, restart counter is at 4.
Jul 09 17:38:10 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.
Jul 09 17:27:49 octopi webcamd[19959]: /dev/video10
Jul 09 17:27:49 octopi webcamd[19959]: /dev/video11
Jul 09 17:27:49 octopi webcamd[19959]: /dev/video12
Jul 09 17:27:49 octopi webcamd[19959]: raspi
Jul 09 17:27:49 octopi webcamd[19959]: config file='/boot/octopi.txt':Start MJPG-streamer with video device: raspi
Jul 09 17:27:49 octopi root[19970]: Starting Raspberry Pi camera
Jul 09 17:27:49 octopi webcamd[19959]: <13>Jul 9 17:27:49 root: Starting Raspberry Pi camera
Jul 09 17:27:49 octopi webcamd[19959]: Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_raspicam.so
Jul 09 17:27:49 octopi webcamd[19959]: /root/bin/webcamd: lnia 120: ./mjpg_streamer: El fitxer o directori no ex
Jul 09 17:28:20 octopi webcamd[19959]: Done bring up all configured video device
Jul 09 17:28:20 octopi webcamd[19959]: Goodbye...
Jul 09 17:28:20 octopi systemd[1]: webcamd.service: Succeeded.
Jul 09 17:28:20 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Jul 09 17:28:20 octopi systemd[1]: webcamd.service: Service RestartSec=100ms expired, scheduling restart.
Jul 09 17:28:20 octopi systemd[1]: webcamd.service: Scheduled restart job, restart counter is at 761.
Jul 09 17:28:20 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.
Jul 09 17:28:20 octopi systemd[1]: Starting the OctoPi webcam daemon with the user specified config...
Jul 09 17:28:21 octopi webcamd[19983]: Starting up webcamDaemon...
Jul 09 17:28:21 octopi webcamd[19983]: --- Configuration: ----------------------------
Jul 09 17:28:21 octopi webcamd[19983]: cfg_file: /boot/octopi.txt
Jul 09 17:28:21 octopi webcamd[19983]: camera: raspi
Jul 09 17:28:21 octopi webcamd[19983]: usb options: -r 640x480 -f 10
Jul 09 17:28:21 octopi webcamd[19983]: raspi options: -fps 10
Jul 09 17:28:21 octopi webcamd[19983]: http options: -w ./www-octopi -n
Jul 09 17:28:21 octopi webcamd[19983]: Explicitly USB device:
Jul 09 17:28:21 octopi webcamd[19983]: -----------------------------------------------
Jul 09 17:28:21 octopi webcamd[19983]: Found video devices:
Jul 09 17:28:21 octopi webcamd[19983]: /dev/video0
Jul 09 17:28:21 octopi webcamd[19983]: /dev/video10
Jul 09 17:28:21 octopi webcamd[19983]: /dev/video11
Jul 09 17:28:21 octopi webcamd[19983]: /dev/video12
Jul 09 17:28:21 octopi webcamd[19983]: raspi
Jul 09 17:28:21 octopi webcamd[19983]: config file='/boot/octopi.txt':Start MJPG-streamer with video device: raspi
Jul 09 17:28:21 octopi root[19995]: Starting Raspberry Pi camera
Jul 09 17:28:21 octopi webcamd[19983]: <13>Jul 9 17:28:21 root: Starting Raspberry Pi camera
Jul 09 17:28:21 octopi webcamd[19983]: Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_raspicam.so
Jul 09 17:28:21 octopi webcamd[19983]: /root/bin/webcamd: lnia 120: ./mjpg_streamer: El fitxer o directori no ex
Jul 09 17:28:52 octopi webcamd[19983]: Done bring up all configured video device
Jul 09 17:28:52 octopi webcamd[19983]: Goodbye...
Jul 09 17:28:52 octopi systemd[1]: webcamd.service: Succeeded.
Jul 09 17:28:52 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Jul 09 17:28:52 octopi systemd[1]: webcamd.service: Service RestartSec=100ms expired, scheduling restart.
Jul 09 17:28:52 octopi systemd[1]: webcamd.service: Scheduled restart job, restart counter is at 762.
Jul 09 17:28:52 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.
Jul 09 17:28:52 octopi systemd[1]: Starting the OctoPi webcam daemon with the user specified config...
Jul 09 17:28:52 octopi webcamd[20007]: Starting up webcamDaemon...
Jul 09 17:28:52 octopi webcamd[20007]: --- Configuration: ----------------------------
Jul 09 17:28:52 octopi webcamd[20007]: cfg_file: /boot/octopi.txt
Jul 09 17:28:52 octopi webcamd[20007]: camera: raspi

it seems to have been trying to start the webcamDaemon all day..

I feel your pain..
Same problem here, seems to be around the same time that happened.
I just installed a fresh Octopi and was happy seeing a video stream from my c270 in the Chrome Browser after reading a ton of stuff on the net and these forums when I couldn't get it to work in Firefox.
Then I rebooted and the image is gone ever since.
I can access the camera page, but I only get blank images for both snapshot and stream...

1 Like

Hello @derZorn!

Firefox is quite over sensible with some things. You may try to disable the protection for the OctoPrint GUI with the little shield left to the address bar:

grafik

No problem, I use Chrome on most of my devices anyway.
The stream did work flawlessly on a number of devices including an Ipad , Notebook and Windows PC.
It just stopped for no reason that I can see.

So, since I am willing to solve that issue.
I started the whole process from scratch on another SD card.

  • I use a Raspberry Pi4b 2Gb.
  • use version '2019-09-26-octopi-buster-lite-0.17.0.img' to
  • freshly install on SD-Card as per instructions on octoprint.org
  • Camera works out of the box.
  • update to 1.4.0 as suggested by the screaming window on the top right
  • .. reload page
  • still working :slight_smile:
  • reboot Raspi
  • still working ! :smiley:
  • let's see what happens when I connect the Ender...

Ok, had a hunch and tried this....

And this is what I am seeing after I power down,cut the power and reboot..

What the ??
Any ideas ?

and another warm reboot later...

This is weird, and really unreliable. Why is this happening ?

Maybe a camera issue? Do you have another to test?

I fear I don't have another camera.
It seems the camera is not correctly recognized as chrome lists the webcam tab as 'webcam(640x480) .
The c270 should have an HD resolution (1280 x 720 px) .
So I set my
camera option in octopi.txt to reflect this.

camera_usb_options="-r 1280x720 -f 30"

after cold restart, I got a scrambled but widescreen image from the camera similar to the one above,
then I rebooted warm and the image is as intended...
Still weird, but I guess I can live with that for now.

I've been here before.
Now to connect the Ender...

1 Like

My problem is different... I'm unable to start the webcam daemon properly...
The raspi cam has no issue it works but the daemon doesn't start and I can't see anything in the control tab

Sorry for somewhat hijacking your post, hope you find a solution to your problem and post it here.

1 Like

After a fresh installation of OctoPi on another microsd every works again... I also restored a backup and everything seems to be ok...
Is there a metod to reinstall OctoPi without losing installations of other things (such as postgresql, multi-instance Octoprint, pyaes, scripts, etc.) it would take me a while to restore everything ... as long as I don't forget something...

[already tried to upgrade/downgrade, nothing happened]

1 Like

this worked for me https://www.reddit.com/r/octoprint/comments/f85szx/need_to_run_sudo_systemctl_restart_webcamd_over/

You modified /etc/systemd/system/webcamd.service and added After=octoprint.service in the Unit section? That's actually not a bad idea and could be incorporated into octopi if that resolves a lot of issues for others.

This too worked for me but only for 1 day. (i did soft reboots and all was good) Next day back to the snowy webcam. If i go to the terminal a 'sudo service webcamd restart' works. Strange problem.

Having the same issue on a clean install. I can boot without the c270 cam connected, plug the cam in after it boots and everything is good. But I get the same distorted video if I boot with the cam connected.