View Full Version : Length of MP3 Files
11-25-2003, 11:04 AM
We're putting together a site that will enable people to download MP3s (all created by the owner of the site, so no copyright problems!), and we need to be able to display certain types of information.
We're running an ASP script that will display all the MP3 files and their sizes that are in a certain directory - this isn't a problem. What the client wants to know is whether we can automatically display the length of the file in seconds?
Or is this just a ridiculous question and not even remotely possible?
11-25-2003, 11:52 AM
It is very possible, but you will need a third-part component for this.
http://www.aspin/ is my favorite site for these kind of things [3rd party tools], they have all kinds of stuff there!
If you don't find anything there, try a google-search.
11-25-2003, 02:42 PM
Thanks for that - I'll take a look.
11-26-2003, 05:00 PM
I've just done some (very hasty) calculations with my trusty Winamp:
Take 10 (128kb) tunes at random
Divide bytes by seconds
Result: divide the filesize (in bytes) by 16040 to get time in seconds.
11-26-2003, 10:31 PM
Come to think about it, I may have a link for you reg. this.
It is a component for mIRC, but I'm not sure it can be used on IIS, but you could try to install it, and report here what the outcome was.
The file you would want to download is titled WA link 1.2
There is source-code included, it's written in delphi by the way.
11-27-2003, 02:56 PM
This aspect of the site needs to be put on hold for a few days as we need to work on some other areas of the site, but I'll report back with my findings based on your responses.
11-27-2003, 09:04 PM
VBR MP3z will throw a spanner in the works, and even Winamp used to have trouble...
Unfortunately to estimate a playing time you must scan through all the frame headers, so here's a few links which will help you to write your own frame header parser in VBScript. It's best to use a ADODB.Stream object for fast, efficient binary manipulation, and you'll have to bear in mind that MP3z might be truncated or otherwise corrupted, and handle such events appropriately:
However, the information in this thread might prove helpful in taking shortcuts (and possibly getting a more accurate result):
11-27-2003, 09:42 PM
cool links, very useful for me as well... thanx... :)
posting from NY M@rco aren't you? ;)
11-27-2003, 10:46 PM
Just in the middle of packing... flying out in 14 hrs' time... but well remembered! ;)
11-28-2003, 08:14 AM
[offtopic] Say halu to NY from me will ya ? ;)
Lovely city, New York. I've been there only once but I'm going back there again in February next year :cool:
[ontopic] Nice links M@cro!
I'm saving those in my bookmarks.
11-28-2003, 10:01 AM
11-29-2003, 05:06 AM
You're all welcome, but I should say that it took me only 2 mins to find and skim thru those pages with the help of my good friend Google (http://www.google.com)... try it... you might like it!
11-29-2003, 11:25 PM
hum... personnaly I was not looking for that kind of links but since you gave them, I checked them and thought that they would useful soon or later. That's why I was enthusiastic about it :)
I was manly posting to wish you a good trip to NY ;)
11-30-2003, 07:38 PM
Thanks! Having a great time so far... check on my progress here (http://www.sitepointforums.com/showthread.php?t=140074) if you're interested! lol ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.