01 / CONTEXT
The problem
Keeping audio on the air usually means depending on a third-party service—or a manual process that falls over the moment someone closes the laptop.
Audio infrastructure · 2025
A small continuous broadcast infrastructure designed to run stably with few resources.
A lightweight infrastructure combining FFmpeg and Icecast into an AutoDJ pipeline: encodes and streams continuously from a local playlist, built to run on modest hardware without constant supervision.
01 / CONTEXT
Keeping audio on the air usually means depending on a third-party service—or a manual process that falls over the moment someone closes the laptop.
02 / DIRECTION
A lightweight infrastructure combining FFmpeg and Icecast into an AutoDJ pipeline: encodes and streams continuously from a local playlist, built to run on modest hardware without constant supervision.
03 / EXECUTION
04 / RESULT
05 / IMPLEMENTATION
import subprocess
def start_icecast_broadcast(mountpoint, bitrate=192):
"""Spawn an FFmpeg sub-process encoding audio files directly into Icecast mount."""
print(f"[*] Starting AetherRadio Continuous encoder on {mountpoint}...")
ffmpeg_cmd = [
'ffmpeg', '-re',
'-loop', '1', '-f', 'concat', '-safe', '0', '-i', 'playlist.txt',
'-acodec', 'libmp3lame', '-b:a', f'{bitrate}k',
'-ac', '2', '-ar', '44100',
'-f', 'mp3', f'icecast://{os.getenv("ICECAST_USER", "source")}:{os.getenv("ICECAST_PASSWORD")}@{os.getenv("ICECAST_HOST", "localhost")}:8000/{mountpoint}'
]
# Run in background with redirect
proc = subprocess.Popen(
ffmpeg_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
)
print(f"[+] Broadcaster spawned with PID {proc.pid}")
return proc06 / LEARNING
I underestimated how much real effort goes into silent reconnection on network failures—the least glamorous part of the project, and the one that matters most when nobody is watching.