4

当我尝试在 MP3 中嵌入专辑封面时,mutagen 将 ID3 标签更新为 2.4 版 - 我不想要,因为在 ID3v2.4 中,我的手机(运行 Windows Phone 8)和我的电脑无法识别标签。

显然,简单地更改mutagen.id3.version属性是行不通的:真实版本不会改变。

4

3 回答 3

9

标签保存功能中有一个“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)

如下:

保存(自我,文件名=无,v1=1,v2_version=4,v23_sep='/')

于 2014-09-20T15:35:02.127 回答
3

现在似乎支持编写 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.

我不得不强制我的系统下载 1.22 版pip install 'mutagen>=1.22';否则它给了我1.21版。现在以下代码似乎对我有用:

>>> audio = mutagen.File("path_to_your.mp3")
>>> type(audio)
<class 'mutagen.mp3.MP3'>
>>> audio.tags.update_to_v23()
于 2014-03-08T19:55:23.070 回答
0

可悲的是,你不能。从文档

Mutagen 只能写 ID3v2.4 标签...

也可以看看:

于 2013-08-15T15:20:57.303 回答