将 (ID3) 标签从 FLAC 传输到 MP3 的 Linux 脚本
对于我的媒体服务器,我正在寻找将标签从 FLAC 文件传输到 MP3 的方法。
在 bash 脚本中,我可以使用 metaflac 将标签提取到本地变量,但是当使用id3v2,我似乎丢失了国家字符(猜猜它一定是unicode?)
此外,我需要能够设置重播增益标签和专辑封面(全部存在于FLAC)。
我正在寻找一种无人值守运行的脚本化解决方案。
For my media server, I am looking for ways to transfer tags from my FLAC files to MP3.
In a bash script, I can extract tags using metaflac to local vars, but when tagging mp3 with id3v2, I seem to lose national characters (guess it must be unicode?)
Also I need to be able to set replay gain tags, and album art (all present in the FLAC's).
I am looking for a scripted solution to run unattended.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您对 Python 解决方案感兴趣,诱变库看起来非常不错。
它可能很简单:
我找到了将 mp3 id3 标签复制到 FLAC 文件中的解决方案。
If you are interested in a Python solution, the mutagen library looks really good.
It could be as easy as:
I found this solution for copying mp3 id3 tags into FLAC files.
试试这个工具eyed3。它支持专辑封面嵌入、latin1、utf8、utf16-BE 和 utf16-LE 文本编码。但是不支持重放增益。据我了解,它没有得到广泛支持。
Try this tool eyed3. It supports album art embedding, text encoding in latin1, utf8, utf16-BE and utf16-LE. However the replay gain is not supported. As far as I understand it is not widely supported.
维克多的解决方案为我指明了道路。但是,如果将标签复制到刚刚转换的文件(例如从 flac 到 mp3),则可能会失败。也就是说,如果您将标签复制到的文件尚不具有任何标签,则该操作将会失败。
因此,您可能需要首先准备目标文件,为其提供标记的方法。
Victor's solution showed me the way. It may fail, however, if copying tags to a file you've just converted, for example, from flac to mp3. That is, it will fail if the file you are copying tags to doesn't already have any tags.
So you may need to prime the destination file first, giving it the means to have tags.
这是使用 ffmpeg 的另一种解决方案。
例如。只需在 $HOME/.bashrc 中定义一个 bash 函数:
Here is another solution using ffmpeg.
Eg. just define a bash function in $HOME/.bashrc:
Quod Libet 附带一个名为 operon 可以执行此操作以及更多操作:
由于 Quod Libet 是基于 Mutagen 构建的,因此它知道一堆晦涩的标签以及如何在各种标签格式之间翻译它们,这对于某些工作流程很重要。我注意到的唯一怪癖是它不会复制具有空值的标签,但这并不困扰我。
Quod Libet comes with a command line tool called operon that does this and more:
Since Quod Libet is built on Mutagen, it knows about a bunch of obscure tags and how to translate them among the various tagging formats, which is important for some workflows. The only quirk I noticed is that it doesn't copy tags with empty values, but that doesn't bother me.