Now playing and other meta data on radio streams

This forum is about all development around libVLC.
sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Now playing and other meta data on radio streams

Postby sherington » 07 Jun 2012 20:49

Hello,

I noticed when using the vlc application to play an internet radio station stream (via an m3u link or a direct http link), that the vlc window title changes to reflect the "now playing" track. More than that, there is also populated meta data (title, artist, album, genre etc) available in the "Media Information" dialog.

I have tried already looking at the events and the meta data generated by my own libvlc audio player and I never see any sign of this information appearing.

I am wondering if someone can point me to how this is done, and if the same can be done through libvlc?

gnosygnu
Blank Cone
Blank Cone
Posts: 45
Joined: 06 Jun 2010 16:06

Re: Now playing and other meta data on radio streams

Postby gnosygnu » 08 Jun 2012 00:49

I'm not familiar with the code, but I took a quick look and I think the relevant section is here: \vlc\modules\access\http.c.

Code: Select all

case ACCESS_GET_META: p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* ); if( p_sys->psz_icy_name ) vlc_meta_Set( p_meta, vlc_meta_Title, p_sys->psz_icy_name ); if( p_sys->psz_icy_genre ) vlc_meta_Set( p_meta, vlc_meta_Genre, p_sys->psz_icy_genre ); if( p_sys->psz_icy_title ) vlc_meta_Set( p_meta, vlc_meta_NowPlaying, p_sys->psz_icy_title );
I tested this out now against the following stream: http://voxsc1.somafm.com:8090. It populates title, genre, now playing in my "Media information". I don't think it pulls down album/artist. In my limited experience, I think these fields will vary by source server (whether or not they send that data). Those I've visited provide only the title which is a concantenation of "Arist - Title."

I don't think this is exposed as an event through libvlc, though one of the developers can clarify.

Also, as a final note, you can use streamripper (http://streamripper.sourceforge.net/) to download the stream and its meta-data. I use the following syntax:

Code: Select all

streamripper.exe http://voxsc1.somafm.com:8090 -a -t -d C:\streams\soma
It will generate an mp3 file and a cue file. If you open up the cue file in a text editor, you will see the same meta data.

Hope this helps.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: Now playing and other meta data on radio streams

Postby sherington » 08 Jun 2012 18:01

Thanks for the pointers.

I'll post here what I found for the record.

I checked my logs more carefully and observed the following:

When playing a playlist link like an m3u:

1. Generally the meta data on the first sub-item is properly populated, at least in part, but the meta data you get depends on the type of stream.
2. For an ogg stream [1], I have seen title, artist, album, genre, and track number meta data, for the track, populated on the first sub-item. Now playing is not populated, but that doesn't matter.
3. For an ogg stream, the meta data does update when the track changes. However, there is no event posted - I only spotted the updated meta data by polling for it every few seconds.
4. For an IceCast stream [2], I have seen title and genre meta data populated on the first sub-item, but this is meta data related to the station not the track.
5. For IceCast, I have seen now playing meta data populated on the first sub-item.
6. For IceCast, the meta data never updates when the now playing track changes - I did not see the now playing meta ever change.

When playing a streaming link directly rather than a playlist the results are basically the same except you get the meta data on the media item itself and there are no sub-items - this is exactly what you'd expect of course.

So it seems there's no dedicated event to detect when the media changes (I will try digging into the vlc source to see exactly what it does but that's a task for later). The one exception to this is when playing the streaming link directly, you will sometimes see an "artwork URL" meta data changed event being raised when the track changes. So I could use this to update the meta rather than polling, but I don't think I can rely on it.

It's no use posting links since the station URLs can change, but the stations I used I found at dir.xiph.org:
[1] "Nirvana Ambient Radio" (ogg)
[2] "SMOOTHRIVIERA"


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests