【发布时间】:2013-08-15 07:36:57
【问题描述】:
当我尝试在 MP3 中嵌入专辑封面时,mutagen 将 ID3 标签更新为 2.4 版 - 我不想要,因为在 ID3v2.4 中,我的手机(运行 Windows Phone 8)和我的电脑可以'无法识别标签。
显然,简单地更改mutagen.id3.version 属性是行不通的:真实版本不会改变。
【问题讨论】:
标签: python mp3 id3 id3v2 mutagen
当我尝试在 MP3 中嵌入专辑封面时,mutagen 将 ID3 标签更新为 2.4 版 - 我不想要,因为在 ID3v2.4 中,我的手机(运行 Windows Phone 8)和我的电脑可以'无法识别标签。
显然,简单地更改mutagen.id3.version 属性是行不通的:真实版本不会改变。
【问题讨论】:
标签: python mp3 id3 id3v2 mutagen
标签保存功能中有一个“v2_version”选项,如下图。
import mutagen
audio=mutagen.File('1.mp3')
#audio.tags.update_to_v23()
audio.tags.save(v2_version=3)
help() 中也有记录
help(audio.tags.save)
如下:
save(self, filename=None, v1=1, v2_version=4, v23_sep='/')
【讨论】:
现在似乎支持编写 ID3v2.3 标签。我在更改日志中看到了这一点:
1.22 - 2013.09.08
...
* ID3:
* id3v2.3 writing support (#85)
* Add iTunes podcast frames (TGID, TDES, WFED) (#141)
* Updated id3v1 genre list
...
这在文档中:
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.
我不得不强制我的系统使用pip install 'mutagen>=1.22' 下载 1.22 版;否则它给了我1.21版。现在下面的代码似乎对我有用:
>>> audio = mutagen.File("path_to_your.mp3")
>>> type(audio)
<class 'mutagen.mp3.MP3'>
>>> audio.tags.update_to_v23()
【讨论】:
【讨论】: