Troubleshooting RTSP Camera Streams in motionEye with go2rtc After Network Reset
Troubleshooting RTSP Camera Streams in motionEye with go2rtc After Network Reset¶
🛠️ Overview¶
This guide documents how to handle RTSP camera stream issues when using motionEye (ccrisan/motioneye Docker image) in combination with go2rtc (alexxit/go2rtc) to enable multiple stream access. In particular, it covers the necessary steps to restore proper camera display after a network reset.
🧩 Setup Summary¶
- Docker container 1:
ccrisan/motioneye– Video surveillance frontend - Docker container 2:
alexxit/go2rtc– RTSP multiplexer and relay - Use case: Some RTSP cameras only support a single stream.
go2rtcis used to multiplex and allow multiple consumers (likemotionEye+ others).
⚠️ Problem Description¶
After a network reset (e.g. router/modem restart, IP/DNS change), the camera streams in motionEye stopped displaying even after restarting the go2rtc container.
✅ Solution Steps¶
# 1. Restart go2rtc container (optional but safe)
docker restart go2rtc
# 2. Restart motionEye container (CRUCIAL)
docker restart motioneye
📌 Note: Restarting
go2rtcalone is not sufficient.motionEyemust also be restarted so it can reinitialize the stream subscriptions from the updated RTSP relays.
🔍 Why This Happens¶
motionEyemaintains persistent connections to RTSP streams.-
After a network change or container restart:
-
go2rtcmay get a new internal IP or DNS mapping (if using mDNS/docker DNS). motionEyedoes not automatically retry or re-resolve streams.- A container restart for
motionEyeforces it to re-pull all stream endpoints and re-establish connections.
🛡️ Recommendation¶
For systems frequently affected by network changes (e.g. DHCP or router restarts), consider:
- Pinning container IPs using Docker’s
--ipwith a custom bridge network. - Using container names instead of IPs in RTSP URLs: Example:
rtsp://go2rtc:8554/camera1
docker logs motioneye
docker logs go2rtc
🧪 Testing¶
To test recovery:
- Simulate a network reset (restart Docker network or host interface).
-
Verify:
-
go2rtccontainer starts and is accessible (check withcurl http://localhost:1984or via web UI). - Restart
motionEye. - Streams should reappear within 10–20 seconds.
🗂 Example Docker Compose¶
version: '3.8'
services:
motioneye:
image: ccrisan/motioneye
restart: unless-stopped
ports:
- "8765:8765"
volumes:
- ./motioneye/config:/etc/motioneye
- ./motioneye/media:/var/lib/motioneye
depends_on:
- go2rtc
go2rtc:
image: alexxit/go2rtc
restart: unless-stopped
ports:
- "1984:1984"
- "8554:8554"
volumes:
- ./go2rtc/config:/config