FLAC Stream: Encoding Metadata into stream

Hello,

We are using a FLAC stream to feed our DAB+ transmitter. As stream host we use Icecast. Now I know that Icecast is not able to show the metadata, but it is possible to encode it into the stream.

After some research I found this optiond of FLAC.exe: --keep-foreign-metadata

Also found some information here: BASS_Encode_CastSetTitle & BASS_Encode_FLAC_Start

But after adding this as an additional encoder option mAirlist is not able to connect anymore and gives a BASS error -1.

Any tips or tricks here to get the metadata embedded so we can show it on DAB+ receivers?

Thanks!

The encoder doesn’t currently allow to inject “in-stream” (= inside payload) metadata, as we are using the traditional way of encoding provided by bassenc.dll, namely command-line encoders. These command-line encoders receive PCM data via STDIN, and output encoded data via STDOUT, and there is no way to inject metadata into them.

These BASSenc_* extensions (e.g. BASSenc_flac) are a relatively new thing, and I still have to investigate how they work, and if it made sense to replace the existing mechanisms with them.

That was 4.3 years ago.

Have there been any new findings on this topic since then? I’m also very interested in lossless data transmission to the streaming server.

@UliNobbe i saw your message, and i was facing more or less the same situation. So, i have just become a member on this forum :wink:
Isn’t i an idea to post the metadata to icecast’s ‘metadata update’ endpoint directly by using a background script? Icecast Docs — Admin Interface
According to documentation:
http://192.168.1.10:8000/admin/metadata?mount=/mystream&mode=updinfo&song=ACDC+Back+In+Black

As i am using a liquidsoap server producing several types of streams (plus fallback to a static playlist + Stereotool soundprocessing etc), i needed to think of a way to send the audio to Liquidsoap without having to reencode it somewhere in between. I do not want to ‘take a picture of a picture, .. of a picture’. (Offtopic, maybe a mAirlist encoder → liquidsoap Harbor input icecast type will do, but this is mostly used to input another livestream source, haven’t figured out this option yet).

Currently my setup:

mAirlist server 
-> virtual audio cable -> LiquidSoap SRT OUTPUT
-> backgroundscript posts (artist+title) metadata

LiquidSoap server
-> SRT INPUT
-> HTTP metadata handler 
---> soundprocessing(audio + meta) --> icecast

As i do not want to re-encode the pcm audio several times (preferable 1 single time at Liquidsoap), i choose to hand over the audio directly via VirtualAudioCable via a direct SRT connection to my liquidsoap server, but hey, at LiquidSoap that’s raw pure pcm audio.

I have a background script running (procedure OnItemStart) that posts the metadata (artist, title) to the liquidsoap server that inserts it in the livestream and voila. The same principle can be done with icecast update meta endpoint. Script need some changes to fit for icecast; a get call and maybe some url encoding (spaces need to be %20 for example) + basic authentication header.

update-meta.mls

procedure OnItemStart(
  Item: IPlaylistItem;
  Region: byte;
  OnAir: boolean;
  UniqueID: string
);

var data: IPersistentObject;
var contentType: string;
var url: string;
var devUrl: string;

begin
  // Target URL API endpoint
  url := 'https://radio.com/api/meta/update';

  data := CreatePersistentObject;

  data.SetString('mairlist_song_id', Item.GetDatabaseID);
  data.SetString('artist', Item.GetArtist);
  data.SetString('title', Item.GetTitle);

  // Explicitly define the standard JSON content type header
  contentType := 'application/json; charset=utf-8';

  HTTPPostRawAsync(url, contentType, data.AsJSon(false, true));
end;

begin
end.