12

Is there a program that would dump the complete structure of ID3v2 tags?

Not just the frame names and values, but full information such as frame order, text encoding, description encoding (for TXXX frames), presence of unsynchronization, presence of multiple tags...

Background: I'm rather curious why some files are incompatible with some programs. For example, some ID3v2.4 tags written by foobar2000 are not read by Winamp; editing with Mutagen fixes them but editing with foobar2000 breaks again. It's not the version or data encoding – most other v2.4 UTF-16 tags work fine... However, if I use foobar2000 to convert the tags to v2.3, then back to v2.4, they start working fine in Winamp – this last bit just does not make any sense.

Edit: Linux or/and Windows.

7 Answers 7

4
+100

mp3diags on windows should both check for known errors and let you look at the raw tags - it lists known errors but you can also look at raw tags. I can't seem to find a way to dump it out to a text file. With a limited number of tags, its good for inspecting, and for bulk fixing of tags.

enter image description here

2
  • This looks very interesting. Thanks. (It still does not show which encodings are used by tag frames, but it provides more than enough detail otherwise.) Jan 4, 2012 at 13:51
  • It seems that MP3Diags has its own downsides as well (any edits to ID3 tags downgrade them to 2.3.0, for example), although it works well for fixing other kinds of streams. Jan 4, 2012 at 16:06
11

exiftool can give a lot of info:

exiftool -v3 -l FILENAME.mp3

1
  • exiftool is really able to dump raw info, including ID3v4! Really awsome!
    – haimg
    Jan 15, 2012 at 0:13
2

The Mutagen python library includes a utility called mid3v2 that provides a very clean and thorough dump/export of the values suitable for doing before/after diffing comparisons.

If you've never set up a python script then maybe exiftools will be worth figuring out, but I find mid3v2 much easier.

metamp3 is designed for this but IMO is a bit out of date, shows some pretty common de-facto standard (read: iTunes) fields as "undefined".

ID3RawTagViewer and ID3TagBackup are also pretty old tools but you may find them helpful as well.

MP3Tags has a "global export" plugin, but in some cases it "hides" the true frame names using its internal "mapped" field names so they are the same across different formats (e.g. FLAC and MP3).

Off topic but Ex Falso is another member of the Mutagen/Quod Libet family that does this very nicely for FLAC, but for some reason "hides" all the non-QL custom TXXX tags for ID3.

BTW many people just use their favorite HEX editor. . .

1
  • I used Mutagen earlier, will check out metamp3 and ID3RawTagViewer. The other tools only show abstract "name=value" tags, so they are not suitable for this purpose. Aug 28, 2012 at 10:49
2

The beaglebuddy MP3 library does what you are asking. It supports ID3v2.3 tags, and support for ID3v2.4 tags will be completed by May 2014. It shows the raw bytes as well as the parsed values. I've included some sample output.

ID3v2.4 frame: SONG_TITLE
frame header
   bytes..................: 0x54 0x49 0x54 0x32 0x00 0x00 0x00 0x0A 0x00 0x00 
   frame type.............: TIT2: SONG_TITLE - title/songname/content description
   frame header size......: 10
   frame body size........: 10
   tag  alter preservation: false
   file alter preservation: false
   read only..............: false
   compression............: false
   encryption.............: false
   grouping identity......: false
   uncompressed size......: 0
   encryption method......: 0
   unsynchronized.........: false
   data length indicator..: 0
   group Id...............: 0
frame body: text information
   bytes...: 10 bytes
             0x03 0x54 0x65 0x73 0x74 0x20 0x4E 0x61 0x6D 0x65 
   encoding: 3 - UTF-8
   text....: Test Name
1

I wrote a Python script for this job (requires mutagen):

import pathlib
import sys

import mutagen.id3

DATA_SEARCH_STR = "data=b'"

