Sign inSign up

tstacey/stream-manager

By tstacey

•Updated about 1 year ago

Image
0

1.1K

tstacey/stream-manager repository overview

⁠Basic UDP to HTTP Stream Manager

⁠Overview

This project implements a high-performance video streaming server that receives UDP streams and serves them as HLS (HTTP Live Streaming) streams. It's designed to handle multiple named streams concurrently and provides real-time status monitoring of active streams.

https://hub.docker.com/r/tstacey/stream-manager⁠

⁠Features

  • Receives video streams via UDP
  • Serves video streams as HLS over HTTP
  • Supports multiple concurrent named streams
  • Real-time status monitoring of streams (active, inactive, stopped)
  • Single HTTP server serving all streams by name
  • Automatic HLS segment management
  • Threaded architecture for improved performance
  • Logging for easy debugging and monitoring

⁠Requirements

  • Docker

⁠Usage

docker pull tstacey/stream-manager

⁠Starting the Server
⁠Option 1: Docker Run

Run the following command:

docker run -p 5000:5000 -p 8080:8080 -p 80:80 -p 5100-5200:5100-5200/udp -v ./users.csv:/app/users.csv tstacey/stream-manager

  • Port 5000: Web Admin UI
  • Port 8080: HLS streaming server (serves all streams)
  • Port 80: Nginx server (serves HLS .ts files directly)
  • Port 5100-5200: Available UDP inputs on the container
  • users.csv: A CSV file provided with username/password pairs for basic authentication

Example users.csv:

admin,password123
admin2,password456
⁠Accessing Streams

Once the server is running, you can access the admin dashboard at: http://DOCKER_HOST_IP:5000

The admin dashboard can be used to create and delete named streams.

Once a stream has been created with name "mystream", it becomes available at http://DOCKER_HOST_IP:8080/mystream.

To view the stream you can use ffplay: ffplay http://DOCKER_HOST_IP:8080/mystream

Or access the HLS playlist directly: http://DOCKER_HOST_IP:8080/mystream.m3u8

⁠Enhanced Performance Access

For better performance, streams can be accessed directly via NGINX on port 80 using clean URLs: http://DOCKER_HOST_IP/mystream

This bypasses the Python server and serves HLS content directly through NGINX.

⁠Monitoring

The server provides real-time status monitoring for each stream:

  • active: The stream is receiving and processing data
  • inactive: The stream is set up but not receiving data
  • stopped: The stream has been stopped or encountered an error
⁠Logging

The server uses Python's logging module to provide detailed logs.

⁠Sending an input stream

ffmpeg -re -stream_loop -1 -i VIDEO.ts -map 0 -c:v libx264 -maxrate 512k -b:v 512k -bufsize 50M -f mpegts 'udp://DOCKER_IP:5100?pkt_size=188'

Note: Replace 5100 with the UDP port you configured for your stream in the admin interface.

⁠Performance Considerations

  • The server uses a threaded architecture to handle multiple clients efficiently.
  • HLS segments are automatically managed and cleaned up when streams are deleted.
  • FFmpeg is used for robust video stream handling and HLS generation.
  • All streams are served from a single HTTP server on port 8080.

Tag summary

Content type

Image

Digest

sha256:94a7d825e…

Size

545.1 MB

Last updated

about 1 year ago

docker pull tstacey/stream-manager