Skip to content

Instantly share code, notes, and snippets.

@jneilliii
Created March 19, 2024 03:36
Show Gist options
  • Select an option

  • Save jneilliii/93b412cb0bbf6b7bfd76f7e10d612f24 to your computer and use it in GitHub Desktop.

Select an option

Save jneilliii/93b412cb0bbf6b7bfd76f7e10d612f24 to your computer and use it in GitHub Desktop.
[Unit]
Description=go2rtc
After=network.online.target
Wants=network.online.target
[Service]
Type=simple
User=pi
ExecStart=/home/pi/go2rtc_linux_arm -config /home/pi/go2rtc.yaml
[Install]
WantedBy=multi-user.target
@jneilliii
Copy link
Copy Markdown
Author

jneilliii commented Mar 19, 2024

SSH to the pi and run these commands to download and setup go2rtc and it's service.

Download go2rtc and make it executable. The url for go2rtc executable and service file assumes 32bit pi image (octopi included), adjust the filename for other variants (i.e. 64bit pi would use go2rtc_linux_arm64) in the commands below and in ExecStart of service file.

wget https://github.com/AlexxIT/go2rtc/releases/latest/download/go2rtc_linux_arm
chmod +x ./go2rtc_linux_arm

Optional, stop and disable bundled streamer based on which octopi image.

  • stable octopi stack:
sudo systemctl stop webcamd
sudo systemctl stop ffmpeg_hls
sudo systemctl disable webcamd
sudo systemctl disable ffmpeg_hls
  • new camera stack:
sudo systemctl stop camera-streamer
sudo systemctl disable camera-streamer

Download the service file from this listing and enable it.

wget https://gist.github.com/jneilliii/93b412cb0bbf6b7bfd76f7e10d612f24/raw/ccae1e780ff68673ae4997e4ef9f758787040c8a/go2rtc.service
sudo cp ./go2rtc.service /etc/systemd/system/go2rtc.service

Note: if your SSH/OS username is not pi you'll need to edit the file after downloading using sudo nano /etc/systemd/system/go2rtc.service and adjust the User and path listed in ExecStart with the username you set, replacing the default pi username.

Enable the service and start it.

sudo systemctl enable go2rtc.service
sudo systemctl start go2rtc

go to http://<ip>:1984/ to access go2rtc's web interface and configure the settings for your stream type, or alternatively install my go2rtc plugin for OctoPrint.

@Tcoton
Copy link
Copy Markdown

Tcoton commented Dec 3, 2025

Some instructions are missing before enabling the service:

sudo cp go2rtc.service /etc/systemd/system
sudo systemctl daemon-reload

Otherwise there is an error about unit not found.

@jneilliii
Copy link
Copy Markdown
Author

the copy command is there right after the wget, but you're right the darmon-reload may be necessary.

@bhnet01-ux
Copy link
Copy Markdown

I just get an error in octoprint - go2rtc error
There was a "connection error", unable to validate server url.

@jneilliii
Copy link
Copy Markdown
Author

What is the status of the service?

sudo service go2rtc status

@bhnet01-ux
Copy link
Copy Markdown

What is the status of the service?

sudo service go2rtc status

go2rtc.service - go2rtc
Loaded: loaded (/etc/systemd/system/go2rtc.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-01-08 09:06:55 GMT; 5h 29min ago
Invocation: 08bcfbe34bda482b8932721589f608e7
Main PID: 3155 (go2rtc_linux_ar)
Tasks: 1 (limit: 4759)
CPU: 5h 29min 48.977s
CGroup: /system.slice/go2rtc.service
└─3155 /home/benharris/go2rtc_linux_arm -config /home/benharris/go2rtc.yaml

@jneilliii
Copy link
Copy Markdown
Author

jneilliii commented Jan 8, 2026

Ok, so it seems to be running. Are you able to access http://<IP>:1984/

@bhnet01-ux
Copy link
Copy Markdown

no just get a page not found or the original error via the verify option in the plugin

@Tcoton
Copy link
Copy Markdown

Tcoton commented Jan 9, 2026

Did you replace <IP> by your ip address?

@bhnet01-ux
Copy link
Copy Markdown

yes, I also did a check on the ports that were 'listening' and it doesn't show in that list.

@Tcoton
Copy link
Copy Markdown

Tcoton commented Jan 9, 2026

Did you set the correct user for the service to run? It looks like you are not using pi but benharris.

@bhnet01-ux
Copy link
Copy Markdown

yep I'm not using a user called pi

@Tcoton
Copy link
Copy Markdown

Tcoton commented Jan 9, 2026

Maybe there is an error in the go2rtc.yaml file then.

@bhnet01-ux
Copy link
Copy Markdown

ok, I'm planning to do a reload of the pi system so will start from fresh and try again.
Thanks for the assistance.

@Tcoton
Copy link
Copy Markdown

Tcoton commented Jan 9, 2026

Watch for the indentation in the go2rtc.yaml as a space at the wrong place can block everything. The very first line should be like this:

api:
  origin: "*"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment