Skip to content

LiveStreamInput (LSI)

Overview

LiveStreamInput (LSI) is a module within mcaster that implements signal source management and automatic switching between primary and backup sources. The module ensures high broadcasting reliability through automatic switching when problems occur with the primary source.

Operating Principles

Automatic Switching

LSI automatically switches between sources under the following conditions: - Missing frames on the primary source - Signal quality issues - Technical equipment failures

Backup Source Verification

During primary source operation, LSI regularly performs test connections to secondary sources to ensure backup readiness.

Source Compatibility

LSI checks compatibility between primary and backup sources by: - Codecs - Audio tracks - Stream parameters - Other characteristics for seamless switching

Configuration

Basic Setup

stream Reg_1010_01_Kanal_ENC {
  input copy://Reg_1010_01_Kanal_sdi1;
  input copy://Reg_1010_01_Kanal_sdi2;
  title "01 FIRST CHANNEL";
  source_timeout 1;
}

Configuration Parameters

Parameter Description Required Example
input Video signal source Yes copy://Reg_1010_01_Kanal_sdi1
title Stream name No "01 FIRST CHANNEL"
source_timeout Switch timeout (seconds) No 1

Advanced Configuration

stream Main_Channel {
  input copy://primary_source source_timeout=10;
  input copy://backup_source_1;
  input copy://backup_source_2;
  title "Main Channel";
  source_timeout 2;  
}

Monitoring via HTTP API

Main API Methods

  • streams_list — list of all streams
  • stream_get — detailed stream information

Key Stats Parameters

Reconnections and Switches

{
  "stats": {
    "input": {
      "retries": 15,           // Number of reconnections
      "input_switches": 3,     // Number of switches between sources
      "num_sec_on_primary_input": 86400,    // Time working on primary source
      "num_sec_on_secondary_input": 3600    // Time working on backup source
    }
  }
}

Backup Source Status

{
  "stats": {
    "input": {
      "valid_secondary_inputs": 2,      // Number of working backup sources
      "invalid_secondary_inputs": 1,    // Number of failed backup sources
      "divergent_inputs": 0             // Number of incompatible sources
    }
  }
}

Monitoring Parameters Interpretation

Reconnections (stats.input.retries)

  • Normal value: 0-5 reconnections per day
  • Problematic value: >10 reconnections per day
  • Action: When there are many reconnections, check source stability

Switches (stats.input.input_switches)

  • Normal value: 0-2 switches per day
  • Problematic value: >5 switches per day
  • Action: Frequent switches indicate problems with the primary source

Time Working on Sources

Comparing num_sec_on_primary_input and num_sec_on_secondary_input shows: - Backup efficiency — how much time the system worked on backup - Primary source quality — frequency of backup usage - Potential downtime without automatic switching

Backup Source Status

Working Backups (stats.input.valid_secondary_inputs)

  • Normal value: >0 (working backup available)
  • Critical value: 0 (no working backups)
  • Action: When value is 0, immediate repair of backup sources is required

Failed Backups (stats.input.invalid_secondary_inputs)

  • Normal value: 0-1
  • Problematic value: >2
  • Action: Consider removing or reducing payment for unstable sources

Incompatible Sources (stats.input.divergent_inputs)

  • Normal value: 0
  • Problematic value: >0
  • Risk: During failure, playback issues up to TV freezing are possible
  • Action: Bring sources to unified format

Monitoring Examples

Checking Stream Status

# Getting list of streams
curl -X GET "http://localhost:8080/api/streams_list"

# Getting detailed stream information
curl -X GET "http://localhost:8080/api/stream_get?name=Reg_1010_01_Kanal_ENC"

Monitoring Script

#!/bin/bash

# Checking number of reconnections
retries=$(curl -s "http://localhost:8080/api/stream_get?name=Reg_1010_01_Kanal_ENC" | jq '.stats.input.retries')

if [ $retries -gt 10 ]; then
    echo "WARNING: High number of retries: $retries"
fi

# Checking availability of backup sources
valid_backups=$(curl -s "http://localhost:8080/api/stream_get?name=Reg_1010_01_Kanal_ENC" | jq '.stats.input.valid_secondary_inputs')

if [ $valid_backups -eq 0 ]; then
    echo "CRITICAL: No valid backup sources available"
fi

Troubleshooting

Frequent Reconnections

  1. Check stability of primary source
  2. Increase source_timeout to reduce sensitivity
  3. Check network settings between mcaster and source
  4. Monitor logs of LSI module

Missing Backup Sources

  1. Check availability of backup sources
  2. Ensure correctness of configuration
  3. Check network connectivity
  4. Restore backup sources

Source Incompatibility

  1. Bring sources to unified format
  2. Check codecs and parameters
  3. Ensure matching audio tracks
  4. Configure unified stream parameters

Configuration Recommendations

Optimal source_timeout Values

  • Stable sources: 1-2 seconds
  • Unstable sources: 3-5 seconds
  • Satellite sources: 5-10 seconds

Number of Backup Sources

  • Minimum: 1 backup source
  • Recommended: 2-3 backup sources
  • Maximum: 5 backup sources (to avoid complexity)

Monitoring and Alerts

alerts:
  - condition: "stats.input.valid_secondary_inputs == 0"
    severity: "critical"
    message: "No backup sources available"

  - condition: "stats.input.retries > 10"
    severity: "warning"
    message: "High number of reconnections"

  - condition: "stats.input.divergent_inputs > 0"
    severity: "warning"
    message: "Incompatible sources detected"

Conclusion

LiveStreamInput (LSI) ensures high broadcasting reliability through automatic switching between sources. Proper configuration and monitoring of the module allows minimizing service downtime and ensuring stable broadcasting even when problems occur with the primary signal source.