Operations Guide

Daily Operations

Starting a Streaming Session

  1. Verify services are running:
    Get-Service StreamDelayController, StreamDelayInput
  2. Open dashboard: http://localhost:8080
  3. Set desired delay (recommend 60s)
  4. Start OBS stream — the Multiple Output plugin auto-sends to the delay system
  5. Verify delayed stream in OBS Media Source

Adjusting Delay During Stream

  • Move the slider or use preset buttons in the dashboard
  • Changes apply immediately (playlist updates every 2 seconds)
  • OBS transitions within 4–6 seconds
  • Best practice: Increase gradually; allow 10–15 seconds between adjustments

Ending a Streaming Session

  • Stop OBS stream
  • HLS files are cleaned up automatically

Service Management

# Check status
Get-Service StreamDelayController, StreamDelayInput

# Start services (Input Receiver first)
Start-Service StreamDelayInput
Start-Service StreamDelayController

# Stop services (Controller first)
Stop-Service StreamDelayController
Stop-Service StreamDelayInput

# Restart both
Restart-Service StreamDelayInput
Restart-Service StreamDelayController

Note: Start Input Receiver first, then Controller. Stop in reverse order. The Controller depends on Input Receiver generating HLS files.

Monitoring

Dashboard

The dashboard at http://localhost:8080 auto-updates every 2 seconds with service status, stream info, and buffer usage.

Log Files

# Tail controller log
Get-Content C:\ProgramData\StreamDelay\logs\controller.log -Tail 50

# Tail input receiver log
Get-Content C:\ProgramData\StreamDelay\logs\input-receiver.log -Tail 50

# Find errors
Select-String -Path C:\ProgramData\StreamDelay\logs\*.log -Pattern "ERROR"

Windows Event Log

Get-EventLog -LogName Application -Source StreamDelay* -Newest 20

Process & Port Monitoring

# Check processes
Get-Process mediamtx, tk-delay-controller, tk-delay-input-receiver -ErrorAction SilentlyContinue

# Check ports
netstat -an | findstr "8080 8888 9000 9997"

API Health Checks

# Controller status
Invoke-RestMethod http://localhost:8080/api/status

# Current delay
Invoke-RestMethod http://localhost:8080/api/delay/current

# MediaMTX health
Invoke-RestMethod http://localhost:9997/v3/paths/list

HLS Buffer Monitoring

# Count segments
(Get-ChildItem C:\ProgramData\StreamDelay\hls\*.ts).Count

# Check buffer size
(Get-ChildItem C:\ProgramData\StreamDelay\hls | Measure-Object -Property Length -Sum).Sum / 1MB

# Verify playlist updates
Get-Item C:\ProgramData\StreamDelay\hls\delayed.m3u8 | Select-Object LastWriteTime

Maintenance

Log Rotation

Services append to logs indefinitely. Implement rotation when logs reach ~100 MB:

# Archive and clear logs
Stop-Service StreamDelayController, StreamDelayInput
Compress-Archive C:\ProgramData\StreamDelay\logs\*.log -DestinationPath "logs-archive-$(Get-Date -Format 'yyyyMMdd').zip"
Remove-Item C:\ProgramData\StreamDelay\logs\*.log
Start-Service StreamDelayInput, StreamDelayController

Maintenance Schedule

FrequencyTask
WeeklyCheck log sizes, Event Viewer, service status, disk space
MonthlyArchive logs, backup config, review performance
QuarterlyFull system test, review config, check for updates

Backup & Restore

Backup

Copy-Item C:\ProgramData\StreamDelay\.env -Destination backup\.env
Copy-Item C:\ProgramData\StreamDelay\state.json -Destination backup\state.json -ErrorAction SilentlyContinue

Restore

Stop-Service StreamDelayController, StreamDelayInput
Copy-Item backup\.env -Destination C:\ProgramData\StreamDelay\.env
Copy-Item backup\state.json -Destination C:\ProgramData\StreamDelay\state.json -ErrorAction SilentlyContinue
Start-Service StreamDelayInput, StreamDelayController

Quick Recovery Procedures

Full System Reset

Stop-Service StreamDelayController, StreamDelayInput
Remove-Item C:\ProgramData\StreamDelay\hls\* -Force
Remove-Item C:\ProgramData\StreamDelay\logs\*.log -Force
Start-Service StreamDelayInput, StreamDelayController

Emergency Stop

Stop-Service StreamDelayController, StreamDelayInput -Force
Get-Process mediamtx -ErrorAction SilentlyContinue | Stop-Process -Force

Troubleshooting

Services Not Starting

  1. Check Event Viewer (Application log)
  2. Verify configuration file exists: C:\ProgramData\StreamDelay\.env
  3. Check file permissions on C:\ProgramData\StreamDelay
  4. Check for port conflicts: netstat -an | findstr "8080 9000"

OBS Can’t Connect

  1. Verify StreamDelayInput service is running
  2. Check port 9000: netstat -an | findstr 9000
  3. Verify SRT URL: srt://localhost:9000?streamid=publish:srt
  4. Review input-receiver.log for errors

Dashboard Not Accessible

  1. Verify StreamDelayController service is running
  2. Check port 8080: netstat -an | findstr 8080
  3. Try: http://127.0.0.1:8080

No Delayed Stream

  1. Verify HLS segments exist: Get-ChildItem C:\ProgramData\StreamDelay\hls\*.ts
  2. Check if delayed.m3u8 exists and is being updated
  3. Review controller.log for playlist generation errors

Common Error Messages

ErrorSolution
Service Cannot Be Started (1053)Check logs, port conflicts, missing dependencies
Failed to Connect to MediaMTXEnsure Input Receiver running, verify MediaMTX process
Insufficient Segments for DelayReduce delay or increase HLS_LIST_SIZE
Port Already in UseFind conflicting process, change port in .env
Access DeniedGrant proper permissions on C:\ProgramData\StreamDelay