Analyzing audio servers and streams

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.

The situation:

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 (also called frames sometimes) 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. It is a reoccurring sequence of 4 (aac) or 6 (mp3) bytes. But AAC streams are more complicated. I am working on a script trying to extract the coding information: PHP audio codec info to check bitrate and samplerate.

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 depend on the user-agent:

Shoutcast V2

Shoutcast V1

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