Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: I need help tagging ID3v2.3 and ID3v2.4 to same file (Read 6248 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

I need help tagging ID3v2.3 and ID3v2.4 to same file

I know this is usually not correct to do, but this is for testing purposes. I have tried many different programs, (foobar, mp3tag-it, mp3tag, tag&rename, itunes) but none are letting me add both tag versions to the same file. Is there a way to do it, to force it? I looked around for some command line options, but I'm not very skilled and could not find anything for this purpose. Maybe this is easy, but I need help please. 

How would you do this if you had to?

Thanks!

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #1
Since you're supposed to pick only one version, I think you may be forced to use a hex editor to append the second tag manually. I have a feeling you would greatly confuse any software that you used to play the file, though. I'm curious what you're trying to test.

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #2
Mostly I wanted to know if it can be done and how to do it, for curiosity's sake. Also, I'm very curious how those files are dealt with by various programs. I guess it seemed like something that should be easy to do, but then became a challenge, and now I'd like to see it through.

Someone said that maybe I could write a ruby script to do it, but I have no knowledge of how to achieve that. Time to look into it.

The hex editor route may work. I have zero experience with that, so I will need to look up how to do it. Hopefully there is a tutorial somewhere.

Anyone have thoughts on this?

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #3
Also, I'm very curious how those files are dealt with by various programs. I guess it seemed like something that should be easy to do, but then became a challenge

Haven't you just answered your own question?

Have you actually come across such files (ahem) "in the wild"?

As Aleron noted, both versions of tags in the same file is definitely not normal - no properly-written tagging software should allow it, as you've already discovered, and therefore, no properly-implemented playback soft/hardware should be expected to deal with it.
"Not sure what the question is, but the answer is probably no."

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #4
AFAIK such a file will be generated by creating an ID3 v2.4 tag first, and then trying to modify it with WMP11 (or possibly WMP12, which I haven't tested yet). WMP11's inbuilt tag editor doesn't support v2.4, and what is worse, it even can't recognize the existence of a v2.4 tag. It eventually produces a "double-tagged" file as a result.

But obviously it's just a bug of WMP which should not happen. Once you've layered a v2.3 tag over v2.4, you're no more able to access the original v2.4 tag.

Oh and let me say hello. I'm very new to this forum

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #5
Thank you very much, Arui Kashiwagi. That worked perfectly.

I added ID3v2.4 tags to a file with foobar and then I added ID3v2.3 tags to the same file with WMP11.

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #6
AFAIK such a file will be generated by creating an ID3 v2.4 tag first, and then trying to modify it with WMP11 (or possibly WMP12, which I haven't tested yet). WMP11's inbuilt tag editor doesn't support v2.4, and what is worse, it even can't recognize the existence of a v2.4 tag. It eventually produces a "double-tagged" file as a result.

But obviously it's just a bug of WMP which should not happen. Once you've layered a v2.3 tag over v2.4, you're no more able to access the original v2.4 tag.

Oh and let me say hello. I'm very new to this forum

hi everyone. Sorry for resurrecting such an old thread, but I need a suggestion from pro's
the trick is that I'm having an exactly opposite problem as the tread starter did - I have a huge music collection spoiled by WMP - some files are doubletagged with id3v2.3 and id3v2.4. I think I could live with that happily as it does not impact playback in most players, but I recently bought an iPod, and such files makes it skip or even hang. and the worst thing is that I don't know which of my mp3's are corrupted and which are ok - I don't want to try playing every track out of my 160gb collection at once - this will gray my hair and make me dead faster than anything. so I've decided to write some simple scanner that would walk thru all of my mp3's, searching for id3 tag markers of both versions and report the results so I could fix all of the files at once and live happily. But I'm fairly new to mp3's and coding, so maybe anyone could point me on a good read about how exactly those id3 look in mp3's, preferably with some hex examples - or maybe there are some tools that capable to fit my need right out of the box?
TIA, and sorry if I was not good at using search

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #7
You can find chained ID3v2 headers by parsing the file and looking for duplicate tag headers. The specification outlines a method for detecting them: http://www.id3.org/id3v2.3.0#head-697d09c5...9d93585e2652b0b.

I whipped up a quick code example. Note that I tested this only on one file and that this is horribly inefficient. Also, since it reads in chunks of 100 bytes, this will fail if the tag starts after the 81st byte.

If you know that the chained tags are always at the start of the file, it'd probably be most efficient to just read the first tag header, determine its size, then seek ahead that much and check if the next bytes are the start of another tag. Of course that would fail if the original tag was at the end and WMP wrote the new one to the start of the file.

Code: [Select]
#!/usr/bin/perl -wt
use strict;
use Fcntl;

sysopen(MP3, "test.mp3", O_RDONLY|O_BINARY) || die "Can not open file\n";
my $headers = 0;
while (read(MP3, my $buffer, 100)) {
  $buffer = unpack("H100", $buffer);
  my $index = index($buffer, "494433");
  if ($index > -1 && $index < 74) {
    if (hex(substr($buffer, $index + 7, 2)) < 0xff &&
        hex(substr($buffer, $index + 9, 2)) < 0xff &&
        hex(substr($buffer, $index + 13, 2)) < 0x80 &&
        hex(substr($buffer, $index + 15, 2)) < 0x80 &&
        hex(substr($buffer, $index + 17, 2)) < 0x80) {
        $headers += 1;
    }
    if ($headers > 1) {
      die "Chained ID3v2 headers found.\n";
    }
  }
}

close(MP3);

I need help tagging ID3v2.3 and ID3v2.4 to same file

Reply #8
Hmm. I guess I  can't edit the previous post anymore. My example contains a pretty obvious bug. A fixed version (with all the previous caveats):

Code: [Select]
#!/usr/bin/perl -wt
use strict;
use Fcntl;

sysopen(MP3, "test.mp3", O_RDONLY|O_BINARY) || die "Can not open file\n";

my $headers = 0;
while (read(MP3, my $buffer, 100)) {
  $buffer = unpack("H100", $buffer);
  my $index = index($buffer, "494433");
  if ($index > -1 && $index < 74) {
    my $header = substr($buffer, $index, 20);
    if (hex(substr($header, 7, 2)) < 0xff &&
        hex(substr($header, 9, 2)) < 0xff &&
        hex(substr($header, 12, 2)) < 0x80 &&
        hex(substr($header, 14, 2)) < 0x80 &&
        hex(substr($header, 16, 2)) < 0x80 &&
        hex(substr($header, 18, 2)) < 0x80) {
        $headers += 1;
    }
    if ($headers > 1) {
      die "Chained ID3v2 headers found.\n";
    }
  }
}

close(MP3);