Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save john-clark/850f1af9814c9adaa3a649f41d6ce003 to your computer and use it in GitHub Desktop.
Save john-clark/850f1af9814c9adaa3a649f41d6ce003 to your computer and use it in GitHub Desktop.
#from: https://krystof.io/mjpg-streamer-on-a-raspberry-pi-zero-w-with-a-usb-webcam-streaming-setup/
#
sudo apt-get install build-essential libjpeg-dev imagemagick libv4l-dev cmake git -y
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make
sudo make install
#
# installer locations:
# /usr/local/bin/mjpg_streamer – The primary binary
# /usr/local/lib/mjpg-streamer/ – The directory of input/output modules
# /usr/local/share/mjpg-streamer/www – The www server interface
#
# Test:
/usr/local/bin/mjpg_streamer -i "input_uvc.so -f 15 -r 640x480" -o "output_http.so -w /usr/local/share/mjpg-streamer/www"
# or list available formats:
v4l2-ctl --list-formats-ext
/usr/local/bin/mjpg_streamer -i "input_uvc.so -f 30 -r 1920x1080" -o "output_http.so -w /usr/local/share/mjpg-streamer/www"
# test web @ http://server:8080/
#
# create service:
echo -e "[Unit]\nDescription=MJPG Streamer\nAfter=network.target\n\n[Service]\nExecStart=/usr/local/bin/mjpg_streamer -i \"input_uvc.so -f 30 -r 1920x1080\" -o \"output_http.so -w /usr/local/share/mjpg-streamer/www\"\nRestart=always\n\n[Install]\nWantedBy=multi-user.target" | sudo tee /etc/systemd/system/mjpg-streamer.service > /dev/null
# run service
sudo systemctl daemon-reload
sudo systemctl enable mjpg-streamer.service
sudo systemctl start mjpg-streamer.service
sudo systemctl status mjpg-streamer.service
#
# check
http://server:8080/?action=stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment