How to read MP3 file tags

vijay.shad picture vijay.shad · Oct 29, 2009 · Viewed 61.7k times · Source

I want to have a program that reads metadata from an MP3 file. My program should also able to edit these metadata. What can I do?

I got to search out for some open source code. But they have code; but not simplified idea for my job they are going to do.

When I read further I found the metadata is stored in the MP3 file itself. But I am yet not able to make a full idea of my baby program.

Any help will be appreciated; with a program or very idea (like an algorithm). :)

Answer

Jaskirat picture Jaskirat · Oct 29, 2009

The last 128 bytes of a mp3 file contains meta data about the mp3 file., You can write a program to read the last 128 bytes...

UPDATE:

ID3v1 Implementation

The Information is stored in the last 128 bytes of an MP3. The Tag has got the following fields, and the offsets given here, are from 0-127.

 Field      Length    Offsets
 Tag        3           0-2
 Songname   30          3-32
 Artist     30         33-62
 Album      30         63-92
 Year       4          93-96
 Comment    30         97-126
 Genre      1           127

WARINING- This is just an ugly way of getting metadata and it might not actually be there because the world has moved to id3v2. id3v1 is actually obsolete. Id3v2 is more complex than this, so ideally you should use existing libraries to read id3v2 data from mp3s . Just putting this out there.