Repository navigation
Releases: clifarr/HLS-Radio-Converter
Release list
v2.0.0
The first release of the rewritten converter: one service that turns HLS
(.m3u8) Internet radio streams into a plain, continuous HTTP audio stream a
radio can play.
Your radios need no changes. http://<pi>:8123/<percent-encoded-m3u8-url>
is byte-for-byte the URL format version 1 used, so anything already configured
keeps working.
Highlights
- One pipeline per station, shared by every radio. Ten radios on one station
costs one decode, not ten. Measured on a Raspberry Pi 3: about 165% of one
core for a 192 kbit/s station, unchanged whether one radio is listening or six. - FFmpeg is not needed for some stations. MP3 and AAC-in-MPEG-TS are
forwarded through a pure-Python demuxer, so those stations cost almost no CPU
and lose no quality.radioconv probe <url>tells you which engine a station
will use before you point a radio at it. - A radio that connects mid-stream starts playing at once. HLS arrives in
segments and the encoder finishes a segment faster than realtime, so a new
listener used to wait for the next one. Time to first byte on a real station
went from 8.08s to 0.02s, and each listener is now handed recent audio to
cover the gap between segments. - Encrypted streams work:
EXT-X-KEY:AES-128, including mid-stream key
rotation. - It stays up. Every socket has a timeout, every buffer is bounded, every
FFmpeg child is killed on the way out, and a wedged stream is restarted rather
than left sitting there serving nothing.
Watching it
http://<pi>:8123/ turns any .m3u8 URL into the exact string to type into a
radio. http://<pi>:8123/dashboard shows what every station is doing right now -
listeners, CPU, memory, buffer depth, restarts and the last hour of traffic - and
every figure and column heading explains itself on hover. Silence is measured
from the listener's side, so a station that is simply idle between segments is
not reported as a fault.
The same numbers are available as JSON at /metrics.json and in Prometheus
format at /metrics, which is what a script or a home-automation rule should
read.
Installing
git clone https://github.com/clifarr/HLS-Radio-Converter
cd HLS-Radio-Converter
sudo ./packaging/install.sh(main is this release. To pin the tag instead, add --branch v2.0.0 to the
clone, which leaves you on a detached HEAD - fine for installing, but
git pull then does nothing until you switch back to main.)
Needs Python 3.9+ and FFmpeg. On 64-bit ARM, x86_64 and Apple Silicon an FFmpeg
binary ships with the dependencies; on 32-bit Raspberry Pi the installer adds the
distro package. radioconv check reports which one is in use.
A PyInstaller spec is included for a machine with no Python at all - see
CONTRIBUTING.md.
Coming from version 1
- Radios need no changes.
- Settings were renamed:
ffmpeg_location→ffmpeg_path,ip_address→host,
buffer_size→chunk_size.bitrateandportare unchanged and the
defaults match, so audio quality is the same out of the box. - If your stations are MP3-in-TS you can now drop FFmpeg entirely.
Full instructions, troubleshooting and the hardware notes are in the
README.