Sign inSign up

daddelgreis74/rtsp-stream-hub

By daddelgreis74

Updated 30 days ago

Lightweight RTSP & Webcam to MJPEG Transcoding Hub with ONVIF & VAAPI GPU support.

Image
0

1.3K

daddelgreis74/rtsp-stream-hub repository overview

RTSP Stream Hub Logo

🎥 RTSP Stream Hub

High-Performance RTSP, ONVIF & Webcam Stream Hub with On-the-Fly MJPEG Transcoding, Stream Multiplexing & Hardware Acceleration

GitHub Release Docker Pulls Docker Image Size TrueNAS Community App License: MIT

OverviewFeaturesQuick StartTrueNAS SCALEConfigurationAPI ReferenceSecurityLicense


📖 Overview

RTSP Stream Hub is a lightweight, standalone, fully containerized web application designed for managing and on-the-fly transcoding of RTSP camera streams and webcams into browser-compatible MJPEG.

It is specifically tailored to integrate IP cameras (e.g., Tapo, Reolink, Axis, Hikvision, Blink) seamlessly, with ultra-low latency and zero complex streaming server infrastructure, into web browsers and SmartHome dashboards (such as Neo Deck, Home Assistant, or MagicMirror).

graph LR
    subgraph Cameras ["📹 Video Sources"]
        A1[RTSP H.264 / H.265]
        A2[ONVIF Cameras]
        A3[HTTP/HTTPS Webcams]
        A4[HLS .m3u8 Streams]
    end

    subgraph Hub ["⚡ RTSP Stream Hub"]
        B[FFmpeg Engine<br/>+ Intel/AMD VAAPI GPU]
        C[(SQLite DB<br/>Tokens & Config)]
    end

    subgraph Clients ["📱 Dashboards & Clients"]
        D1[Neo Deck Dashboard]
        D2[Home Assistant]
        D3[Web Browsers / Smart TVs]
    end

    Cameras -->|Stream Ingest| Hub
    Hub -->|Low-Latency MJPEG| Clients

✨ Features

  • 🔄 Self-Contained RTSP-to-MJPEG Transcoding: Uses an optimized, integrated ffmpeg pipeline for real-time, low-latency conversion of RTSP (H.264/H.265) streams into smooth MJPEG video feeds.
  • 🌐 Multi-Protocol Support: Handles RTSP, direct HTTP/HTTPS webcams, HLS .m3u8 live streams, and static JPEG snapshots with configurable auto-refresh intervals.
  • GPU Hardware Acceleration (Intel/AMD VAAPI): Automatically detects and utilizes Intel/AMD graphics cards (/dev/dri) to dramatically reduce host CPU load.
  • 📡 ONVIF Auto-Discovery: Scans the local subnet for compatible IP cameras at the push of a button with 1-click profile import.
  • 👥 Multi-User & Granular Permissions: Built-in administration panel for managing users with distinct permission roles (View Only, Manage Cameras, Admin).
  • 🔒 Secure Dashboard Tokens (Scoped Links): Generates minimal, persistent stream tokens (role: 'stream-viewer') strictly isolated to a single camera with zero administrative access.
  • ⏱️ Inactivity Auto-Logout: Automatically logs out administrative sessions after 15 minutes of inactivity to protect client devices and conserve server resources.
  • 💾 Persistent SQLite Database: File-based, transaction-safe storage for all camera configurations and user accounts within a mounted volume.
  • 🌓 Modern Bootstrap 5 UI: Fast, responsive web interface with instant Dark & Light Mode switching.

🚀 Quick Start

Important

**Secret Key Required:** The `JWT_SECRET` environment variable is **mandatory** and must be at least **32 characters** long. The server will safely refuse to start without a strong secret key.

Generate a secure secret in your terminal:

openssl rand -hex 32
# or using Node.js:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Create a docker-compose.yml file:

