Accessing audio/video metadata with .NET
Asked Answered
S

8

11

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

Surpass answered 12/8, 2008 at 18:1 Comment(0)
P
6

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

Pedrick answered 12/8, 2008 at 19:34 Comment(0)
P
4

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

  • MediaInfoDLL.cs
  • MediaInfoDLL.def
  • MediaInfoDLL.h
  • MediaInfoDLL.java
  • MediaInfoDLL.jsl
  • MediaInfoDLL.pas
  • MediaInfoDLL.py
  • MediaInfoDLL.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)

MediaInfo_0.7.7.4_DLL_Win32.zip

Pedrick answered 12/8, 2008 at 20:18 Comment(0)
C
3

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

Conquian answered 12/8, 2008 at 18:15 Comment(0)
K
3

I've been looking at the NTag project 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.

Kourtneykovac answered 12/8, 2008 at 19:9 Comment(0)
H
3

I've recently used Tag Lib Sharp to 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.

Halfassed answered 18/8, 2008 at 8:29 Comment(0)
K
1

Looks like MediaInfo is read-only at this point, by the way: 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.

Kourtneykovac answered 12/8, 2008 at 19:59 Comment(0)
M
1

I used COM interop to access DirectShow's Media Detector functionality.

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.

You can also use DirectShowNet which 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

Mediate answered 12/8, 2008 at 20:45 Comment(0)
G
0

After struggling with NAudio (note that it can only run on Windows) and even TagLibSharp, I found out ATL .NET. What I love about it is it can work on Stream and it can detect formats as well.

  1. Install z440.atl.core Nuget package:
dotnet add package z440.atl.core
  1. Get the Track object and get as many information as you want:
var track = new Track(stream);

Console.WriteLine(track.Duration);
// More info
Galatia answered 2/9 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.