View Single Post
Old 07-08-2016, 03:57 PM   #3
Krazykiwi
Zealot
Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.Krazykiwi ought to be getting tired of karma fortunes by now.
 
Posts: 137
Karma: 2156958
Join Date: Jan 2013
Device: Too many random androids to list
Actually, it does have to sort of rewrite the whole file. ID3v1 tags are fixed length and placed at the end (for backwards compatibility) but ID3v2 tags are variable length and placed at the start (for streaming compatibility).

Which means when you add new ones to a file that didn't have any, things like the offset from the beginning of the file where the actual audio really starts have to be recalculated and the entire file rewritten to disk - it'll always take longer. If it really bothers you, don't strip the tags entirely, it'll save you a few seconds here and there.

After that though, it gets trickier. Smart tag editors generally pad a little extra room into the tags (filled with null bytes like packaging beans, just there to take up space) so that they take up just a little bit more space than needed - which means if you edit them later, they have some leeway to expand or contract within that space. But if you edit a tag really a lot (like say, you paste the lyrics into the comments field so it goes way over the extra space allotted for it), or you add new tags that weren't there before, it'll probably have to rewrite the file anyway.

Generally if you are editing existing tags, and not changing the length of them very much (enough so the "frame" or "chunk" of space it's taking up in the file is the same size), it's possible to do it a lot faster. That said, it's usually safer from a programming point of view to just rewrite the file entirely into a new copy and then remove the old one.

I suspect Windows Explorer, since it has to handle a billion types of metadata for all kinds of files, takes the slower but very safe and guaranteed to work route, rather than trying to do the fast but tricky method for every file type it knows about.
Krazykiwi is offline   Reply With Quote