When OCTOCAM_BASE_PATH is set (e.g. /octocam), all routes are served
under that prefix and the bare prefix without trailing slash gets a
301 redirect to the canonical form with trailing slash.
Implementation:
- Config: OCTOCAM_BASE_PATH env var, normalized to ensure leading
slash and stripped trailing slash
- Server: when base path is set, wrap the existing mux with
http.StripPrefix and add a redirect handler for the bare prefix.
All internal routes stay registered at their root paths so the same
mux works whether the prefix is empty or not.
- Templates: index.html and feed.html receive a BasePath template
variable used to construct all asset, stream, link, and JS fetch
URLs. Standalone /raw and /overlay pages prefix StreamURL and
OtherURL in server.go before rendering.
- Redirect from /overlay (when overlay disabled) now goes to
BasePath + "/" instead of "/"
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
RTSP feeds now default to disabled on first run. Enabled/disabled state
is saved to /var/lib/octocam/feeds.json on every toggle and restored at
startup, so the last-known state survives service restarts and reboots.
install.sh creates /var/lib/octocam owned by the octocam user. Config
adds OCTOCAM_STATE_FILE with the same default path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Browser: replace WebRTC/HLS with direct MJPEG HTTP streams
(/stream/raw, /stream/overlay) served by the Go server itself.
<img> tag, no JavaScript, works in every browser, zero extra encoding.
CPU:
- Raw RTSP now uses ffmpeg -c:v copy (MJPEG passthrough), eliminating
one full libx264 encode pass.
- Overlay RTSP throttled to 5fps (OCTOCAM_OVERLAY_RTSP_FPS); browser
still receives the full camera framerate via MJPEG HTTP.
Architecture: new internal/mjpeg.Broadcaster fans JPEG frames out to
any number of HTTP clients with per-client drop-on-full buffering.
RTSP URLs shown in the stats bar for VLC / OctoPrint use.
Fix .gitignore to use /octocam so it doesn't match cmd/octocam dir.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Go service that reads a USB webcam via V4L2, overlays OctoPrint stats
(state, filename, temps, progress, ETA) on one stream, and publishes
both raw and overlay feeds to MediaMTX via RTSP for WebRTC/HLS/RTSP
fan-out. Includes web UI, systemd units, and installer script.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>