OctoPrint webcam is not working


#1

What is the problem?
I have followed the directions to manually install Octoprint on my brand new oDroid XU4. I have everything working except the WebCam. Hoping to use webcam on port 8080 and OctoPrint is using port 5000.

What did you already try to solve it?
I can manual start the stream by manually running
mjpg_streamer -i "/home/odroid/mjpg-streamer/mjpg-streamer-experimental/input_uvc.so -r 1920x1080 -d /dev/video0 -n" -o "/home/odroid/mjpg-streamer/mjpg-streamer-experimental/output_http.so -p 8080"

Could it be that Octoprint is expecting mjpeg-stream in pi home folder or some other hard coded value?

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

octoprint (1).log (74.5 KB)
octoprint.log (1.1 MB)
config.yaml (3.3 KB)
octopi.txt.yaml (2.3 KB)
I could not add the octopi.txt directly so added .yaml to the end.

Octoprint version: 1.3.9
Linux for oDroid


#2

This line in octopi.txt suggests that mjpegstreamer needs to exist in /home/pi/mjpg-streamer:

# Current working directory is the mjpg-streamer base directory.

Maybe you can move from /home/odroid/mjpg-streamer/mjpg-streamer-experimental to that location and try again?


#3

I created a pi user folder and copied the mjeg-streamer so that this is the path:
/home/pi/mjpg-streamer/mjpg-streamer-experimental$

Rebooted and still no webcam through Octoprint.


#4

Move everything from
/home/pi/mjpg-streamer/mjpg-streamer-experimental$
to
/home/pi/mjpg-streamer/
and try again. Here are the files I have in /home/pi/mjpg-streamer/

_build             Makefile                    postinstall.sh
cmake              mjpg_streamer               README.md
CMakeLists.txt     mjpg_streamer.c             scripts
Dockerfile         mjpg-streamer-experimental  start.sh
docker-start.sh    mjpg_streamer.h             TODO
input_file.so      mjpg_streamer@.service      utils.c
input_http.so      output_file.so              utils.h
input_raspicam.so  output_http.so              www
input_uvc.so       output_rtsp.so              www-octopi
LICENSE            output_udp.so
makedeb.sh         plugins


#5

Done, I copied them and rebooted but it looked like it tried to do something but ultimatelty I get the black screen saying /webcam/?action=stream is unavailable.

Here are my last 2 log files:
octoprint (2).log (297.9 KB)
octoprint.log.2018-09-12.yaml (10.0 KB)


#6

can you paste the content of your /home/pi/mjpg-streamer folder?

What happens when you go to this url:

http://{put_ip_of_pi_here}/webcam/?action=stream

Maybe open the debugger in your browser (F12) before you attempt to load the url and take a pic of the 'network' tab (if you are using FF)?


#7

Sorry for the delay but I was unable to get back to the oDroid.

I copied the contents and here are the files in /home/pi/...

Now regarding opening the web page this is want I see in Chrome....

webpage


#8

Is there a way to know that Octoprint is using mjpeg correctly?


#9

I believe the mjpegstream is created when you boot the pi, so really Octoprint doesn't have anything to do with it. I'm thinking the next step may just be to start mjpegstreamer yourself within the boot script since you were able to start it manually.

Otherwise, if you can connect a monitor to your odroid maybe you can see some errors during boot?


#10

What boot script?
I have a monitor hooked and I see no errors on start.

I was thinking of your comment that the OS just starts mjpg-streamer - I do not see how an app in my a Home folder just gets started without telling the OS. Can you add details?

When I attempt to start mjpg-stream with the SAME port as OP then it fails to start stating that the port is already in use. So OP has to know or expect that the stream exists so it can be used on the SAME port. Am I wrong?


#11

The trick for having OctoPrint and the webcam server on the same port (with the later on the sub path webcam) is a reverse proxy in front of both. On OctoPi that is haproxy. If you want to mirror this kind of setup in your odroid you'll have to follow the "making everything accessible on port 80" section of the raspberry pi setup guide (adapted to suit your paths and setup of course), and also the bits on how to have everything autostart.

OctoPrint itself has absolutely nothing to do with the stream. It doesn't control or manage it in any way.


#12

Foosel

Thank you, I uninstalled haproxy since I to get everything running on a port other than 80. Maybe I did something wrong initially and that why it did not work and am not down a rabbit hole.

I will try and re-install tonight when I get home from work.


#13

I decided to go into work late so I just followed the instructions and used the example haproxy cfg and no worky.

I still do not see how mjpeg-streamer is started - can someone explain this? The example even states to manually start the stream and I cannot find anywhere where the EXAMPLE directions says to create a service or something. Just above the webcam section is a section to add a Octoprint service - should there be a service for mjpg-streamer? I just noticed a start.sh in the mjpg folder but not sure want to do with it or if its to be used?

The next thing that I thing is wrong is the haproxy.cfg - there are variables that look like the its expecting default locations ... like use_backend webcam and default_backend - were do these variables point to? I am attaching my cfg which needs to remove .yaml

frontend public
bind :::80 v4v6
use_backend webcam if { path_beg /webcam/ }
default_backend octoprint

haproxy.cfg.yaml (803 Bytes)

As a side note: mjpeg-streamer also resides in /home/pi/mjpg-streamer and /home/odroid/mjpg-streamer


#14

OK I got the stream working in OP and now I just have to get may startup script to run on each boot...