How can I stop mutagen automatically updating the ID3 version?
Asked Answered
F

3

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.

Flibbertigibbet answered 15/8, 2013 at 7:36 Comment(1)
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.Unbelievable
U
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:

Unbelievable answered 15/8, 2013 at 15:20 Comment(2)
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.Flibbertigibbet
FYI - Issue 85 was fixed and 153 is a duplicate of 85. Granted this was almost 10 years ago. lolBalcony
I
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='/')

Intoxicated answered 20/9, 2014 at 15:35 Comment(1)
This was a life saver in getting my tags to update properly in Windows 7. This should be the accepted answer. Thanks!Gath
D
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()
Danie answered 8/3, 2014 at 19:55 Comment(0)
U
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:

Unbelievable answered 15/8, 2013 at 15:20 Comment(2)
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.Flibbertigibbet
FYI - Issue 85 was fixed and 153 is a duplicate of 85. Granted this was almost 10 years ago. lolBalcony

© 2022 - 2024 — McMap. All rights reserved.