2

How can I access frame rate of video file in Windows 10 application?

enter image description here

I tried external libraries like MediaInfoNet, or taglib for reading metadata, but these are not compactible with UWP (at least nuget is telling me this). Also MediaElement seems pretty evolved, but has no FPS property.

Is there any option?

Alamakanambra
  • 5,845
  • 3
  • 36
  • 43
  • The value you highlighted is extracted by MPEG-4 [shell property handler](https://msdn.microsoft.com/en-us/library/windows/desktop/ff728871) through COM and Media Foundation API underneath. The keyword is [`PKEY_Video_FrameRate`](https://msdn.microsoft.com/en-us/library/windows/desktop/ff384862). – Roman R. Aug 02 '15 at 09:06
  • @Roman R : If I understand well, I need windows api code pack?? It is retired http://stackoverflow.com/questions/24081665/windows-api-code-pack-where-is-it , but can be downloaded for example through nuget. It is same problem: it is not compatible with UWP. – Alamakanambra Aug 02 '15 at 17:36

1 Answers1

2

After all it is easy.

 List<string> encodingPropertiesToRetrieve = new List<string>();
 encodingPropertiesToRetrieve.Add("System.Video.FrameRate");
 IDictionary<string, object> encodingProperties = await file.Properties.RetrievePropertiesAsync(encodingPropertiesToRetrieve);
 uint frameRateX1000 = (uint)encodingProperties["System.Video.FrameRate"];

Where file is Windows.Storage.StorageFile

FrameRate is multiply by 1000.

More info about Metadata Properties for Media Files.

Alamakanambra
  • 5,845
  • 3
  • 36
  • 43