Question How to erase or write ID3v2 tags to MP3s

stugol

New member
Joined
Jan 15, 2011
Messages
3
Programming Experience
10+
Hi. I know some people have asked similar questions before on this forum, but none of those threads seem to address the problem I'm having.

I already have code to read ID3v1 and v2 tags. That's not the problem. I open an IOStream, locate the ID3v2 header and pull the bytes out. Handling unicode was a bit of a sod, but I got it working.

What I don't understand is how to remove an ID3v2 tag or write one out. ID3v1 is easy - just truncate the file, then append some bytes. Simple. But ID3v2 tags don't have to be at the start of the file, do they? It's conventional, but by no means mandatory. If I just crop the entire ID3 out of the file, and close the gap, will that work? And then, to write my own tags, should I just write the bytes to the front of the file? Or do I need to update other bits of the file so the player will know where the audio data has moved to?

Also, do I need to use unsynchronisation? How can I tell if I need to?

I've looked on CodeProject; I've googled; and I've read the specification on id3.org - which, by the way, is less than clear! For example, it says that the "Extended header size" can be 6 or 10 bytes in length. So um....how am I supposed to know which one? Is there some magic way of determining how many bytes this value is being stored as?

So yeah... I'd appreciate a little help, guys.
 
Back
Top