Analysis of a MP3 flux.

Posts: 1
Joined: Fri Nov 09, 2012 11:50 pm
Are you a spambot?: no

Analysis of a MP3 flux.

Post by Karottes » Fri Nov 09, 2012 11:55 pm

I'm trying to extract ID3v2 tags from a mp3 flux (ShoutCast) and nothing works.
Someone can help me ?

I have tried like that :

Code: Select all

$filename = 'http://adress:port/;128k.mp3';

$getID3 = new getID3;

James Heinrich
getID3() v1 developer
Posts: 1457
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada

Re: Analysis of a MP3 flux.

Post by James Heinrich » Sat Nov 10, 2012 1:27 am

getID3 only works on local files. It's left to the user to decide how to download a remote file for analysis, or, in your case, how to distill a stream into a standalone file.

From what I understand of ShoutCast and similar streaming (and things may have changed in the years since I last looked at it), ID3v2 "frames" are injected into the MP3 stream at regular intervals which are then parsed by players that understand them, or silently ignored as corrupt audio data by any player that doesn't, per the design of MP3 audio. If you can sniff the stream and catch the ID3v2 tag as it comes through, either with or without any trailing MP3 audio data after the tag, and save it to a local file, then getID3 can analyze the file and give you ID3v2 data. Obviously if you don't include any MP3 audio data (at least 1 complete frame) then no details about the audio format would be included, but in either case the ID3v2 tag should be parsed correctly.

In any case, this is beyond the scope of getID3.