INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Determining MP3 Length

Determining MP3 Length

(OP)
So I've just spent a good chunk of time learning the basics of ID3 tags. I was able to make a basic routine to read them. The main purpose of that was to specifically look at the TLEN frame. I wanted to make a simple routine to determine MP3 times and add them up. After playing around with a few different files I realized something - ID3 tags are not a necessary part of the file, so I found some of my MP3s did not have a TLEN frame. Is there another way to determine song length of an MP3 file?

RE: Determining MP3 Length

If you're going to play it and have something lined out already, simply loading it will get a song length.

Or you'd have to continue into the data and start reading/counting frames.

http://www.mp3-tech.org/programmer/frame_header.ht...

As I understand it, whatever the bit rate on the frame header is is going to represent one second of actual data. Of course, you have VBR files, so you have to read through a file completely to diagnose those.

You'll have to play a little bit to get the exact way things work going for any file you encounter. But it'll be a decent start.

RE: Determining MP3 Length

(OP)

Quote (Glenn9999)

If you're going to play it and have something lined out already, simply loading it will get a song length.

Right. No I'm looking to add up MP3 times. I'm trying to work on a program such that I can pass it a list of MP3 files, and it will sum up the track lengths.

Quote (Glen9999)

Or you'd have to continue into the data and start reading/counting frames.

http://www.mp3-tech.org/programmer/frame_header.ht...

As I understand it, whatever the bit rate on the frame header is is going to represent one second of actual data. Of course, you have VBR files, so you have to read through a file completely to diagnose those.

You'll have to play a little bit to get the exact way things work going for any file you encounter. But it'll be a decent start.

Looks like now I'll have to learn parsing actual MP3 data. That link was helpful though!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close