【问题标题】:Edit and add ID3 tags for mp3编辑和添加 mp3 的 ID3 标签
【发布时间】:2018-08-23 17:29:31
【问题描述】:

我正在通过 gTTS (Google Text-to-Speech) 创建 mp3 文件,它是一个 Python 库和 CLI 工具,用于与 Google Translate 的文本到语音 API 进行交互。如何将图像添加到 mp3 文件。谢谢

from mp3_tagger import MP3File, VERSION_1, VERSION_2, VERSION_BOTH
from gtts import gTTS
start = "Hello,this is  Alice ."
greetings ="That is the end of the news for today.  Have a good day. "
final_news = start + greetings
tts = gTTS(text=final_news, lang='en')
tts.save("news1.mp3") 
# Create MP3File instance.
mp3 = MP3File('news1.mp3')
# Get all tags.
tags = mp3.get_tags()
print tags

输出如下: {'ID3TAGV1':{“专辑”:U'Uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu 'Bebop','歌曲':u'UUUUUUUUUUUUUUUUUUUUUUUUUUUU\u044f','年份':u'UUUU'},'ID3TagV2':{}}

现在我想添加图像,以便在播放文件时对其进行透析。

【问题讨论】:

  • 请分享您的代码,以便我们从某个地方开始。
  • python 版本:2.7.12。代码显示在上面。

标签: mp3 text-to-speech


【解决方案1】:

很遗憾,您的 ID3 标记库 mp3_tagger 不支持图像标记。 在图书馆的documentation 中有以下内容:

允许的标签:

- artist;
- album;
- song;
- track;
- comment;
- year;
- genre;
- band (version 2.x);
- composer (version 2.x);
- copyright (version 2.x);
- url (version 2.x);
- publisher (version 2.x).

如您所见,没有提及cover 标签或类似的东西。

因此,如果您想将封面艺术之类的图像添加到您的 mp3 中,您将不得不为此使用另一个库。

我会推荐eyedD3。要添加图像,请查看以下 SO 答案: here

【讨论】:

    猜你喜欢
    • 2017-02-01
    • 2012-10-22
    • 1970-01-01
    • 2011-01-15
    • 2013-08-20
    • 2012-05-03
    • 2013-08-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多