services:
  rtsp-stream-hub:
    image: daddelgreis74/rtsp-stream-hub:latest # or: ghcr.io/daddelgreis74/rtsp-stream-hub:latest
    container_name: rtsp-stream-hub
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./data:/usr/src/app/data
    devices:
      - /dev/dri:/dev/dri  # Optional: For Intel/AMD GPU hardware acceleration
    environment:
      - PORT=8080
      - JWT_SECRET=your_at_least_32_character_long_secret_key
      # - DISABLE_VAAPI=true # Optional: Set to true to disable GPU acceleration

Start the application:

docker compose up -d

2. Using Docker CLI
docker run -d \
  --name rtsp-stream-hub \
  --restart unless-stopped \
  -p 8080:8080 \
  -v $(pwd)/data:/usr/src/app/data \
  --device /dev/dri:/dev/dri \
  -e JWT_SECRET="your_at_least_32_character_long_secret_key" \
  daddelgreis74/rtsp-stream-hub:latest

🎛️ TrueNAS SCALE

Option A: Via TrueNAS Community Catalog (In Review)
  1. In TrueNAS SCALE, navigate to Apps > Discover Apps.
  2. Search for RTSP Stream Hub and click Install.
  3. Provide your JWT_SECRET and select your dataset storage path.
Option B: As a Custom App
  1. Go to Apps > Discover Apps > Custom App.
  2. Application Name: rtsp-stream-hub
  3. Image Repository: daddelgreis74/rtsp-stream-hub (or ghcr.io/daddelgreis74/rtsp-stream-hub)
  4. Image Tag: latest (or e.g., 1.1.5)
  5. Environment Variables:
    • JWT_SECRET: (Your 32+ character secret key)
  6. Port Forwarding: 8080 (Container) $\rightarrow$ 30474 (or any available host port).
  7. Storage: Mount host dataset to /usr/src/app/data.
  8. GPU Passthrough: Check Non-NVIDIA GPU Passthrough (1 GPU).

🔐 Default Credentials

On initial startup, an administrator account is automatically created:

FieldDefault Value
Usernameadmin
Passwordadmin

Warning

Please change the default password immediately after your first login under the **User Management** menu!

⚙️ Configuration (Environment Variables)

VariableRequiredDefaultDescription
JWT_SECRETYESCryptographic secret (min. 32 chars) for signing authentication and scoped stream tokens.
PORTNo8080Internal web server port.
DISABLE_VAAPINofalseSet to true to disable GPU hardware acceleration and force software decoding.

📡 REST API & Stream Endpoints

MethodEndpointAuthorizationDescription
POST/api/auth/loginPublicAuthenticate and obtain JWT token
GET/api/camerasUser / AdminRetrieve list of configured cameras
POST/api/camerasEditor / AdminAdd a new camera configuration
PUT/api/cameras/:idEditor / AdminUpdate an existing camera
DELETE/api/cameras/:idEditor / AdminDelete a camera
GET/api/cameras/discoveryEditor / AdminTrigger ONVIF network auto-discovery scan
GET/api/cameras/:id/tokenUser / AdminGenerate an isolated, persistent stream token (role: 'stream-viewer')
GET/api/streams/mjpeg/:id?token=...Stream-ViewerLive MJPEG multipart video stream (multipart/x-mixed-replace)
GET/api/usersAdminList all user accounts
POST/api/usersAdminCreate a new user account
PUT/api/users/:id/permissionsAdminUpdate user roles and permissions
DELETE/api/users/:idAdminDelete a user account

🛡️ Security & Scoped Tokens

RTSP Stream Hub maintains a strict security boundary between Administrative Tokens and Stream Tokens:

  • Dashboard Stream Links contain a cryptographically signed token that is valid exclusively for the /api/streams/mjpeg/:id endpoint of that specific camera.
  • Even if a stream URL is exposed in dashboard frontend code or browser HTML sources, an unauthorized viewer cannot access administrative endpoints, modify settings, or view other cameras.

📄 License

This project is licensed under the MIT License.
Copyright (c) 2026 Daddelgreis74.

Tag summary

Content type

Image

Digest

sha256:c61873a72

Size

306.9 MB

Last updated

30 days ago

docker pull daddelgreis74/rtsp-stream-hub