8

Hey everyone just trying to make a program that browses video files and reads the title and description from the files metadata. I found some docs from microsoft here giving whats needed but how do I access these functions? what using namespaces are needed in c#? I would love any help that can be provided.

Carbongrip
  • 173
  • 1
  • 3
  • 12
  • 1
    Not sure why the downvotes; maybe someone thinks you didn't put enough effort into your question? To be honest I was just as confused as you; this page contains no links to functions or libraries. If you scroll to the bottom and click "Shell Metadata Providers" there's some more information, including some C++ code. – Reticulated Spline Nov 02 '14 at 02:27
  • Let's close this. After 6 years likely NONE of the links is still relevant. It is off topic as per now (recommending third party libraries). – TomTom Aug 30 '20 at 19:58

2 Answers2

8

In that link you posted, scroll to the bottom and click "Shell Metadata Providers". There's more more information and some sample C++ code.

Here are some other relevant links:

Reading/Writing metadata of audio/video files

http://www.codeproject.com/Articles/14535/Accessing-WMF-metadata-with-C

https://social.msdn.microsoft.com/Forums/pt-BR/0f36a3b2-4d3d-4842-88a4-bea493bbbace/read-video-filemov-avi-mpg-etc-meta-data?forum=csharpgeneral

https://web.archive.org/web/20170225230114/https://stackoverflow.com/questions/7396265/c-sharp-to-read-properties-of-video-files

Sorry I can't give you anything more concrete, however it looks like some tag libraries (i.e. for reading MP3 metadata) may work as well, as the metadata for videos seems to be stored in a similar, if not identical, format. That being said, you can give TagLib# a shot.

https://www.nuget.org/packages/taglib/

NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
Reticulated Spline
  • 1,892
  • 1
  • 18
  • 20
  • 1
    I used TagLib# and has worked great so far. However I cant find what I need to use to get a video files description tag, I know the tag is there as itunes see's the description tag when looking at the video. If anyone would like to help, [see this thread.](http://stackoverflow.com/questions/26860587/taglib-sharp-how-to-call-video-description) – Carbongrip Nov 13 '14 at 00:34
2

I've made a simple C# code (portable to Unity, too) csatomreader. It's optimized for speed and can read the atoms over HTTP, too.

E.g. Get title:

using (FileStream stream = new FileStream(fileName, FileMode.Open))
{
    var mp4Reader = new AtomReader(stream);
    string value = mp4Reader.GetMetaAtomValue(AtomReader.TitleTypeName);
    Console.WriteLine($"{atomTypeName}: {value}");
}

If you need to get more metadata values at once, then iterate over ParseAtoms(), e.g. see the GetMetaAtomValue() source.

xmedeko
  • 7,336
  • 6
  • 55
  • 85