A Quick Study on MP3 file structure
Just had a little time playing around with MP3 file and found it quite interesting.
Do you like “New Divide” by Linkin Park, which is the Original Sound Track on Transformer 2: The Revenge of the Fallen? I personally like it very much. Ah right, Transformer 3 – Dark of the Moon is coming tomorrow, certainly I’ll watch it😀.
If you have the MP3 file of the song, on Windows Explorer right click on it and select Properties, open tab Details:
You can see its information like: Title, Artists, Album, Year, Genre, Length ….
Ok, try to open it using Mp3tag (v2.49):
The tag version of MP3 file is: ID3v2.3, which is basically derived from v1 and v2.3. Let’s have a look at the internal structure of ID3v1:
At the description at original page about ID3v1,
|Song Title||30 characters|
“If you one sum the the size of all these fields we see that 30+30+30+4+30+1 equals 125 bytes and not 128 bytes. The missing three bytes can be found at the very beginning of the tag, before the song title. These three bytes are always “TAG” and is the identification that this is indeed a ID3 tag. The easiest way to find a ID3v1/1.1 tag is to look for the word “TAG” 128 bytes from the end of a file. ” – Quoted from ID3.org
Another pages on MP3 internal:
So we can easily extract any MP3 file tag information by parsing its very last 128 bytes (128 bytes at the end).
Once again, I open the song in a hex editor:
That’s right, the info is there!
Generally, instead of reading MP3 file header structure at beginning, we can use the very last 128 bytes to extract its basic info. Interesting, isn’t it?
We’re gonna make a library to query MP3 basic info using Java on Android in next article🙂
Just take a cup of coffee and enjoy the song “….give me reason …. connect the space between …” , lol :))