5

When I tried to embed album art in an MP3, mutagen updated the ID3 tag to version 2.4 - which I don't want, because in ID3v2.4 my cell phone (which runs Windows Phone 8) and my computer can't recognize the tags.

Apparently, simply changing the mutagen.id3.version attribute doesn't work: the real version doesn't change.

Zero Piraeus
  • 56,143
  • 27
  • 150
  • 160
prehawk
  • 195
  • 12
  • Since there are now two answers providing a solution to this problem, you should choose one of them as the accepted answer, rather than my answer (which is now out of date). Thanks to @JayRizzo for pointing this out. – Zero Piraeus Sep 27 '22 at 07:47

3 Answers3

10

There is a "v2_version" option in tags saving function, shown below.

import mutagen
audio=mutagen.File('1.mp3')
#audio.tags.update_to_v23()
audio.tags.save(v2_version=3)

It is also documented in help()

help(audio.tags.save)

as below:

save(self, filename=None, v1=1, v2_version=4, v23_sep='/')

cdarlint
  • 1,485
  • 16
  • 14
  • 1
    This was a life saver in getting my tags to update properly in Windows 7. This should be the accepted answer. Thanks! – Mark Ransom Aug 04 '16 at 04:41
3

It appears that writing ID3v2.3 tags is now supported. I see this in the change log:

1.22 - 2013.09.08
 ...
 * ID3:
   * id3v2.3 writing support (#85)
   * Add iTunes podcast frames (TGID, TDES, WFED) (#141)
   * Updated id3v1 genre list
 ...

And this in the documentation:

update_to_v23()
    Convert older (and newer) tags into an ID3v2.3 tag.    
    This updates incompatible ID3v2 frames to ID3v2.3 ones. If you intend to save tags as ID3v2.3, you must call this function at some point.
    If you want to to go off spec and include some v2.4 frames in v2.3, remove them before calling this and add them back afterwards.

I had to force my system to download version 1.22 with pip install 'mutagen>=1.22'; otherwise it got me version 1.21. Now the following code seems to work for me:

>>> audio = mutagen.File("path_to_your.mp3")
>>> type(audio)
<class 'mutagen.mp3.MP3'>
>>> audio.tags.update_to_v23()
kuzzooroo
  • 6,788
  • 11
  • 46
  • 84
0

Update: this is now fixed, as pointed out by JayRizzo in a comment to this answer.


Sadly, you can't. From the docs:

Mutagen is only capable of writing ID3v2.4 tags ...

See also:

Zero Piraeus
  • 56,143
  • 27
  • 150
  • 160
  • oh! Is that a pity for mutagen or for my cell phone? I should have checked up the docs more carefully. Anyway, thank you for the answer. – prehawk Aug 16 '13 at 06:05
  • 1
    FYI - Issue 85 was fixed and 153 is a duplicate of 85. Granted this was almost 10 years ago. lol – JayRizzo Sep 27 '22 at 06:26