How can I stop mutagen automatically updating the ID3 version?

Question:

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.

Asked By: prehawk

||

Answers:

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:

Answered By: Zero Piraeus

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()
Answered By: kuzzooroo

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=’/’)

Answered By: cdarlint
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.