| | |
Getting MP3 metadata
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2005
Posts: 150
Reputation:
Solved Threads: 13
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
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
![]() |
Similar Threads
- Dread Oxc0000005 code in Napster (Windows NT / 2000 / XP)
- WMA metadata edit (C#)
- Can python do this, or should I learn c++? (Python)
- MP3 to Database (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: Explode and Post doesn't seem to work together
- Next Thread: About Drupal
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





