0

Is there anyway to get metadata of an mp3 file using php? Even just the track length. Thanks.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by xarz
0

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

0

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..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.