Icecast is a streaming media server supporting open standards like Ogg Vorbis container format. You can used it for creating an internet radio station or even for live streaming applications. My streaming setup is based on Icecast and used for live streaming without 3rd party services. It's broadcasted via this URL:
https://this.ven.uber.space/stream/live.ogg
Instructions on how to setup Icecast basically can be found in official documentation as well as in Icecast2 — UberLab 7 documentation.
In addition to basic setup, there are some configuration details important to me.
If you didn't use the UberLab guide, all Icecast access might be unencrypted! You need to enable Transport Layer Security (TLS) manually:
Activate TLS in icecast.xml
configuration file, omit …
:
<listen-socket> ... <tls>1</tls> </listen-socket>
Also specify a certificate in path settings:
<paths> <tls-certificate>/path/to/full-certificate.pem</tls-certificate> </paths>
Change /path/to/full-certificate.pem
to your needs and note that this file needs to contain the cert, then the private key in sequence. Finally restart Icecast server to reload new configuration.
If Icecast refuses to start, analyse logs and check if it has been compiled against OpenSSL.
Listeners can only play streams while a source client is streaming. To offer static media while there's no source client connected, a fallback mount can be used. Edit icecast.xml
config file:
<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 (e.g. bitrate 192 kbps CBR) to prevent listener dropouts and must exist in Icecast's webroot to be accessible. Fileserving (enabled by default) must be activated, too.
Applications playing streams may automatically cache data. This behaviour can lead to looping or aborting media when fallback override (source client connection) is happening. Using the following HTTP headers configuration in icecast.xml
, 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>
For maximum privacy of listeners log files needs to be discarded. Icecast's logging cannot be disabled, but written to /dev/null. This can be done by removing standard log files access.log
and error.log
and creating symbolic links:
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
Note: Locations of log files may vary depending on your basic setup.
To actually stream media to Icecast and use it's features take a look at my streaming setup.
Category: Services