Getting MP3 metadata

Reply

Join Date: Nov 2008
Posts: 24
Reputation: xarz is an unknown quantity at this point 
Solved Threads: 1
xarz's Avatar
xarz xarz is offline Offline
Newbie Poster

Getting MP3 metadata

 
0
  #1
Dec 13th, 2008
Is there anyway to get metadata of an mp3 file using php? Even just the track length. Thanks.
:: xarz ::
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 158
Reputation: sDJh is an unknown quantity at this point 
Solved Threads: 13
sDJh sDJh is offline Offline
Junior Poster

Re: Getting MP3 metadata

 
0
  #2
Dec 14th, 2008
The format of MP3 isn't as difficult as one might think at first time. Information like title, author, album etc are simple string stored at the end of the file. This section always starts with "ID3".
To get the length of the song you need various information. The number of tracks (eg mono, stereo, surround), the frequency used and so on. Then you have to skip through the so called "blocks", read the current compression rate (not all MP3s are encoded with a constant bitrate), add them all together and divide by a quotient of the stuff you found out at the beginning.
Personally, I never did that in PHP, but I used some of these files to figure it out: http://www.wotsit.org/list.asp?page=3&fc=12&search=&al=
It might be quite fuzzy at the beginning, but keep going. Once you understood the basics of MP3, you'll get on very quickly. I think it took me about 3hrs to understand the framework of MP3 - the coding stuff was then about just half an hour.

Greetings Simon
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 24
Reputation: xarz is an unknown quantity at this point 
Solved Threads: 1
xarz's Avatar
xarz xarz is offline Offline
Newbie Poster

Re: Getting MP3 metadata

 
0
  #3
Dec 14th, 2008
thanks alot for the link.. i didn't really get what by what you explained but i'll try to understand more about mp3.. maybe i can get some knowledge from it..
:: xarz ::
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 1137 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC