Thread: Reading mp3 stream metadata

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Reading mp3 stream metadata

    hi all.

    I want to monitor radiostations current playing track.
    How can I do this? Maybe some libraries or kind of?
    Any personal expirience?

    Thank you for your answers.

    P.S. I'm making this to run under Linux.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, you mean you go to BBC - Southern Counties - Homepage and listen to the live show, and you want to know what they are playing? I presume you have a powerful machine to determine the match between what is playing and the MP3's that you have on your machine.

    Or do you mean that you want to determine what MP3's the radio-station you are working at is playing? Shouldn't the DJ have a play-list beforehand for copyright/royalty reasons?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    I'm going to put on the hat of divination. I'm guess the OP is listing to some sort of streaming broadcast over the internet (perhaps as simple as MP3 over HTTP) and just wants to pull tagging out of that.

    Although it would be great if he'd enlighten us a bit on what he was doing (OP: *hint hint*) -- I'm not sure when I last changed the batteries in the hat...
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    2
    ok ok, I didn't formulate my question enough, sorry about that.
    the whole picture:

    I have several internet radiostations I like, they're broadcasting mp3 stream over http, what I want is to get
    current playing track. I know that stream has such metadata, but I don't know how to get it
    I've recorded several sessions with tcpdump and thats what I found:
    player sends this request:

    Code:
    GET / HTTP/1.1
    Host: 196.138.12.33:1433
    User-Agent: Audacious/2.0.1 neon/0.28.4
    Connection: TE, close
    TE: trailers
    Icy-MetaData: 1
    servers response:

    Code:
    ICY 200 OK
    icy-notice1:<BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
    icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>
    content-type:audio/mpeg
    icy-pub:1
    icy-metaint:32768
    icy-br:128
    and in stream there are such lines:

    Code:
    StreamTitle='Epsilon Minus - Bridgeburner';StreamUrl='http://196.138.12.33:1433';
    I thought about simply grabbing a piece of stream (as I found out, metadata goes each
    icy-metaint bytes), but this looks pretty ugly imho.

    I want to find some library or existing code which gets this data, but atm my searches are failing

    So maybe somebody could enlight me on this problem?
    Last edited by naquad; 06-23-2009 at 08:13 PM.

  5. #5
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    I tried connecting to 196.138.12.33:1433, didn't get anything.

    Are you sure it's an mp3? The MIME type is correct (though not definitive, I think others go by that). The line you gave doesn't resemble an ID3 tag (which is what is usually associated with mp3s) -- my guess is it is part of this "ICY" protocol, which you might want to research (I know nothing about it.)

    If you really want to dig about the mp3 data, then these are good:
    The MP3 frame - you won't get tagging data out of a mp3 frame, but it might be good to know where they are.
    ID3 format - common format for embedding tagging in mp3s.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  6. #6
    Registered User
    Join Date
    Jun 2009
    Location
    north america
    Posts
    1
    Hello~

    For what it's worth, streaming the station through MPLAYER run from the command line displays titles and artist info on my local community radio station (at least on Ubuntu 2.6 kernel).

    ~Good luck
    LG

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stream Server
    By ch4 in forum Networking/Device Communication
    Replies: 18
    Last Post: 06-29-2009, 03:09 PM
  2. Discard wrong data from stream
    By mesmer in forum C Programming
    Replies: 7
    Last Post: 11-16-2008, 02:30 AM
  3. Closing a stream
    By cunnus88 in forum C++ Programming
    Replies: 8
    Last Post: 02-21-2008, 05:15 PM
  4. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 08:40 AM
  5. reading from input stream
    By Micko in forum C++ Programming
    Replies: 8
    Last Post: 05-01-2005, 05:50 PM

Tags for this Thread