How can I extract the date from the “Media Created” column of a video file?

 ̄綄美尐妖づ 提交于 2019-11-29 18:54:28

问题


I need to extract the date from the "Media Created" column (highlighted in green in my the example photo below) using C#.

In my example, the "Media Created" and "Date" columns are the exact same. However, there are several instances where they are not. The "Media Created" column contains the correct date for when the video was actually recorded.

Here is the function I used to get it. Thanks to Aziz for pointing me in the right direction:

Shell shell = new ShellClass();
Folder folder = shell.NameSpace(_File.DirectoryName);
FolderItem file = folder.ParseName(_File.Name);

// These are the characters that are not allowing me to parse into a DateTime
char[] charactersToRemove = new char[] {
    (char)8206,
    (char)8207
};

// Getting the "Media Created" label (don't really need this, but what the heck)
string name = folder.GetDetailsOf(null, 191);

// Getting the "Media Created" value as a string
string value = folder.GetDetailsOf(file, 191).Trim();

// Removing the suspect characters
foreach (char c in charactersToRemove)
    value = value.Replace((c).ToString(), "").Trim();

// If the value string is empty, return DateTime.MinValue, otherwise return the "Media Created" date
return value == string.Empty ? DateTime.MinValue : DateTime.Parse(value);

回答1:


The extended file properties can be obtained by using Folder.GetDetailsOf() method. As per this thread, the Media Created Date can be retrieved using a property id of 177.



来源:https://stackoverflow.com/questions/8351713/how-can-i-extract-the-date-from-the-media-created-column-of-a-video-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!