Icecast
Icecast is a streaming media server supporting open standards such as the Ogg Vorbis1 container format. You can used it to create an internet radio station or live streaming applications. My streaming setup is based on Icecast and drives live streaming without 3rd party services.
Basic setup
I refer to instructions found in the Icecast2 — UberLab 7 documentation and the official Icecast docs. In addition to the basic setup, some settings have to be changed for my needs.
TLS setup
If you didn’t use the UberLab guide, all Icecast access might be unencrypted!
You need to enable TLS2 manually by inserting <tls>1</tls>
in the <listen-socket>
block of the icecast.xml
configuration file.
Additionally, specify a <tls-certificate>
in the <path>
block and provide a file containing the cert and private key in sequence at the
specified location. Finally, restart Icecast server to reload the new configuration.
Fallback mount
Listeners can only play streams while a source client is streaming. In order to
offer static media while there’s no source client connected, a fallback mount
can be used. I edit the icecast.xml
config file and insert:
<mount type="normal">
<mount-name>/stream.ogg</mount-name>
<fallback-mount>/file.ogg</fallback-mount>
<fallback-override>1</fallback-override>
<fallback-when-full>1</fallback-when-full>
<bitrate>192</bitrate>
<type>application/ogg</type>
<subtype>vorbis</subtype>
</mount>
Change /file.ogg
to fit your needs. The provided file should have the same
encoding parameters (for example: 192 kbps CBR3) to prevent listener dropouts and must exist in Icecast’s webroot to be accessible. Fileserving
must also be activated. (Enabled by default.)
No-cache
Applications playing streams may automatically cache data. This behaviour can
lead to looping or aborting media when a fallback override
(source client connection) is happening. Using the following HTTP headers
configuration in icecast.xml
the caching can be disabled:
<http-headers>
<header name="Cache-control" value="no-cache, no-store, must-revalidate" />
<header name="Pragma" value="no-cache" />
<header name="Expires" value="0" />
</http-headers>
Logging level
For a maximum privacy of the listeners log files need to be discarded. Icecast’s logging
cannot be disabled, but written to a Null device4. This can be done by
removing the standard log files access.log
and error.log
and creating
symbolic links as follows:
rm /var/log/icecast/access.log
rm /var/log/icecast/error.log
ln -s /dev/null /var/log/icecast/access.log
ln -s /dev/null /var/log/icecast/error.log
Applications
-
Transport Layer Security (TLS) in the Wikipedia ↩︎
-
Constant bitrate (CBR) in the Wikipedia ↩︎
-
Null device in the Wikipedia ↩︎