1

AzuraCast uses Icecast (currently Icecast 2.4.0-kh10-ac4) to broadcast live radio.

Icecast has an option to prepend a media file to the live stream when a new listener connects.

This is what the Icecast Documentation has to say about the <intro> option (my bold):

An optional value which will specify the file those contents will be sent to new listeners when they connect but before the normal stream is sent. Make sure the format of the file specified matches the streaming format. The specified file is appended to webroot before being opened.

Same format

To be absolutely sure the intro file had exactly the same encoding format as the stream, I used a short dump of the stream (mplayer -dumpstream <mountpoint_url>) to use as an intro file for testing.

Directly editing icecast.xml? No.

Now, the Icecast configuration file for a station is typically located at /var/azuracast/stations/<station_slug>/config/icecast.xml on the server on which AzuraCast is running (with default settings).

The first problem I encountered is that AzuraCast overwrites the icecast.xml file everytime it starts or restarts Icecast, so it can't be edited directly.

Changing Icecast settings from within AzuraCast

I luckily managed to override (some of) the Icecast settings by entering JSON in the Custom Configuration field (found under Edit Profile > Broadcasting). Here is an example:

{
  "location" : "Overrides location",
  "mount" : [{
    "intro" : "/intro-128.mp3"
  },{
    "intro" : "/intro-64.aac"
  }],
  "paths" : {
    "webroot" : "/usr/local/share/icecast/web"
  },
  "directory" : {
    "yp-url-timeout" : "15",
    "yp-url" : "http://dir.xiph.org/cgi-bin/yp-cgi"
  }
}

And this successfully translates into XML inside icecast.xml when Icecast is restarted (just keeping relevant tags):

<icecast>
    <location>Overrides location</location>
    ...
    <mount type="normal">
        <mount-name>/radio.mp3</mount-name>
        ...  
        <intro>/intro-128.mp3</intro>
    </mount>
    <mount type="normal">
        <mount-name>/radio.aac</mount-name>
        ...
        <intro>/intro-64.aac</intro>
    </mount>
    <paths>
        <basedir>/usr/local/share/icecast</basedir>
        <webroot>/usr/local/share/icecast/web</webroot>
        ...
    </paths>
    ...
    <directory>
        <yp-url-timeout>15</yp-url-timeout>
        <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    </directory>
</icecast>

But no, it won't play...

But I can't figure out a combination of <intro> and <webroot> settings to make it work.

Hey! Webroot doesn't exist!

Weird thing: the default <webroot> value doesn't even exist on the server. I tried creating the path and putting the intro file there, but it wouldn't play (even after restarting Icecast), nor would it show when you requested http://<host:port>/intro-128.mp3 directly (which you would expect since it sits right in the web root).

And when I changed the value of <webroot> to another directory, the Icecast web frontend stopped working (although the streams still worked), and requesting directly the intro file didn't work neither.

It makes me suspect that AzuraCast somehow "redirects" Icecast's requests to the filesystem in some way.

Docker? In or out?

My AzuraCast is running in a Docker installation, within a VPS. Of course, all these paths and files do reside inside the Docker volume. But just to be sure, I also tried creating the paths directly on the host server, with no success so far.

(Yep, changes are in effect.)

I confirm that the changes in icecast.xml are in effect, since I can see the overriden location on Icecast and the stream gets registered on dir.xiph.org.

Any cue?

1
  • Just for the record, that's not Icecast, but a fork of Icecast. You might want to consider trying proper Icecast by the Xiph.org foundation. We're at 2.4.4 right now.
    – TBR
    Commented Oct 10, 2019 at 17:18

1 Answer 1

1

Got it!

To set a mount's intro file, you first need to make it available somewhere within Icecast's webroot, which effectively is /usr/local/share/icecast/web inside the stations Docker service. For this to happen, we need to map the file using the method described in AzuraCast docs to use a custom default track

Edit docker-compose.override.yml

Since docker-compose.yml might get overwritten when updating AzuraCast, we'll create (or edit) docker-compose.override.yml to add our mapping.

To create or edit docker-compose.override.yml from the shell on the host server, you can type:

# cd /var/azuracast
# nano docker-compose.override.yml

Paste the following YAML content (adjust paths to your fitting):

version: '2.2'

services:
    stations:
        volumes:
            - /path/to/your/file.mp3:/usr/local/share/icecast/web/intro.mp3 

(In nano, hit ^O to save, ^X to exit.)

Restart AzuraCast

You need to (fully) restart your Docker services for the new mapping to take effect. In the shell:

# docker-compose down
# docker-compose up -d
# docker-compose start

Edit you Icecast's mountpoint setting

Instead of editing the station's Icecast settings as the poor OP did, it's much more straightforward to specify the intro settings right on the mountpoint's settings.

Click Mount Points, then the Edit button for the specific mount point. Under Custom Frontend Configuration (at the very bottom), add the following line:

{ "intro" : "intro.mp3" }

And make sure the filename matches the one you have set in docker-compose.override.yml.

Click Save Changes, then the orange Restart to Apply Changes to restart Icecast.

Enjoy you intro!

Tune in to your station to hear your beautiful intro.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .