Both sides previous revisionPrevious revisionNext revision | Previous revision |
services:icecast [2021/12/12 19:25] – thisven | services:icecast [2022/09/30 13:31] (current) – [Basic setup] Updated link to lab guide this.ven |
---|
| ====== Icecast ====== |
| |
| [[https://icecast.org|Icecast]] is a streaming media server supporting open standards like [[wp>Vorbis|Ogg Vorbis]] container format. You can used it for creating an internet radio station or even for live streaming applications. My [[floss_media_studio/streaming_setup|streaming setup]] is based on [[services/icecast|Icecast]] and used for live streaming without 3rd party services. It's broadcasted via this URL: |
| |
| [[https://this.ven.uber.space/stream/live.ogg]] |
| |
| > **Note:** My events are announced in the [[https://this.ven.uber.space/#news|news]] section and for a full experience please visit the [[https://this.ven.uber.space/music/live/|live page]]. |
| |
| ===== Basic setup ===== |
| |
| Instructions on how to setup Icecast basically can be found in [[https://www.icecast.org/docs/icecast-trunk/|official documentation]] as well as in [[https://lab.uberspace.de/guide_icecast2|Icecast2 — UberLab 7 documentation]]. |
| |
| ===== Advanced configuration ===== |
| |
| In addition to basic setup, there are some configuration details important to me. |
| |
| ==== TLS setup ==== |
| |
| If you didn't use the UberLab guide, all Icecast access might be unencrypted! You need to enable [[wp>Transport_Layer_Security|Transport Layer Security (TLS)]] manually: |
| |
| Activate [[https://www.icecast.org/docs/icecast-trunk/config_file/#tcp-port-settings|TLS]] in ''icecast.xml'' configuration file, omit ''...'': |
| |
| <code xml><listen-socket> |
| ... |
| <tls>1</tls> |
| </listen-socket></code> |
| |
| Also specify a certificate in [[https://www.icecast.org/docs/icecast-trunk/config_file/#path-settings|path settings]]: |
| |
| <code xml><paths> |
| <tls-certificate>/path/to/full-certificate.pem</tls-certificate> |
| </paths></code> |
| |
| 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 [[https://www.openssl.org|OpenSSL]]. |
| |
| ==== Fallback mount ==== |
| |
| Listeners can only play streams while a source client is streaming. To offer static media while there's no source client connected, a [[https://www.icecast.org/docs/icecast-trunk/config_file/#mount-specific-settings|fallback mount]] can be used. Edit ''icecast.xml'' config file: |
| |
| <code xml><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></code> |
| |
| Change ''/file.ogg'' to fit your needs. The provided file should have the same encoding parameters (e.g. bitrate 192 kbps [[wp>Constant_bitrate|CBR]]) to prevent listener dropouts and must exist in Icecast's webroot to be accessible. [[https://www.icecast.org/docs/icecast-trunk/config_file/#general-settings|Fileserving]] (enabled by default) must be activated, too. |
| |
| ==== No-cache ==== |
| |
| 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 [[https://www.icecast.org/docs/icecast-trunk/config_file/#http-headers|HTTP headers]] configuration in ''icecast.xml'', caching can be disabled: |
| |
| <code xml><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></code> |
| |
| ===== Disable logging ===== |
| |
| For maximum privacy of listeners log files needs to be discarded. Icecast's [[https://www.icecast.org/docs/icecast-trunk/config_file/#logging-settings|logging]] cannot be disabled, but written to [[wp>Null_device|/dev/null]]. This can be done by removing standard log files ''access.log'' and ''error.log'' and creating [[wp>Symbolic_link|symbolic links]]: |
| |
| <code bash>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</code> |
| |
| Note: Locations of log files may vary depending on your [[#basic_setup|basic setup]]. |
| |
| ===== Best practices ===== |
| |
| To actually stream media to Icecast and use it's features take a look at my [[floss_media_studio/streaming_setup|streaming setup]]. |
| |
| {{tag>internet_radio live_streaming media_server streaming}} |
| |
| Category: [[./|Services]] |