Home » Audio » General » finding/calculating the duration of an MP3 file??? (how do you find/calculat the duration of the contnet of an .mp3 file???)
finding/calculating the duration of an MP3 file??? [message #63897] Sat, 21 August 2010 05:54 Go to next message
Mr Red is currently offline  Mr Red
Messages: 2
Registered: August 2010
Location: Gloucestershire UK
Esquire
I am sure it is an old chestnut but it is proving difficult to pin down.

The target usage is for Michas music cart and generating the button file outside of Michas. It is a very convenient text kind of file and the lines obvious.

I have looked at the mp3 header and have the WIKI page but still can't see any direct/indirect method for calculating duration. I do see problems if it takes a un-encoding process to find the length. Counting the blocks is not too much of a problem, as long as I can spot them.


Re: finding/calculating the duration of an MP3 file??? [message #63898 is a reply to message #63897] Sat, 21 August 2010 09:56 Go to previous messageGo to next message
Wayne Parham is currently offline  Wayne Parham
Messages: 18676
Registered: January 2001
Illuminati (33rd Degree)

You can estimate duration knowing the bitrate and file size. But this is just an estimate. To calculate the exact length, you'll have to scan the file and count the frames. Do a search on the internet - there are dozens of articles about this, many with sample code.

Re: finding/calculating the duration of an MP3 file??? [message #63908 is a reply to message #63898] Mon, 23 August 2010 06:10 Go to previous message
Mr Red is currently offline  Mr Red
Messages: 2
Registered: August 2010
Location: Gloucestershire UK
Esquire
Yea. Thanks.
I read the posts on this forum about approximations.
I arrived at that kind of estimate first.
The real problem is that the target application is Michas, and this is intented for Radio (FM on air playlist app) so when the first comparison was 10 seconds out I went searching.

I have just run all my .mp3 files through Michas and have CART files for all of them which will give me the durations that Michas works to. But I don't really want to be doing it for new files. It would be a Logistic Nightmare. As it is I will have to run VBA to extract the CART info and sort and copy and zzzzzzzzzzzzzzzzzzzzzzzzzzzz.

I will go looking but code would probably be in C++ so I am looking for methodology.

Constant bit rate at 192 for this station.

http://stroudfm.co.uk




Previous Topic: blip.fm
Next Topic: Need help identifying pa system
Goto Forum:
  


Current Time: Fri Apr 19 21:13:31 CDT 2024

Sponsoring Organizations

DIY Audio Projects
DIY Audio Projects
OddWatt Audio
OddWatt Audio
Pi Speakers
Pi Speakers
Prosound Shootout
Prosound Shootout
Smith & Larson Audio
Smith & Larson Audio
Tubes For Amps
TubesForAmps.com

Lone Star Audiofest