Meyer Denney
Meyer Denney

Reputation: 846

How to get the title of a video's metadata

I am trying to access the title for a video, similar to how Windows Media Player does. E.g. video.avi would show up as "Family Videos 2010". I have tried the mediainfo sdk but I can't seem to get the assemblies to load. Does anyone have any suggestions?

Upvotes: 1

Views: 1191

Answers (1)

danfromisrael
danfromisrael

Reputation: 3112

 public static Dictionary<string, string> GetDetails(this FileInfo fi)
    {
        Dictionary<string, string> ret = new Dictionary<string, string>();
        Shell shl = new Shell();
        Folder folder = shl.NameSpace(fi.DirectoryName);
        FolderItem item = folder.ParseName(fi.Name);

        for (int i = 0; i < 150; i++)
        {
            string dtlDesc = folder.GetDetailsOf(null, i);
            string dtlVal = folder.GetDetailsOf(item, i);

            if (dtlVal == null || dtlVal == "")
                continue;

            ret.Add(dtlDesc, dtlVal);
        }
        return ret;
    }

and dont forget to add a reference to Shell32.dll :-)

Upvotes: 2

Related Questions