Skip to content

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. go2rtc is used to multiplex and allow multiple consumers (like motionEye + 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 go2rtc alone is not sufficient. motionEye must also be restarted so it can reinitialize the stream subscriptions from the updated RTSP relays.


🔍 Why This Happens

  • motionEye maintains persistent connections to RTSP streams.
  • After a network change or container restart:

  • go2rtc may get a new internal IP or DNS mapping (if using mDNS/docker DNS).

  • motionEye does not automatically retry or re-resolve streams.
  • A container restart for motionEye forces 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 --ip with a custom bridge network.
  • Using container names instead of IPs in RTSP URLs: Example:

rtsp://go2rtc:8554/camera1
* Adding a watchdog script to auto-restart containers if connectivity is lost. * Monitoring logs with:

docker logs motioneye
docker logs go2rtc

🧪 Testing

To test recovery:

  1. Simulate a network reset (restart Docker network or host interface).
  2. Verify:

  3. go2rtc container starts and is accessible (check with curl http://localhost:1984 or via web UI).

  4. Restart motionEye.
  5. 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