Problems with display at startup after power off Logitech C270

Camera model
Logitech C270

What is the problem?
Problems with displaying the stream on the first launch and sometimes on subsequent launches after turning off the raspberry pi3 b from the power supply.

What did you already try to solve it?
I tried changing the frame rate and camera resolution in the file octopi.txt, but it only got worse, sometimes to restore the image of the stream did not even help to restart the device

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)
There was no webcamd.log file in the var/log folder.

This was before the device was rebooted
This is what the camera shows when you first load it:
http://prntscr.com/xk3mgh
http://prntscr.com/xk3nr1

And so it was after the device was rebooted and the display was normal:
pi@OctoPrint:/var/log $ journalctl -u webcamd
-- Logs begin at Sun 2021-01-24 16:00:52 GMT, end at Sun 2021-01-24 17:01:13 GMT. --
Jan 24 16:00:56 OctoPrint systemd[1]: Starting the OctoPi webcam daemon with the user specified config...
Jan 24 16:00:56 OctoPrint webcamd[308]: Starting up webcamDaemon...
Jan 24 16:00:56 OctoPrint webcamd[308]: --- Configuration: ----------------------------
Jan 24 16:00:57 OctoPrint webcamd[308]: cfg_file: /boot/octopi.txt
Jan 24 16:00:57 OctoPrint webcamd[308]: camera: usb
Jan 24 16:00:57 OctoPrint webcamd[308]: usb options: -r 1280x960 -f 30
Jan 24 16:00:57 OctoPrint webcamd[308]: raspi options: -fps 10
Jan 24 16:00:57 OctoPrint webcamd[308]: http options: -w ./www-octopi -n
Jan 24 16:00:57 OctoPrint webcamd[308]: Explicitly USB device:
Jan 24 16:00:57 OctoPrint webcamd[308]: -----------------------------------------------
Jan 24 16:00:57 OctoPrint webcamd[308]: Found video devices:
Jan 24 16:00:57 OctoPrint webcamd[308]: /dev/video0
Jan 24 16:00:57 OctoPrint webcamd[308]: /dev/video1
Jan 24 16:00:57 OctoPrint webcamd[308]: /dev/video10
Jan 24 16:00:57 OctoPrint webcamd[308]: /dev/video11
Jan 24 16:00:57 OctoPrint webcamd[308]: /dev/video12
Jan 24 16:00:57 OctoPrint webcamd[308]: config file='/boot/octopi.txt':USB device was not set in options, start MJPG-
Jan 24 16:00:57 OctoPrint root[407]: Starting USB webcam
Jan 24 16:00:57 OctoPrint webcamd[308]: <13>Jan 24 16:00:57 root: Starting USB webcam
Jan 24 16:00:57 OctoPrint webcamd[308]: Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: starting application
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: MJPG Streamer Version: git rev: 501f6362c5afddcfb4
Jan 24 16:00:57 OctoPrint webcamd[308]: MJPG Streamer Version: git rev: 501f6362c5afddcfb41055f97ae484252c85c912
Jan 24 16:00:57 OctoPrint webcamd[308]: i: Using V4L2 device.: /dev/video0
Jan 24 16:00:57 OctoPrint webcamd[308]: i: Desired Resolution: 1280 x 960
Jan 24 16:00:57 OctoPrint webcamd[308]: i: Frames Per Second.: 30
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: Using V4L2 device.: /dev/video0
Jan 24 16:00:57 OctoPrint webcamd[308]: i: Format............: JPEG
Jan 24 16:00:57 OctoPrint webcamd[308]: i: TV-Norm...........: DEFAULT
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: Desired Resolution: 1280 x 960
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: Frames Per Second.: 30
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: Format............: JPEG
Jan 24 16:00:57 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: TV-Norm...........: DEFAULT
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (2
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (2
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for
Jan 24 16:00:57 OctoPrint webcamd[308]: UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device
Jan 24 16:00:58 OctoPrint webcamd[308]: Done bring up all configured video device
Jan 24 16:00:58 OctoPrint webcamd[308]: Goodbye...
Jan 24 16:01:00 OctoPrint systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Jan 24 16:01:00 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: www-folder-path......: ./www-octopi/
Jan 24 16:01:00 OctoPrint webcamd[308]: o: www-folder-path......: ./www-octopi/
Jan 24 16:01:00 OctoPrint webcamd[308]: o: HTTP TCP port........: 8080
Jan 24 16:01:00 OctoPrint webcamd[308]: o: HTTP Listen Address..: (null)
Jan 24 16:01:00 OctoPrint webcamd[308]: o: username:password....: disabled
Jan 24 16:01:00 OctoPrint webcamd[308]: o: commands.............: disabled
Jan 24 16:01:00 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: HTTP TCP port........: 8080
Jan 24 16:01:00 OctoPrint mjpg_streamer[408]: MJPG-streamer [408]: HTTP Listen Address..: (null)

Additional information about your setup (OctoPrint version, OctoPi version, ...)

OctoPrint version : 1.5.3
OctoPi version : 0.17.0

I would try running in Safe Mode. It looks like both the USB and raspi cams are starting up at the same time. Only one should start.

And is there any way to disable the raspicam download so that only the usb camera loads?

Yes, if you are using OctoPi, go into the file /boot/octopi.txt and change camera from auto to usb. Then it will only boot the USB cam.

In the logs, you can see that in the file octopi.txt this setting is already registered. I pointed it out right away.

Yeah I can't see where the Raspberry Pi camera is starting up at all, don't think that's the issue.

I have the same camera, not had any issues with it. Does the cable run past motors or other electronics on it's way to the Pi? I have had some interference issues, when I put the cable over the stepper motor.

Other than that, have you tried different USB ports or does the camera work well when connected to a different PC or something? The Pi seems to think it is OK (thanks for the logs that show that) so I guess it is receiving crap data from the sensor.

The wire from the camera is about 15 centimeters from the stepper motor, there is no electronics nearby. There is a wire that goes to the LED lamp that stands under the camera, but the lamp is turned off. I have a second camera and another Pi, I try to swap the raspberry and the camera, I also try to switch to another usb connector, and then I will write an answer. What kind of sensor are you talking about?

The sensor in the camera, behind the lens.

Changing the USB ports does not help.
I will try another C270 camera and raspberry.

I have done a lot of experiments with both cameras and both raspberries and with their rearrangement from place to place and to other USB ports, and I come to the conclusion that the problem is in the speed of reading the SD card, with a faster SD card, this problem is extremely rare. you may need to adjust something in the software so that this problem does not occur with not very fast SD cards. In previous versions of Octo Print, I wrote sleep 1m at the beginning of the Webcam Daemon file; and this solved the problem, but in recent versions of OctoPrint, this no longer works. I understand that this is not an option, but it may suggest to software developers how to fix it in the future.

I decided to try the latest version 0.18.0 Octoprint and in this version everything happens with the camera the same way. Moreover, now I can't open the stream in a separate browser window using a new link (/webcam/?action=stream), but there is a video stream in the OctoPrint working window, and if I click the test button in the settings, the image is also there. And now in the new version of OctoPrint, how can I access the stream from an external network? Sorry if I'm boring, I'm experienced in linux systems and networks, I'm learning and trying to figure it all out.

I hadn't heard of that issue with slow SD cards before, causing the camera to not start properly. Interesting. If you can suggest a good solution, let Guy know at https://github.com/GuySoft/OctoPi.

I'm going to assume that you put http://your-ip or http://octopi.local infront of that, to make it http://octopi.local/webcam/?action=stream?

That has never been possible with any versions of OctoPi out of the box, you must have done something extra to set that up. The stream is local only. But before you do, make sure you put some security on it rather than just port forwarding the stream...

I rarely use this feature, mostly when I need to leave the house, and the printer is still working, so I did not put any protection, just used through the ports, I do not post streams, and I do not give anyone links to the stream, after I come home, I turn off the ports in the router. And using a VPN is very difficult for me, I don't understand anything about it at all.

Thank you very much. Everything worked

In version 0.18.0, the port was probably changed, on port 8080 it is not possible to start the camera from the external network, in 0.17.0 it worked on this port.

You could use something like the ngrok plugin to access your instance, you can turn it on when you leave, it gives you the ngrok URL which has encryption and a username and password. If you put something on the open internet, it has probably been found already. Yes it's just a webcam feed, but someone could easily take out the Pi with a quick and dirty DDoS attack.

Thank you for the hint, I will try to put ngrok, I have little experience, let's see what happens.

1 Like

Please tell me, which version of ngrok should I download for raspberry and octoprint 0.17.0?

There's an ngrok plugin for OctoPrint, that will handle everything for you. Find it in the plugin manager and follow the installation guide on its home page.

Thank you!