Support of HLS?

Does the AmpliPi support HLS streams? My local radio station “broadcasts” with an HLS (HTTP Live Streaming) protocol rather than MP3 streaming.

Maybe? We honestly haven’t tried yet.

AmpliPi uses vlc as a backend for our internet radio streams and is able to use a lot of it’s capabilities, but some files like m3u need additional work to support with AmpliPi. Do you have a url we can test with?

Thanks for the quick reply!

https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/master.m3u8

Looks like we need to add support for file downloads to enable this, but that should be fairly easy to implement. Here’s the corresponding issue: Feature: Add m3u file support to internet radio stream · Issue #255 · micro-nova/AmpliPi · GitHub.

Let’s see if we can add this to the next release.

Thanks… great 0.1.9 release so far!

1 Like

Do you have any other HLS stream links?

That link works on my older version of VLC but fails after several seconds on the newer version of VLC on AmpliPi. I was wondering if it was just that specific HLS stream or HLS in general that is causing the failure…

One more datapoint: https://hls.somafm.com/hls/groovesalad/128k/program.m3u8 works on both machines

Strange, sure enough the stream you sent works!

This is the list of streams that I typically select from: CBC radio stream URLs · GitHub

CBC is the public broadcaster here in Canada. All of the streams work in a browser, but none on the AmpliPi

Hmm this is weird. It looks like AmpliPi’s version of vlc (3.0.17) does not decode any of those streams well. Here is an example of how I am testing this:

  1. Set source 1 to the empty input. This selects the digital output on the mux without playing any audio
  2. Run the following command over ssh, ch0 corresponds to source 1 in this case:
    cvlc https://cbcradiolive.akamaized.net/hls/live/2041054/ES_R1SSA/master.m3u8 -A alsa --alsa-audio-device ch0

The output on AmpliPi looks like this:

VLC media player 3.0.17.4 Vetinari (revision 3.0.13-8-g41878ff4f2)
[01fc69a0] main interface error: no suitable interface module
[01fadb58] main libvlc error: interface "globalhotkeys,none" initialization failed
[01fc69a0] dummy interface: using the dummy interface module...
[68584df0] adaptive demux: Changing stream format Unknown -> Packed AAC
[682017a8] mpeg4audio demux packetizer: AAC channels: 2 samplerate: 48000
[68584df0] adaptive demux: Ending demuxer stream. [needrestart]
[68205fb0] mpeg4audio demux packetizer: AAC channels: 2 samplerate: 48000

The line [68584df0] adaptive demux: Ending demuxer stream. [needrestart] appears to indicate the failure.

I wonder if there is a way to get a newer version of VLC with this issue fixed?
AmpliPi appears to be using the latest stable release of VLC.
I wonder if we can downgrade to a version that works better for this format? 3.0.8 does not have this issue on my laptop.

Another odd thing, looking at the m3u8 files themselves:

curl https://cbcradiolive.akamaized.net/hls/live/2041054/ES_R1SSA/master.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=48000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054/ES_R1SSA/adaptive_48/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=96000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054/ES_R1SSA/adaptive_96/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054/ES_R1SSA/adaptive_128/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=192000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054/ES_R1SSA/adaptive_192/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=48000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054-b/ES_R1SSA/adaptive_48/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=96000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054-b/ES_R1SSA/adaptive_96/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054-b/ES_R1SSA/adaptive_128/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=192000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041054-b/ES_R1SSA/adaptive_192/chunklist_ao.m3u8

vlc seems to work fine with any of the urls in the first m3u8 file, however using the high level m3u8 file causes the failure.

Looking at the contents of the original stream you gave:

https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/master.m3u8

#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=48000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/adaptive_48/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=96000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/adaptive_96/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/adaptive_128/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=192000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/adaptive_192/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=48000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036-b/ES_R1ETR/adaptive_48/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=96000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036-b/ES_R1ETR/adaptive_96/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036-b/ES_R1ETR/adaptive_128/chunklist_ao.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=192000,CODECS="mp4a.40.2"
https://cbcradiolive.akamaized.net/hls/live/2041036-b/ES_R1ETR/adaptive_192/chunklist_ao.m3u8

Using the first link:

cvlc https://cbcradiolive.akamaized.net/hls/live/2041036/ES_R1ETR/adaptive_48/chunklist_ao.m3u8  -A  alsa --alsa-audio-device ch0

Output:

[002e2aa8] main interface error: no suitable interface module
[0012eb58] main libvlc error: interface "globalhotkeys,none" initialization failed
[002e2aa8] dummy interface: using the dummy interface module...
[68785278] adaptive demux: Changing stream format Unknown -> Packed AAC
[68301328] mpeg4audio demux packetizer: AAC channels: 2 samplerate: 48000

Seems to work fine, with the embedded url.

It would be great if we could easily detect this failure and correct for it. I think we will need some more data points to handle that properly though.

Very odd… thank you for taking a look!