OctoPrint Control Tab shows black screen and 'WebCam stream loading...'

AuviPal 5 Megapixels Raspberry Pi Camera Module 1080p OV5647 Sensor

** Control tab of OctoPrint is black with 'Webcam Stream loading...' message.**

Enabled camera with Raspi-config
Checked the GPU memory was at least 128 MB (it is)
Rebooted Raspberry PI
Verified that cable is plugged in to the appropriate port and was in straight.
Ran raspistill and raspivid and both functioned perfectly.
Shortly after the tests, the video appeard on the Control Tab of OctoPrint.
By the time I had created my gcode and uploaded it, the black screen was back.
When I re-ran raspipic , this time I received an error similar to:
"failed to enable component: ENOSPC"
Rebooted, and the problem disappeared.
I ran:
sudo vcdbg log assert
and the response was:
No messages available
Made sure I am running latest version of OctoPrint
Ran in Safe mode.

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)
The following logs are provided:
dmesg
daemon.log
debug
failog
kern.log
lastlog
syslog
messages
octoprint.log
plugin_bedlevelvisualizer_debug.log
plugin_softwareupdate_console.log
serial.log
There is no /var/log/webcamd.log (I ran sudo updatedb and then locate webcamd.log)

Additional information about your setup (OctoPrint version, OctoPi version, ...)
Versions:
OctoPrint 1.5.2
Python 2.7.16
OctoPi 0.17.0
debian_version 10.7

pi@octopi:~/.octoprint/logs $ uname -a
Linux octopi 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020 armv7l GNU/Linux

Model : Raspberry Pi 4 Model B Rev 1.1

pi@octopi:~/.octoprint/logs $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs

pi@octopi:~/.octoprint/logs $ ls /dev/vid*
/dev/video0 /dev/video10 /dev/video11 /dev/video12 /dev/video13 /dev/video14 /dev/video15 /dev/video16

pi@octopi:~/.octoprint/logs $ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Hardware : BCM2711
Revision : b03111
Serial : 10000000276e4154
Model : Raspberry Pi 4 Model B Rev 1.1daemon.log (107.7 KB) kern.log (80.4 KB) octoprint.log (795.0 KB) plugin_bedlevelvisualizer_debug.log (14.6 KB) plugin_softwareupdate_console.log (95.6 KB) serial.log (148 Bytes)
Python2 and 3 are installed
I have a single Web Cam installed, and a WiFi dongle in a USB port.
sudo apt-get update --fix-missing, and full-upgrade have been run.
I noted that /boot/octopi.txt has all options commented out leaving first usb VIDEO device to be used. WOndering if this should be the raspi cam option.

Noted these entries in syslog:
an 16 10:44:26 octopi kernel: [ 5.156034] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt failed with error -2
Jan 16 10:44:26 octopi kernel: [ 5.377610] logitech-djreceiver 0003:046D:C52B.0003: hiddev96,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:01:00.0-1.3/input2
Jan 16 10:44:26 octopi kernel: [ 5.380927] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
Jan 16 10:44:26 octopi kernel: [ 5.388698] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
Jan 16 10:44:26 octopi kernel: [ 5.389207] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
Jan 16 10:44:26 octopi kernel: [ 5.389806] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
Jan 16 10:44:26 octopi kernel: [ 5.389847] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
Jan 16 10:44:26 octopi kernel: [ 5.390292] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
Jan 16 10:44:26 octopi kernel: [ 5.390314] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
Jan 16 10:44:26 octopi kernel: [ 5.390334] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
Jan 16 10:44:26 octopi kernel: [ 5.390353] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
Jan 16 10:44:26 octopi kernel: [ 5.390372] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
Jan 16 10:44:26 octopi kernel: [ 5.390623] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
Jan 16 10:44:26 octopi kernel: [ 5.398764] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
Jan 16 10:44:26 octopi kernel: [ 5.398805] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
Jan 16 10:44:26 octopi kernel: [ 5.403288] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 2 2020 23:30:41 version 7.45.202 (r724630 CY) FWID 01-72f6ece2
Jan 16 10:44:26 octopi kernel: [ 5.407320] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
Jan 16 10:44:26 octopi kernel: [ 5.407476] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
Jan 16 10:44:26 octopi kernel: [ 5.417934] bcm2835-v4l2: scene mode selected 0, was 0
Jan 16 10:44:26 octopi kernel: [ 5.418283] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
Jan 16 10:44:26 octopi kernel: [ 5.428845] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.


