Skip to content

Instantly share code, notes, and snippets.

@rosek86
Last active January 26, 2023 05:07
Show Gist options
  • Save rosek86/a0969ba618d05af985fe6a1bd24c680c to your computer and use it in GitHub Desktop.
Save rosek86/a0969ba618d05af985fe6a1bd24c680c to your computer and use it in GitHub Desktop.
Use GoPro with Octoprint

Use GoPro with Octoprint

Setup GoPro as webcam

Follow this guide: https://github.com/jschmid1/gopro_as_webcam_on_linux

GoPro systemd service (stream to tmpfs)

# cat gopro.service 
[Unit]
Description=A service to setup GoPro camera
After=network.target

[Service]
ExecStartPre=/usr/local/sbin/gopro webcam -n
ExecStart=/usr/bin/ffmpeg -y -nostdin -threads 1 -i 'udp://@0.0.0.0:8554?overrun_nonfatal=1&fifo_size=50000000' -update 1 -r 5 /var/run/stream.jpg

[Install]
WantedBy=multi-user.target

mjpg-streamer systemd service

# cat /lib/systemd/system/mjpg_streamer.service 
[Unit]
Description=A server for streaming Motion-JPEG from a video capture device
After=network.target

[Service]
ExecStart=/usr/local/bin/mjpg_streamer  -i 'input_file.so -f /var/run -n stream.jpg' -o 'output_http.so'

[Install]
WantedBy=multi-user.target

References

https://github.com/jacksonliam/mjpg-streamer/blob/master/mjpg-streamer-experimental/README.md https://github.com/KonradIT https://github.com/jschmid1/gopro_as_webcam_on_linux

Install MJPG-Streamer with kiauh

export KIAUH_SRCDIR=${HOME}/kiauh
export PRINTER_DATA=${HOME}/printer_data
export KLIPPER_CONFIG=${PRINTER_DATA}/config
export SYSTEMD=/etc/systemd/system
export KLIPPER_LOGS=${PRINTER_DATA}/logs
source ${KIAUH_SRCDIR}/scripts/utilities.sh
source ${KIAUH_SRCDIR}/scripts/mjpg-streamer.sh
install_mjpg-streamer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment