使用 .NET 访问音频/视频元数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9091/
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-09-03 09:37:30  来源:igfitidea点击:

Accessing audio/video metadata with .NET

.netvideoaudiomp3

提问by Lance Fisher

What is the best way to get and set the meta data for mp3, mp4, avi files etc. with .NET?

使用 .NET 获取和设置 mp3、mp4、avi 文件等的元数据的最佳方法是什么?

回答by sieben

I use MediaInfowith my C# apps, gives you a lot of information about media files.

我将MediaInfo与我的 C# 应用程序一起使用,为您提供了大量有关媒体文件的信息。

回答by sieben

These are the example class files for different languages found in the MediaInfo.dll zip

这些是在 MediaInfo.dll zip 中找到的不同语言的示例类文件

  • MediaInfoDLL.cs
  • MediaInfoDLL.def
  • MediaInfoDLL.h
  • MediaInfoDLL.java
  • MediaInfoDLL.jsl
  • MediaInfoDLL.pas
  • MediaInfoDLL.py
  • MediaInfoDLL.vb
  • MediaInfoDLL_Static.h
  • 媒体信息DLL文件
  • 媒体信息DLL.def
  • 媒体信息DLL文件
  • 媒体信息DLL.java
  • 媒体信息DLL.jsl
  • 媒体信息DLL文件
  • 媒体信息DLL文件
  • 媒体信息DLL.vb
  • MediaInfoDLL_Static.h

You do have to use interop and I don't know if you can edit tags, I've never needed to do that but it's pretty much a swiss army knife at least for getting media information from files.

你必须使用互操作,我不知道你是否可以编辑标签,我从来不需要这样做,但至少对于从文件中获取媒体信息来说,这几乎是一把瑞士军刀。

Link to downloads page (sourceforge)

链接到下载页面(sourceforge)

MediaInfo_0.7.7.4_DLL_Win32.zip

MediaInfo_0.7.7.4_DLL_Win32.zip

回答by Jarod Elliott

I've recently used Tag Lib Sharpto write some C# apps for cleaning up and maintaining my music library. I found the library very easy to use and although i've only used it for MP3's, it appears to support a range of other music/video formats.

我最近使用Tag Lib Sharp编写了一些 C# 应用程序来清理和维护我的音乐库。我发现该库非常易于使用,虽然我只将它用于 MP3,但它似乎支持一系列其他音乐/视频格式。

回答by Alvin Ashcraft

You can use free UltraID3Lib.NET library to read/write MP3 metadata.

您可以使用免费的UltraID3Lib.NET 库来读取/写入 MP3 元数据。

回答by Jon Galloway

I've been looking at the NTagproject as well, which handles MP3/WMA/OGG. I don't know of a single library that handles audio and video files, so you might have to use a few.

我也一直在研究NTag项目,它处理 MP3/WMA/OGG。我不知道处理音频和视频文件的单个库,因此您可能必须使用一些。

回答by Jon Galloway

Looks like MediaInfo is read-only at this point, by the way: http://sourceforge.net/forum/message.php?msg_id=4241318&abmode=1

看起来 MediaInfo 在这一点上是只读的,顺便说一下:http: //sourceforge.net/forum/message.php?msg_id=4241318&abmode =1

Very cool project, though. It's fun finding out about all this cool stuff here on SO.

不过,非常酷的项目。在 SO 上找到所有这些很酷的东西很有趣。

回答by Orion Edwards

I used COM interop to access DirectShow's Media Detectorfunctionality.

我使用 COM 互操作访问DirectShow 的媒体检测器功能。

This does work pretty well, but it's a right pain in the backside. You need to know lots about COM, win32 interop, and so on.

这确实工作得很好,但它是背面的正确疼痛。您需要了解很多关于 COM、win32 互操作等的知识。

You can also use DirectShowNetwhich should handle most of that for you, I just didn't want to lug that whole thing around when I was only interested in the MediaDetector part

你也可以使用DirectShowNet,它应该为你处理大部分事情,当我只对 MediaDetector 部分感兴趣时,我只是不想拖着整个事情