ShoutIRC Streaming Meta Tags

From ShoutIRC RadioBot Wiki
Jump to navigation Jump to search

ShoutIRC Streaming Meta Tags for MP3


I recently came up with this because I like to archive shows from SHOUTcast and I would like the title changes to be in the MP3 so it will update as it plays just like the show did... and voila, here it is.

Basic Implementation

In a normal MP3 decoding loop, a decoder will find a MP3 frame, decode it, and then look for the next one.
To support SSMT, if the search for the next frame fails you would check to see if the next 4 bytes are 'SSMT' (0x53534D54 as a big-endian 32-bit integer), which is then followed by a 32-bit sync-safe integer containing the length of the SSMT tag.
The tag is made up of SSMT header 'items' containing various metadata.

SSMT Structure

SSMT is implemented with familiar RIFF-style headers.

struct SSMT_HEADER {
 uint32 item_name;
 uint32 length;

Implementation Rules/Notes

1. Item names MUST only be made up of the characters A-Z, a-z, and 0-9. No spaces, punctuation, special characters, etc.
2. All integers are in big-endian format!
3. All integers are sync-safe integers (those who have worked with ID3v2 tags are familiar with these). More info on wikipedia here.
4. The value 0xFF must never appear in your data.
5. Strings do not have to be null-terminated, but won't hurt.
6. Strings MUST NEVER be space-padded.
7. Strings MUST be UTF-8 without a BOM. (A properly encoded UTF-8 string will never contain 0xFF, so you don't need to do anything special with them.)
8. The length member only specifies the length of data following the header and does not include the size of the header itself.
9. Zero length items are allowed if for some reason you want one.
10. Applications writing SSMT tags MUST place them inbetween MP3 frames, this is important for 2 reasons:
10a) To reduce complexity for decoder support so they don't have to try to find the tags and deal with them being in the middle of frames.
10b) So decoders not looking for SSMT tags don't have any glitches or problems playing back the MP3 files.


SSMT RIFF header name and length are in brackets.

Example tag with a title:
{SSMT, 12}
 {TITL, 4}

Example tag with a stream title and URL:
{SSMT, 39}
 {STIT, 4}
 {SURL, 19}

Known SSMT Items

Item type Content Description
The following are used for files or for streams when song-specific metadata is available.
TITL String Contains the current song's title.
ALBM String Contains the current album.
ARTS String Contains the current artist.
GNRE String Contains the current song's genre.
WURL String Contains the current song's URL.
The following are used when recording streams (ie. SHOUTcast)
STIT String Contains the stream title.
SNAM String Contains the stream name.
SGNR String Contains the stream genre.
SURL String Contains the stream URL.

Programmers can add their own SSMT headers as needed, please start your custom items with X, Y, or Z to make sure they don't interfere with future official items.
Feel free to contact us with new frame ideas and we will be glad to add them here.


The SC_Proxy plugin will also let you record your shows with SSMT tags for playback by AutoDJ.

RadioBot vde

RadioBot main pages
Main PageInstallationChangelogCommandsPluginsFAQConfigurationCreditsRemote ClientBuilt-In VariablesMulti Sound Server ModeUsername Character Restrictions
Auto DJ Pages
Auto DJ Main PageWebRequest SystemSchedulerMP3 EncoderVoice SupportMySQL Plugin
RadioBot Programming vde

RadioBot Programming
Plugin APIRemote CommandsPlugin InitializationRadioBot DBChanging Command PermissionsShoutIRC Music Database
Lua Scripting
Lua PluginLua ScriptingLua Events