Ubuntu - Stream not working but snapshot is

Camera model
Logitech C270

What is the problem?

Stream giving error that it cannot load
Webcam stream not loaded

It might not be configured correctly or require authentication. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Webcam" > "Stream URL". If you don't have a webcam you can also just disable webcam support there.

Currently configured stream URL: /webcam/?action=stream

If I go to that URL I get this error

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Snapshot however DOES take a photo - which is confusing... so the webcam IS working but not for streaming.

  • webcam is ALWAYS on, doesn't turn off

What did you already try to solve it?

I followed this : Setting up OctoPrint on Ubuntu 20.04 with Python 3 | Illuminated3D
Followed this as well : (from Chris's Basement) Octoprint on Linux - Google Docs

  • I rechecked everything posted, re ran through everything and still happening.

  • tried another webcam

  • kept my username as PI just to keep it simple, i wanted a raspberry pi, but i cannot afford them currently and had an old PC laying around

pi@pi:/var$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 8087:07dc Intel Corp.
Bus 003 Device 002: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This is my file for webcamDaemon (which is executable

#!/bin/bash

MJPGSTREAMER_HOME=/home/pi/mjpg-streamer/mjpg-streamer-experimental
MJPGSTREAMER_INPUT_USB="input_uvc.so"
MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so"

init configuration

camera="auto"
camera_usb_options="-r 640x480 -f 10"
camera_raspi_options="-fps 10"

if [ -e "/boot/octopi.txt" ]; then
source "/boot/octopi.txt"
fi

runs MJPG Streamer, using the provided input plugin + configuration

function runMjpgStreamer {
input=$1
pushd $MJPGSTREAMER_HOME
echo Running ./mjpg_streamer -o "output_http.so -w ./www" -i "$input"
LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www" -i "$input"
popd
}

starts up the RasPiCam

function startRaspi {
logger "Starting Raspberry Pi camera"
runMjpgStreamer "$MJPGSTREAMER_INPUT_RASPICAM $camera_raspi_options"
}

starts up the USB webcam

function startUsb {
logger "Starting USB webcam"
runMjpgStreamer "$MJPGSTREAMER_INPUT_USB $camera_usb_options"
}

we need this to prevent the later calls to vcgencmd from blocking

I have no idea why, but that's how it is...

vcgencmd version

echo configuration

echo camera: $camera
echo usb options: $camera_usb_options
echo raspi options: $camera_raspi_options

keep mjpg streamer running if some camera is attached

while true; do
if [ -e "/dev/video0" ] && { [ "$camera" = "auto" ] || [ "$camera" = "usb" ] ; }; then
startUsb
elif [ "vcgencmd get_camera" = "supported=1 detected=1" ] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi">
startRaspi
fi

sleep 120

done

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)

I have no logs under /var/log < there is nothing in that directory - where else would i look?
got the system logs from the system bundle area...
NOTE I did find log files, but they were too large to copy paste

octoprint-logs.zip (189.4 KB)

Uploaded them!

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

Octoprint version Version 1.7.2

Which snapshot url are you using?

Realize that the stream url and the snapshot url are "consumed" by different clients.

The stream url is used by your browser. Your browser loads a web page, and can use links relative to it. Eg the webpage is http://octopi.local, and the relative url /webcam/action=stream can be resolved to http://octopi.local/webcam/action=stream by your browser. The benefit of using a relative url is that this will also work if you open the webpage by its ip address instead of its hostname.

The snapshot url on the other hand is meant for OctoPrint itself, not for your browser. It needs to be a "fully qualified" url that the Python side of OctoPrint can access to record a timelapse. Relative urls will not work here, because on the Python side there is no notion of the address the rest of OctoPrint is accessed from. So an absolute url is required. If the webcam is served from the same machine as octoprint, then you can use localhost: http://localhost/webcam/?action=stream.

Don't be tempted to use the same "format" for both urls. They are for different purposes.

I'm using : http://127.0.0.1:8080/?action=snapshot
Which is what I've seen in the other guides

i'm going to dig around the other setup files as it LOOKS like the URL isn't specified in the setup somewhere to be used --- but i'm just grasping at straws

OK through more poking and reading...

if i go to
http://pi.local/webcam/?action=stream
the camera streams fine

i can place that URL in the streaming field within octoprint and it seems to function just fine . However i feel like i'm going off from default.

Yes. Sorry, i should have specified (i was tired) i was just putting that information up so we know the webcam is physically working on the hardware that i was using.

Nah that's fine. Use http://pi.local/webcam/?action=stream or replace pi.local with the ip of the machine.

Awesome, thanks! If that's an approved method, i'll take it!

Thank you guys for the assist!

1 Like