7. Prototype Documentation LIVE RELAY NODE

7.1 Operational Live HLS Relay Node

RelayStream operates a live media relay node capable of transcribing IPTV feeds into continuous, rolling HLS manifests (index.m3u8) with sub-500ms finality.

7.2 Python Node Execution Script (node_runner.py)
NODE_RUNNER.PYPython
import os, subprocess, http.server, socketserver, threading

PORT = 8000
STREAM_DIR = "./relaystream-espn-live"

def start_ffmpeg_transmux(input_url):
    cmd = ["ffmpeg", "-i", input_url, "-c:v", "copy", "-f", "hls",
           "-hls_time", "2", "-hls_list_size", "5", "-hls_flags", "delete_segments",
           f"{STREAM_DIR}/index.m3u8"]
    subprocess.Popen(cmd)

if __name__ == "__main__":
    threading.Thread(target=start_ffmpeg_transmux, args=("rtmp://live.source/feed",)).start()
    os.chdir(STREAM_DIR)
    with socketserver.TCPServer(("", PORT), http.server.SimpleHTTPRequestHandler) as httpd:
        httpd.serve_forever()