C# Reading Video Metadata in Windows (Title,description,year)

前端 未结 2 846
谎友^
谎友^ 2021-01-18 08:08

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

相关标签:
2条回答
  • 2021-01-18 08:27

    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.

    0 讨论(0)
  • 2021-01-18 08:43

    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/

    0 讨论(0)
提交回复
热议问题