How to install the webcam software?

I have an SD card with Octoprint, which is working, but has an older OS on it seems like it.
So I Created a new SD card with the latest PI version, and installed Octoprint on it.
Now I want to add my webcam to it, but cannot get that to work, while it works on the old card.

I tried installing the software,but keeps failing for download.

Anyone knows how to install the stream jpg software correctly ?

Thank you

Please be specific with what you have installed, what hardware you have used. 'Latest Pi version' doesn't tell me anything about what OS you have installed where.

And also 'the software' says nothing, state it's name.

There is a guide,

But I don't know if maybe you want to install OctoPi which has this setup out-of-the box:

Please give more details, we can't help you otherwise.

I'm sorry.
I am new to everything.

  1. Downloaded the latest version here:
  2. installed octoprint and compiled it
  3. installed python 3.8
  4. installing MJPG-Streamer but then i got stuck on some kind of script that i needed to put in a file, and then unable to compile. (lost the webpage for it)

May I ask why you don't use the ready to use octopi image where everything is installed and working?

i was having the impression when i went in there with VNC, that a lot of items were missing from the OS
in case i want to use it for other things.
and now I have the latest OS installed, with a nice GUI

I see.
Well @Charlie_Powell already posted the link to the guide on how to install it on raspbian.
I suggest you start the with the webcam part again and tell us when you get stuck.

We don't know which script you used before so we can't really help you with that.

ok, I followed this part

and stuck on the Optional: Webcam section

i keep getting this error

pi@raspberrypi:~ cd ~ pi@raspberrypi:~ sudo apt install subversion libjpeg62-turbo-dev imagemagick ffmpeg libv4l-dev cmake
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting

and also this error

**pi@raspberrypi:~ $ sudo service haproxy start
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


ok, changed the permission with 055 and was able to install that part

then i installed the mpeg part
and ran this after that

For Jessie use:

sudo apt install subversion libjpeg62-turbo-dev imagemagick libav-tools libv4l-dev cmake

which failed so i changed it to

sudo apt install subversion libjpeg62-turbo-dev imagemagick ffmpeg libv4l-dev cmake

that installed, and started the server.
but still, the webcam is not working.

If you downloaded the latest Raspberry Pi OS, why are you using the command that it says for Jessie? That is based on buster, so you should use the command that says it is for buster :wink:

Could you paste the output of when you ran the mjpg streamer command, the one that is like this?:

./mjpg_streamer -i "./" -o "./"

pi@raspberrypi:~ ./mjpg_streamer -i "./" -o "./" bash: ./mjpg_streamer: No such file or directory pi@raspberrypi:~ dir
Bookshelf Downloads OctoPrint RaspberryPi-Factory-Reset
Desktop mjpg-streamer Pictures Templates
Documents Music Public Videos
pi@raspberrypi:~ cd mjp-streamer bash: cd: mjp-streamer: No such file or directory pi@raspberrypi:~ cd mjpg-streamer
pi@raspberrypi:~/mjpg-streamer ./mjpg_streamer -i "./" -o "./" bash: ./mjpg_streamer: No such file or directory pi@raspberrypi:~/mjpg-streamer ./mjpg-streamer -i "./" -o "./"
bash: ./mjpg-streamer: No such file or directory
pi@raspberrypi:~/mjpg-streamer cd pi@raspberrypi:~ ./mjpg-streamer -i "./" -o "./"
bash: ./mjpg-streamer: Is a directory
pi@raspberrypi:~ $ ./mjpg-streamer -i "./" -o "./"

went deeper into the folder, seems like it's called differently

pi@raspberrypi:~/mjpg-streamer/mjpg-streamer-experimental $ dir
CMakeLists.txt utils.c
Dockerfile Makefile utils.h mjpg_streamer plugins www mjpg_streamer.c mjpg_streamer.h mjpg_streamer@.service scripts
pi@raspberrypi:~/mjpg-streamer/mjpg-streamer-experimental mjpg_streamer -i "" -o "" bash: mjpg_streamer: command not found pi@raspberrypi:~/mjpg-streamer/mjpg-streamer-experimental

I started with a new image and did the following

python3 --version

sudo apt update
sudo apt install python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential
mkdir OctoPrint && cd OctoPrint
python3 -m venv venv
source venv/bin/activate

pip install pip --upgrade
pip install octoprint

sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi

wget && sudo mv octoprint.service /etc/systemd/system/octoprint.service

sudo systemctl enable octoprint.service

sudo apt install haproxy

sudo -i
geany /etc/haproxy/haproxy.cfg

changed to

maxconn 4096
user haproxy
group haproxy
log local0 debug

log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
option http-server-close
option forwardfor
maxconn 2000
timeout connect 5s
timeout client 15min
timeout server 15min

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

backend octoprint
reqrep ^([^\ :])\ /(.) \1\ /\2
option forwardfor
server octoprint1

backend webcam
reqrep ^([^\ :])\ /webcam/(.) \1\ /\2
server webcam1

sudo service haproxy start

cd ~
sudo apt install subversion libjpeg62-turbo-dev imagemagick ffmpeg libv4l-dev cmake
git clone
cd mjpg-streamer/mjpg-streamer-experimental

Everything went fine, except for the line below.
I cannot get this one to start.
also after reboot it does not start..

start webcam server
./mjpg_streamer -i "./" -o "./"

it gives me

bash: ./mjpg_streamer: No such file or directory


What am I suppose to change?

changed it to this

/home/pi/mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -i "/home/pi/mjpg-streamer/mjpg-streamer-experimental/" -o "/home/pi/mjpg-streamer/mjpg-streamer-experimental/"

and that seems to work..

now how can i autostart this?
since after a reboot, the streaming server is off again


found this

Start it automatically
Create the systemd service by sudo nano /etc/systemd/system/mjpg-streamer.service and add this inside the file

Description=mjpg streamer for octoprint webcam


Adjust the CLI params (see Available mjpg-streamer configuration options)

Replace pi with your raspberry pi username if different

For camera plugged via USB cable (i.e. webcam)

ExecStart=/home/pi/mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -o "/home/pi/mjpg-streamer/mjpg-streamer-experimental/ -p 8080 -w /home/pi/mjpg-streamer/mjpg-streamer-experimental/www" -i "/home/pi/mjpg-streamer/mjpg-streamer-experimental/ -f 15"

For camera connected via the dedicated camera port using the ribbon cable

ExecStart=/home/pi/mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -o "/home/pi/mjpg-streamer/mjpg-streamer-experimental/ -p 8080 -w /home/pi/mjpg-streamer/mjpg-streamer-experimental/www" -i "/home/pi/mjpg-streamer/mjpg-streamer-experimental/ -fps 15"


sudo systemctl daemon-reload
sudo systemctl enable mjpg-streamer
sudo systemctl start mjpg-streamer
sudo systemctl status mjpg-streamer

and it worked. except after rebooting, the stream doesn't come up, but no errors..

ok, rebooting works fine now.
Seems like the Guide needs to be updated, the version and command line is different then from what is in the guide, if you do it manually.

Need to figure out now, how to make it widescreen instead of 4:3 format.
other than that, it's working good