Icecast is a modular free media audio software, written in C++. Icecast itself is unable to manage audio formats and requires addons called "`sources`" to do. in this guide, we use ices as our source. ## Installation $ doas pkg_add ices-0.4p12 icecast edit `/var/icecast/icecast.xml` Earth username 100 2 524288 30 15 10 1 65535 replace username and Earth with your values. hackme username hackmemore /shoutcast replace `source-passowrd` and `admin-password` with a secure passoword and chanage username to your prefered value. example.com 8000 0.0.0.0 8080 8443 1 replace `example.com` with your domain. note that icecast can only listen to IPv4 or IPv6 (and not both) /radio 0 1 each stream on icecast is called a mount, we will connect to mounts using our sources /var/icecast /log /web /admin /var/run/icecast.pid here we configure paths, and ssl for port 8443. note that ssl certificate should have both private and public cert on same file. you can do that using: # cat /path/to/public/cert.pem /path/to/private/key.key > /var/icecast/etc/icecast.pem you might need to change permissions afterwards. and that will create it on `/var/icecast/etc/icecast.pem` access.log error.log 3 10000 1 _icecast _icecast now, run and enable icecast $ doas rcctl enable icecast $ doas rcctl start icecast ## Ices now we configure our source. currently there are two versions of Ices on OpenBSD repos, one is 0.4 and another one is 2.0 version 2.0 only supports ogg files and version 0.4 only supports mp3 files, in this guide, we will use version 0.4 take a backup of /etc/ices.conf $ doas cp /etc/ices.conf /etc/ices.conf.bk Open `/etc/ices.conf` /etc/radio.playlist 1 builtin ices 4 0 0 /tmp/ localhost 8000 hackme/Password> http /radio My radio Music This is my radio 128 2 add your songs on /etc/radio.playlist in following format /path/to/mp3/file.mp3 /path/to/another/mp3 file.mp3 note that they can include spaces as well. afterwards, run ices $ doas ices -c /etc/ices.conf then you can point your media player or browser to http://example.com:8000/radio and enjoy. ## MPD We could use mpd to livestream with Icecast. First, install mpd & mpc: $ doas pkg_add mpd mpc Edit `/etc/mpd.conf` # Files and directories ####################################################### # # This setting controls the top directory which MPD will search to discover the # available audio files and add them to the daemon's online database. This # setting defaults to the XDG directory, otherwise the music directory will be # be disabled and audio files will only be accepted over ipc socket (using # file:// protocol) or streaming files over an accepted protocol. # music_directory "/please-configure-your-music_directory" Replace `/please-configure-your-music_directory` to your path to Music folders. Eg. `/home/user/Music` audio_output { type "shout" encoder "vorbis" # optional, vorbis or lame name "My Shout Stream" host "localhost" port "8000" mount "/radio" password "hackme" # quality "5.0" bitrate "128" format "44100:16:1" # protocol "icecast2" # optional # user "source" # optional description "My Stream Description" # optional url "http://example.com" # optional genre "jazz" # optional public "no" # optional # timeout "2" # optional # mixer_type "software" # optional } Change some values according your needs. Then, Enable & start mpd daemon $ doas rcctl enable mpd $ doas rcctl start mpd Now, populate the database. Depending on how many tracks are in your library this may take a while. The `-w` makes it wait until it's finished. $ mpc -w update Next, make a playlist $ mpc add / Then start playing $ mpc play To make the playlist randomly play for evermore. $ mpc random $ mpc repeat And finally, visit http://example.com:8000/radio and enjoy.