Skip to content

MiroTalk RTMP Servers Guide

rtmp

Overview

MiroTalk offers two RTMP (Real-Time Messaging Protocol) servers:

  1. Node Media Server - Node.js-based solution with admin dashboard
  2. Nginx RTMP - Lightweight Nginx module for RTMP streaming

Both integrate seamlessly with MiroTalk SFU (Selective Forwarding Unit).


🛠 Prerequisites

Before setup, ensure your system has: - docker-engine - docker-compose - ffmpeg

Bash
# Update package lists
sudo apt update

# Install required packages
sudo apt install -y docker.io docker-compose ffmpeg

Option 1: Node Media Server

Features

  • Node.js implementation
  • Admin dashboard and API endpoints
  • Authentication support
  • Docker deployment

🚀 Setup Guide

  1. Prepare directories

    Bash
    mkdir -p app/rtmp
    cd rtmpServers/node-media-server
    

  2. Configuration

    Bash
    cp src/config.template.js src/config.js  # Edit if needed
    cp docker-compose.template.yml docker-compose.yml
    

  3. Pull Docker image

    Bash
    docker pull mirotalk/nms:latest
    cd ../..
    

  4. Management Commands

    Bash
    # Start server
    npm run nms-start
    
    # Stop server
    npm run nms-stop
    
    # Restart server
    npm run nms-restart
    
    # View logs
    npm run nms-logs
    

🔍 Access Points

  • Admin Dashboard: https://your-domain:8043/admin
  • Server API: https://your-domain:8043/api/server
  • Streams API: https://your-domain:8043/api/streams

Option 2: Nginx RTMP

Features

  • Lightweight Nginx-based solution
  • Simple statistics page
  • Easy Docker deployment

🚀 Setup Guide

  1. Prepare directories

    Bash
    mkdir -p app/rtmp
    cd rtmpServers/nginx-rtmp
    

  2. Configuration

    Bash
    cp docker-compose.template.yml docker-compose.yml  # Edit if needed
    

  3. Pull Docker image

    Bash
    docker pull mirotalk/rtmp:latest
    cd ../..
    

  4. Management Commands

    Bash
    # Start server
    npm run rtmp-start
    
    # Stop server
    npm run rtmp-stop
    
    # Restart server
    npm run rtmp-restart
    
    # View logs
    npm run rtmp-logs
    

📊 Statistics

View stream stats at: https://your-domain:1935/stat


🔌 MiroTalk SFU RTMP Configuration

To integrate with MiroTalk SFU, configure these settings in app/src/config.js:

JavaScript
/**
 * RTMP Streaming Configuration
 * ---------------------------
 * Settings for Real-Time Messaging Protocol (RTMP) streaming integration
 * with MiroTalk SFU. Configure based on your streaming server choice.
 */
rtmp: {
  // Enable/disable RTMP functionality completely
  enabled: true,

  // Choose between NodeMediaServer (true) or Nginx RTMP (false)
  useNodeMediaServer: true,

  // API secret key for accessing RTMP server APIs
  // Keep this secure and change from default
  apiSecret: 'mirotalkRtmpApiSecret',

  // RTMP server connection details
  // Format: rtmp://[host]:[port]
  server: 'rtmp://localhost:1935',

  // Application name/path on the RTMP server
  // This is typically 'live' or 'stream'
  appName: 'live',

  // Default stream key (can be left empty for dynamic generation)
  // In production, generate unique keys per stream
  streamKey: '',

  /**
   * NodeMediaServer Specific Configuration
   * -------------------------------------
   * Only required when useNodeMediaServer = true
   */

  // Secret key for generating signed RTMP URLs
  // Must match the secret in NodeMediaServer config
  secret: 'mirotalkRtmpSecret',

  // Expiration time (in hours) for signed RTMP URLs
  // Helps prevent unauthorized long-term access
  expirationHours: 4,

  /**
   * Note: When using Nginx RTMP (useNodeMediaServer = false),
   * only the following parameters are needed:
   * - enabled
   * - useNodeMediaServer
   * - server
   * - appName
   * - streamKey
   */
},

For all available RTMP settings and default values, reference the source configuration:

📄 MiroTalk SFU config.js (RTMP section)


🎥 Streaming with OBS

Configuration Steps:

  1. Open OBS → Settings → Stream
  2. Set:
  3. Service: Custom...
  4. Server: rtmp://your-domain:1935/live
  5. Stream Key: Any unique identifier (e.g., my-stream-123)

Starting Your Stream:

  1. Click "Start Streaming" in OBS
  2. Share your stream URL:
    rtmp://your-domain:1935/live/your-stream-key

🔐 Authentication Note (Node Media Server)

If authentication is enabled in config.js:

JavaScript
auth: {
   play: true,
   publish: true,
   secret: 'mirotalkRtmpSecret'
},

Generating Signed URLs:

  1. Run the signing script:
    Bash
    node sign.js
    
  2. Use the generated URL format:
    Text Only
    rtmp://your-domain:1935/live/stream-key?sigh=signature-token