I just switched to Mutagen as the metadata handler for my
mkogg utility. I used to use metaflac and id3v2, but ran
up against limitations discussed on the mkogg
page. Here's a quick
note on using Mutagen to set some ID3 tags:
>>> from mutagen.mp3 import MP3
>>> import mutagen.id3
>>> audio = MP3('some_file.mp3')
>>> audio['TIT2'] = TIT2(encoding=3, text=["Title"])
>>> audio.save(v1=2) # also include ID3v1 tags, when possible
ID3v2 encodings are hardcoded to the following table:
Value | Encoding |
0 | ISO-8859-1 (ASCII) |
1 | UCS-2 in ID3v2.2 and ID3v2.3, UTF-16 encoded Unicode with BOM. |
2 | UTF-16BE encoded Unicode without BOM in ID3v2.4 only. |
3 | UTF-8 encoded Unicode in ID3v2.4 only. |
In order to get ID3v1 tags, you'll need to use frames and encodings
that ID3v1 understands. For encodings, that means 0
(ISO-8859-1).