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.
Answers:
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()
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=’/’)
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.
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()
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=’/’)