I'm actually doing that with 'exiftool'.
http://www.sno.phy.queensu.ca/~phil/exiftool/

In a command line:
exiftool audio.mp3
(And it will return a list of properties)

exiftool -Duration audio.mp3
(Will return just the time duration)

And it will works for a bunch of media types(wmv, wma, jpg, etc)

--Rafael

Eli Jones wrote:
> Also, it would need to be a fixed bitrate.. if it's variable bitrate, 
> I think you're sort of out of luck.
>
> though, sounds like its a pain to do on your own.. there are no doubt 
> libraries to do it for you.
>
> for python, I see there is:  Pymad
>
> anyway, have fun.
>
> On Thu, Nov 26, 2009 at 6:04 PM, Eli Jones <eli.jo...@gmail.com 
> <mailto:eli.jo...@gmail.com>> wrote:
>
>     I do not believe there is information in the mp3 header that tell
>     you how long it actually is (I think this is just a fluke.. or
>     maybe they figured "Oh, they can just calculate it").
>
>     You have to get the bitrate (say, 128 kbps) and then find out the
>     total size of the mp3.. and use that to calculate what the runtime
>     will end up being.
>
>
>     On Thu, Nov 26, 2009 at 5:45 PM, MajorProgamming
>     <sefira...@gmail.com <mailto:sefira...@gmail.com>> wrote:
>
>         That's great info to know. But I more specifically wanted to
>         get the
>         runtime of the file (i.e. in hours, minutes, seconds). Any way
>         to do
>         that?
>
>         On Nov 26, 2:37 am, Niklas Rosencrantz <teknik...@gmail.com
>         <mailto:teknik...@gmail.com>> wrote:
>         > On Thu, Nov 26, 2009 at 5:14 AM, MajorProgamming
>         <sefira...@gmail.com <mailto:sefira...@gmail.com>> wrote:
>         >
>         > > Is there any way to somehow fetch an external MP3 file
>         (i.e. from
>         > > another website), and then calculate the length of the MP3
>         file.
>         >
>         > > I don't need the actual data of the file, I just want the
>         length of it
>         > > (time it runs).
>         >
>         > > Keep in mind that these files can be as big as 25MB...
>         >
>         > > Thanks,
>         >
>         > Hello,
>         > Good question guaranteed to depend on host config (could be
>         custom or
>         > fake descriptions) while one mentioned way is use HTTP HEAD
>         > #Call HTTP HEAD in Python
>         > import httplib
>         > conn=httplib.HTTPConnection("www.abc.com <http://www.abc.com>")
>         > conn.request("HEAD", "/dir/file1.mp3")
>         > res=conn.getresponse()
>         > fileSize=res.getheader('content-length')
>         > #or res.getheaders() for all headers
>         > conn.close()
>
>         --
>
>         You received this message because you are subscribed to the
>         Google Groups "Google App Engine" group.
>         To post to this group, send email to
>         google-appengine@googlegroups.com
>         <mailto:google-appengine@googlegroups.com>.
>         To unsubscribe from this group, send email to
>         google-appengine+unsubscr...@googlegroups.com
>         <mailto:google-appengine%2bunsubscr...@googlegroups.com>.
>         For more options, visit this group at
>         http://groups.google.com/group/google-appengine?hl=en.
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google 
> Groups "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to