Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Reading MP3s ID3 Tags
It would be cool if you could pass me the codes or hints. I'm trying to write a program that would put the ID tags on web pages, for personal consultation at the office from my personal databank...
an MP3 ID tag is an MPeg Layer 3 - those that created such a commotion with Napster and all - can send you one thrgouh e-mail if you want to check it out... big though - 3 megs at least
If you have an MP3, open it with word pad (or whatever software that won't convert the file to any format... check at the end, the last 128bites, and you'll see that you have plain text showing there - it is the tag of the MP3.
The point of the exercise is to extract the content of those 128bites, without havin'g to parse through the total file, which would take forever since each file (and I have oh so many) is at least a couple of megs.
Any suggestion on how to extract the last 128 bites in the fastest matter possible?
fn="C:\WINDOWS\Desktop\Monty Python - String.mp3" fs=Filesize(fn) bb=BinaryAlloc(128+1) bytes2read=min(128,fs) BinaryReadEx(bb,0,fn,fs-bytes2read,bytes2read) if Version() >= "2000C" BinaryReplace(bb,""," ",@true) else for xx=0 to 127 if BinaryPeek(bb,xx) == 0 BinaryPokeStr(bb,xx," ") endif next endif TagString=BinaryPeekStr(bb,0,127) LastByte=BinaryPeek(bb,127) BinaryFree(bb) Message(Strcat("LastByte=",lastbyte),TagString)
You will need to be careful about it. Not all MP3s may have an ID3 embedded. To check to see if it does have ID3, the first three characters of the last 128 bytes of the file should be 'TAG'
I do not need to convert nulls into spaces. My preferred method of extracting the elements of the ID3 is simple. All elements have the same offset, of course, and they all have limits.
I hope you will find this code to be useful:
mp3="Elton John-Someday Out of the Blue.mp3" size=filesize(mp3) bb=binaryalloc(128) binaryreadex(bb,0,mp3,size-128,128) id3=binarypeekstr(bb,0,3) if id3=="TAG" title=strtrim(binarypeekstr(bb,3,30)) artist=strtrim(binarypeekstr(bb,33,30)) album=strtrim(binarypeekstr(bb,63,30)) year=strtrim(binarypeekstr(bb,93,4)) comments=strtrim(binarypeekstr(bb,97,30)) else title="Untitled" artist="Unknown Artist" album="" year="" comments="" endifFor me:
title returns "Someday Out of the Blue"
artist returns "Elton John"
album returns "Road to El Dorado"
year returns "2000"
comments returns a blank string
A Binarypeek(bb,127) will return some integer representing the Genre, but I do not know what goes with what number.
For the binary decryption, I found a page that gave me the information with a cute and verry comprehensible table. Follow this link and have fun:
http://www.mirc.net/tips/id3.php3See Also:
Article ID: W14623
Filename: Reading MP3s ID3 Tags.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38