如何在 C# 中将 ID3 标签读取和写入 MP3?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1750464/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 20:29:07  来源:igfitidea点击:

How to read and write ID3 tags to an MP3 in C#?

c#.netmp3id3id3-tag

提问by pupeno

Is there a library for reading and writing ID3 tags to an MP3 in C#?

是否有用于在 C# 中将 ID3 标签读取和写入 MP3 的库?

I've actually seen a couple when searching, anybody using any that can be recommended?

我实际上在搜索时看到了一些,有人使用可以推荐的吗?

采纳答案by Zac Bowling

Taglib# is the best. It's direct port of the TagLib C library to C#.

Taglib# 是最好的。它是 TagLib C 库到 C# 的直接端口。

To install TagLib#, run the following command in the Package Manager Console in Visual Studio.

要安装 TagLib#,请在 Visual Studio 的包管理器控制台中运行以下命令。

PM> Install-Package taglib

The NuGet distribution of taglib-sharp can be found at http://nuget.org/packages/taglib.
The official source code repository is at https://github.com/mono/taglib-sharp.

taglib-sharp 的 NuGet 发行版可以在http://nuget.org/packages/taglib找到。
官方源代码存储库位于https://github.com/mono/taglib-sharp

Here's an example using the library:

这是使用库的示例:

TagLib.File file = TagLib.File.Create("mysong.mp3");
String title = file.Tag.Title;
String album = file.Tag.Album;
String length = file.Properties.Duration.ToString();

回答by SqlRyan

Here's a sourceforge project that's been written to do this and seems to have some good reviews:

这是一个专门为此编写的 sourceforge 项目,似乎得到了一些好评:

http://csid3lib.sourceforge.net/

http://csid3lib.sourceforge.net/

I've only ever read ID3 tags, never written them, so I can't comment specifically on that. However, I believe this project (in a much earlier stage) was what I used to do it.

我只读过 ID3 标签,从来没有写过它们,所以我不能具体评论。然而,我相信这个项目(在更早的阶段)是我过去做的。

回答by darthtrevino

回答by Jacob Ewald

I've personally used ID3.Netfrom here:

我个人从这里使用过ID3.Net

http://id3dotnet.sourceforge.net/

http://id3dotnet.sourceforge.net/

As well as UltraID3Libfrom here:

以及来自此处的UltraID3Lib

http://home.fuse.net/honnert/hundred/

http://home.fuse.net/honnert/hundred/

Both did the job well and were easy to use from an API standpoint.

两者都做得很好,从 API 的角度来看都很容易使用。