Audio Stream Servers

How to use Icecast and Shoutcast streams with the HTML5 audio player and read out stream information.

Working on the fmstream.org radio stream directory portal got me into the neccessity to do some research about the audio servers and their behaviour. The aim was nothing less than to compile the most comprehensive list of URLs that are compatible with the HTML5 player. Complications:

The good news:

Checking formats, bit rates, sample rates and channels

This is important to judge the audio quality and required bandwidth. You can obtain this information by using...

ffprobe

ffprobe is based on the ffmpeg project and delivers the most accurate results. It is a command-line executable tool and can be integrated into all sorts of software environments. It seems that ffprobe is analyzing the deep stream data instead of just checking stream-packet-headers or http-headers.

Packet headers

The first bytes of a packet can obtain reliant coding information. MP3 packet headers contain bitrate and samplerate. You can find them within the stream, capturing some KBytes with the fread-command in php or other methods. They start with ff f. (12 bits of 1) both in MP3 and AAC streams. But AAC streams are more complicated.

AAC headers

HTTP headers

The HTTP header is something totally different. It is not part of the stream but comes from a server after a request. The information is not always accurate. Icecast has some tags in it like icy-br for bitrate, sample rate and channels.

Server index pages

Icecast gives bitrate and mime type but no information about AAC extensions (HE-AAC/SBR/PS). Shoutcast gives bitrate and samplerate. Both samplerates tend to relate to the AAC core.

Some remarkable things

Domains

Server types

Shoutcast

1.2.3.4:8000 response will be:

Shoutcast V2 servers can host more than one stream:

Other playlist formats (listen.m3u,listen.asx) and song info can be accessed via the Public Pages API Shoutcast V1 (outdated but still present)

Icecast

Broadcaster Solutions

There is a wide range of free and commercial software packages for setting up your stream and organizing it. This list is small but it is meant to grow :-) Many solutions are based on Icecast with a few modifications and more restrictions - metadata cannot be retrieved that easy anymore.

Free Software