Jan 16 10:44:26 octopi webcamd[322]: Found video devices:
Jan 16 10:44:26 octopi webcamd[322]: /dev/video0
Jan 16 10:44:26 octopi webcamd[322]: /dev/video10
Jan 16 10:44:26 octopi webcamd[322]: /dev/video11
Jan 16 10:44:26 octopi webcamd[322]: /dev/video12
Jan 16 10:44:26 octopi webcamd[322]: /dev/video13
Jan 16 10:44:26 octopi webcamd[322]: /dev/video14
Jan 16 10:44:26 octopi webcamd[322]: /dev/video15
Jan 16 10:44:26 octopi webcamd[322]: /dev/video16
Jan 16 10:44:26 octopi webcamd[322]: raspi
Jan 16 10:44:26 octopi webcamd[322]: config file='/boot/octopi.txt':USB device was not set in options, start MJPG-streamer with the first found video device: /dev/video0
Jan 16 10:44:26 octopi systemd[1]: Started Raise network interfaces.
daemon.log (107.7 KB) debug.log (2.5 KB) dmesg.log (61.6 KB) faillog.log (2.7 KB) kern.log (80.4 KB) lastlog.log (285.4 KB) messages.log (80.9 KB) octoprint.log (795.0 KB) plugin_bedlevelvisualizer_debug.log (14.6 KB) plugin_softwareupdate_console.log (95.6 KB) serial.log (148 Bytes) syslog.log (194.4 KB)

Hello,

May or may not be useful but ...

... this is one of two threads with a hit on the same dmesg error I got.
I put down what fixed my problem over on the other thread.

I'm replying to my original post here. I posted following all the guidelines thinking if I did so, I might get a reply from someone knowledgeable. That was on January 17th. Exactly a month later, and none of the fine folks who can actually deciper my logs and testing have so much as replied once and said something like 'We're going to ignore you, thought you'd like to know.' :slightly_smiling_face: Have I posted in the incorrect place, or maybe omitted something very important? I'm just wondering.

As of today, I still get a stream 'sometimes' but after a few minutes it's back to 'webcam stream loading'
I've noticed if I ssh in, and issue a 'raspistill -o cam.jpg', I'll get a camera image displayed on the small screen I have attached to the Pi itself for a few seconds.
If I issue the raspivid test, it displays to the small display connected to the Raspberry also. Output is:
sudo raspivid -v -o testvideo.h264 -t 5000
[sudo] password for pi:

"raspivid" Camera App (commit 9f3f9054a692 Tainted)

Camera Name ov5647
Width 1920, Height 1080, filename testvideo.h264
Using camera 0, sensor mode 0

GPS output Disabled

bitrate 17000000, framerate 30, time delay 5000
H264 Profile high
H264 Level 4
H264 Quantisation level 0, Inline headers No
H264 Fill SPS Timings No
H264 Intra refresh type (null), period -1
H264 Slices 1
Wait method : Simple capture
Initial state 'record'

Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
Camera component done
Encoder component done
Starting component connection stage
Connecting camera preview port to preview input port
Starting video preview
Connecting camera video port to encoder input port
Opening output file "testvideo.h264"
Enabling encoder output port
Starting video capture
Finished capture
Closing down
Close down completed, all components disconnected, disabled and destroyed

I would be tickled pink, if someone knowledgeable could review what I have provided, and guide me towards getting the camera working once and for all.
With the utmost of respect,
-= Bruce

Somone did respond with a solution that worked for them, it's not as if you got absolutely ignored...

We're not magic, and can't solve every problem - usually if you don't get a reply, it is because no one can think of what to reply with, not that you are ignored. I would be more annoyed with a reply of 'No idea' from everyone.

Anyway, it sounds more like you have network issues than issues with the camera itself. The camera is reported as /dev/video0, exactly as it should be. Raspistill works just fine, and the webcam feed works from time to time.

When debugging this, try and use the absolute URL for the webcam. Open your browser and go to http://your-ip/webcam/?action=stream, since that takes OctoPrint out of the equation. Plugins can also interfere with the webcam stream in the UI.

If that page loads, MJPG Streamer is running. If it refuses to connect, or you get 'The webcam server is not currently running' then something else is up. The best bet for that is the webcamd logs, which you can get with the command journalctl -u webcamd. There's a bug in that version of OctoPi that doesn't write to the log file.

All the details of the CPU info are unnecessary, and probably scared some people off since it is hard work reading the post.

@Bruce_Meyer In any future posts, please use the </> button around any text that you copy and paste. If possible, attach the original file that you have extracted from (and skip posting the entire contents). If you don't use the </> button, the markdown language used here often swallows special characters that had meaning in the original context.

That's what happened with your original post making it very difficult to read and extract the information we need to create a meaningful response. I know I'm guilty of "ignoring" posts that require a large amount of effort on my part to decode them.

