Skip to content

Icecast metadata updates in scan mode

Tomasz Lemiech edited this page Oct 18, 2021 · 3 revisions

Let's say you are listening to a channel configured to scan several frequencies. Once in a while you hear an interesting chatter and you want to find out, which frequency it's going on. When using an analog scanner it's just a matter of getting a glimpse onto it's display. How to do this with RTLSDR-Airband?

Perhaps you have already found out that in foreground mode the program displays the current frequency beside the textual waterfall, so you can look at that. However it's only useful when playing the audio through pulse output, because Pulseaudio stream latency is low, so the sound is mostly in sync with the waterfalls. But what about Icecast streams? They may have quite a lot of latency (on the order of seconds), so whenever you switch to the RTLSDR-Airband's window to check the frequency of an interesting chatter, it may already have ended and the scanner continues running. Of course other listeners of your streams won't be able to make use of this method at all.

Fortunately, Icecast streams can carry textual metadata together with the audio - things like: stream title, stream description, genre, or song title. Metadata can be updated when the stream is running and the media player should display it in its GUI. RTLSDR-Airband can leverage stream metadata to convey frequency information. Whenever the scanner stops, song title is set to the current frequency (or to a textual label assigned to it).

Enabling metadata updates

Metadata updates are enabled per output with a send_scan_freq_tags boolean option, like this:

outputs: (
{
   type = "icecast";
   server = ...;
   port = ...;
   mountpoint = ...;
   send_scan_freq_tags = true;
}
...
);

This option has no effect for multichannel mode.

Assigning textual labels to frequencies

Let's say your list of scanned frequencies looks like this:

channels: (
{
   freqs = ( 126300000, 121500000, 128225000, 131375000 );
   ...
}
);

When metadata updates are enabled and the scanner stops, eg. on the third frequency, the song title will be set to "128.225 MHz". If you remember your frequency assignments by heart, that's probably enough. But how about making this look a little nicer?

channels: (
{
   freqs = ( 126300000, 121500000, 128225000, 131375000 );
   labels = ( "Radar", "Emergency", "Tower", "Ground" );
   ...
}
);

labels is a list of strings, which must be no shorter than the freqs list. If it's defined, RTLSDR-Airband will use labels as the song title instead of raw numbers.

Tuning metadata delay

If you observe that song title updates appear too late (or too early) by a consistent amount of time, you may tweak shout_metadata_delay global option to correct it. The default delay value is 3 seconds. You may set this to any other positive integer number:

shout_metadata_delay = 5;

Note: Icecast protocol does not provide any means for precise timing synchronization between audio and metadata. There might be a variable delay between the sound and song title updates. It may be controlled to some extent with a shout_metadata_delay option, but the amount of delay is directly related to the stream buffer size in the media player, so there is no one-size-fits-all value which would work equally good for all listeners and all media players.


Note: Icecast server logs all metadata updates received from the stream source. Using this feature can quickly clutter the server logs, so act politely and ask the server administrator for permission before enabling this. Or just use the feature on your own server only.


Clone this wiki locally