[英]Getting the “Media Created” date of a video file in UWP
I want to get the date of creation of a video file, commonly known as Media Created property (not to be confused with the File Creation Date ) 我想获取视频文件的创建日期,通常称为Media Created属性(不要与File Creation Date混淆)
I'm trying with this code: 我正在尝试使用以下代码:
var clip = await MediaClip.CreateFromFileAsync(x);
var encodingProps = clip.GetVideoEncodingProperties();
var props = encodingProps.Properties.ToList();
Inside the props
reference I'm getting a list of Guids and values, but I'm lost there. 在props
参考里面,我会得到一份指导和价值观的清单,但是我迷路了。
You can use Extended properties to get the specific property you need: 您可以使用扩展属性来获取所需的特定属性:
var dateEncodedPropertyName = "System.Media.DateEncoded";
var propertyNames = new List<string>()
{
dateEncodedPropertyName
};
// Get extended properties
IDictionary<string, object> extraProperties =
await file.Properties.RetrievePropertiesAsync(propertyNames);
// Get the property value
var propValue = extraProperties[dateEncodedPropertyName];
if (propValue != null)
{
Debug.WriteLine(propValue);
}
Note I am using the System.Media.DateEncoded
property in the example. 注意我在示例中使用System.Media.DateEncoded
属性 。 If you need a different property, check out the full list of supported properties with their exact names in documentation . 如果您需要其他属性,请在文档中查看受支持属性的完整列表及其确切名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.