It looks like @Charlie_Powell has some ideas for you to try so hopefully, that will solve your problem (or at least make some progress towards a solution).

Mr. Powell. I disagree. you guys/gals ARE magic! :grinning:
When I attempt the| http://your-ip/webcam/?action=stream (replacing the "your-ip" with the IP of the pi hosting octopi, The web browser on my computer, spins endlessly, never timing out. The same thing occurs with action=snapshot.
Interestingly, when I perform a wget http://127.0.0.1/webcam/?action=stream
from the pi itself, it pulls an html page down full of 3135 bytes of html goodness to the pi's storage.
So it works at localhost, does it work across the network?

I fire up Wireshark, and sniff a three way TCP handshake between me, (the .245) and the OctoPi, (the .25)


So at a minimum, we have a TCP connection happening between my computer and the pi, going both ways on TCP port 80. (phew!)

We follow the capture a little further, and we see the octopi's web server send this to my computer:

GET /webcam/?action=snapshot HTTP/1.1
Host: 192.168.86.25
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: session_P80=.eJxlT01rg0AU_CtlzyEYPy5CDyla8fCebHkiby_S6Da6zYZiFHVD_nttoaceBoaZgZm5i_pj0LdOxOMw6Z2o-1bEd_F0ErEoSDq05YJUhgVByNUGShfw1acyqYd2Y5n0mI4e-q8d-GXAVeqUhQiSxrHJAzatZXNcMMlnVckDZhwA5YGiPAIDEdu3jgk7SGQAlh26dEYj54JeLJpmUQRLkam-oJ--PMREzipDw3R2m7aqpDls257FY9s-3fTwe-A6XS470bf6Ovbjun-fxq4e1y_9z_kLP74BPQdYPQ.YE_yDA.wrYVYDYRt3lX3qW9gjBloDzBVuM

So I'm getting the web page from the Pi to my computer. Hmmm. I wonder whats next...
Port 8080.
Maybe my brain is parsing this wrong, but it seems like my computer's browser is looking at port 8080 instead of port 80.
Within a second of the session beginning, immediately after the last packet to my computer from the Pi, my computers starts listening on port 8080.

Do I have a misconfiguration somewhere?
What was in that last packet from the Pi? Did IT tell my browser to use port 8080 ?
The last packet FROM the Pi contained this:

.HTTP/1.0 504 Gateway Time-out
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>

Hmm, according to the http status codes, that can be firther interpreted as:

504 Gateway Timeout

The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request

Here is the entire http stream from the sniffer:

GET /webcam/?action=snapshot HTTP/1.1
Host: 192.168.86.25
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: session_P80=.eJxlT01rg0AU_CtlzyEYPy5CDyla8fCebHkiby_S6Da6zYZiFHVD_nttoaceBoaZgZm5i_pj0LdOxOMw6Z2o-1bEd_F0ErEoSDq05YJUhgVByNUGShfw1acyqYd2Y5n0mI4e-q8d-GXAVeqUhQiSxrHJAzatZXNcMMlnVckDZhwA5YGiPAIDEdu3jgk7SGQAlh26dEYj54JeLJpmUQRLkam-oJ--PMREzipDw3R2m7aqpDls257FY9s-3fTwe-A6XS470bf6Ovbjun-fxq4e1y_9z_kLP74BPQdYPQ.YE_yDA.wrYVYDYRt3lX3qW9gjBloDzBVuM
HTTP/1.0 504 Gateway Time-out
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>

So, Mr. Powell, It may indeed be a network problem, but I think it may be a connection issue residing on the Pi, between the server (image server perhaps?) and the client (http server looking for it's image)
I think, the server (as in a daemon serving up pictures and video) is what is dying and not giving the (is it javascript?) on the web page the images it is waiting for.
As far as plugins I have the:

  1. Bed Visualizer (disabled)
  2. Firmware Check
  3. Printer Dialogs (never)
  4. Printer Notifications (disabled)
  5. TouchUI (disabled)
  6. Virtual Printer (disabled). installed.

I've been sitting quiet hoping the the bug in OctoPi that causes:
the webcam daemon (DEEmon, DAYmon?) to not write it's logs.
Per the note you provided:
journalctl -u webcamd .
There's a bug in that version of OctoPi that doesn't write to the log file.

I verified it is still present.

Ok, I'm exhausted. I actually had to do some thinking tonight. Whew.
Please feel free (anyone, Mr. Morgan?) to request I do more beterrer troubleshooting on other things also. I'll give specific detail, omitting 1,000's of lines of DMESG logs to try and figure this out.
Interesting, it automatically turns certain words blue. I am chopping logs with an axe. Neat.
-= Bruce 'The N00bie'