if __name__ == '__main__':
    errorval = 0
    try:
        filearg = sys.argv[1]
    except IndexError:
        errorval = 1
        print('ERROR: No file argument.')
    else:
        fp = pathlib.Path(filearg)
        if not fp.is_file():
            errorval = 2
            print('ERROR: Not a file.')
        else:
            try:
                I = mutagen.id3.ID3(fp)
            except mutagen.id3.ID3NoHeaderError:
                errorval = 3
                print('ERROR: File has no ID3 tag.')

    if errorval:
        print('USAGE: python id3report.py myfile')
        sys.exit(errorval)

    L = [str(fp)]
    print(L[-1])
    L.append('ID3 version: ' + '.'.join(str(x) for x in I.version) + '\n')
    print(L[-1])

    for key in sorted(set(I.keys())):
        L.append(f'key: "{key}"')
        print(L[-1])
        if hasattr(I[key], 'data'):
            s0 = repr(I[key])
            i0 = s0.find(DATA_SEARCH_STR)
            i1 = s0.find("'", i0 + len(DATA_SEARCH_STR))
            while s0[i1-1] == '\\':
                i1 = s0.find("'", i1+1)
            s1 = s0[:i0].rstrip(" ,") + s0[i1+1:]
            L.append(f'value: {s1}')
            print(L[-1])
            L.append(f'data: {len(I[key].data)} bytes')
            print(L[-1])
        else:
            L.append(f'value: {I[key]!r}')
            print(L[-1])
        L.append('')
        print(L[-1])

    outfile = fp.parent / f"{fp.stem}.id3report"
    with outfile.open('w', encoding='utf-8') as _f:
        _f.write('\n'.join(L))

This script print report to screen AND saves it next to the target file with .idreport extension.

Example output:

Trinity's Breakfast - The Punk .mp3
ID3 version: 2.3.0

key: "GEOB:SfMarkers"
value: GEOB(encoding=<Encoding.LATIN1: 0>, mime='', filename='', desc='SfMarkers')
data: 12 bytes

key: "TCOM"
value: TCOM(encoding=<Encoding.UTF16: 1>, text=['Zoltán Maxi Marton'])

key: "TCON"
value: TCON(encoding=<Encoding.LATIN1: 0>, text=['Electronic'])

key: "TDRC"
value: TDRC(encoding=<Encoding.LATIN1: 0>, text=['2020'])

key: "TIT2"
value: TIT2(encoding=<Encoding.LATIN1: 0>, text=['The Punk'])

key: "TPE1"
value: TPE1(encoding=<Encoding.LATIN1: 0>, text=["Trinity's Breakfast"])

As you can see the script trims data to prevent flooding the terminal. You can easily make a full report version by removing the hasattr condition.

0

You might need to write your own tool. TagLib and id3lib might be useful in this case.

Of special note is the Projects list on the homepage of id3lib, that contains several tools which might solve your problem without any programming.

1
  • I had earlier tried the id3info tool which comes as part of id3lib, and it didn't even recognize files with ID3v2.4 tags, only v2.3. Not sure if this is caused by the tool or the library itself, though. I'll take a look at both, but such libraries generally tend to hide the tag structure (encodings, order, etc) from the developer, exposing only tag-value pairs. Jan 4, 2012 at 13:36
-1

I'm by no means an expert on id3, however, I've been working on my library lately. You didn't specify an OS. I almost exclusively use Linux. Some tools I've been using, which may be of use to you are id3info (CLI) and kid3-qt (qt KDE id3). The latter is interesting. I'm not sure if it gets you everything you need but it does show a lot of information that may, at least, get you some of the things you seem to be seeking. If you're looking for a more portable tool, which seems to maybe get you all that you're looking for is a python tool called mid3v2. I just checked it out and it has an argument --list-raw, which seems to be pretty useful!

1
  • Thanks, but neither id3info nor kid3-qt do what I want, they only show formatted values. In fact, id3info does not recognize ID3v2.4 tags at all. mid3v2 is just an interface to Mutagen, which is one of the best when it comes to tag support but still neither the tool nor the Mutagen library itself will give me enough information on the raw structure -- although it looks fairly good so far. Dec 22, 2011 at 18:37

Not the answer you're looking for? Browse other questions tagged .