Getting frames per second from a video RRS feed

  • Question

  • Hello,

    I'd like to check the frames per second while I draw subtitles becouse format of subtitles is something like that :


    where 'begin' and 'end' is a range when the text is drawn.

    And the problem is this range is given by frames and I need to know how many frames per second has a video in order to transform this section into miliseconds (this is used to Markers in MediaElement)

    Sunday, August 26, 2012 9:06 PM


All replies

  • Forwarding to media guy.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, August 27, 2012 6:39 PM
  • I passed all subtitles to MediaElement with MediaElement.Markes option. But TimelineMarker has time option and it means that a suitable string will be called in due course. But as I mentioned I don't know when should I pass suitable text ? Becouse the range <begin><end> indicates frames not a real time. And I need to know FPS from a video (such as *.avi, *.3gp etc.) and transform it to millisecond. Is there any simple way to get this info from IRandomAccessStrem or MediaElement? Or maybe Does a MediaElement supports subtitles ? But I wasn't able to find it.

    Monday, August 27, 2012 7:05 PM
  • Hello,

    To my recollection there was a way to query for Media Foundation attributes through the MediaElement control. Unfortunately upon searching for such functionality I was not able to find it. If I stumble upon the solution I'll let you know. In the mean time if you can use C++ you can get access to the Source Reader and query for "MF_MT_FRAME_RATE".





    I hope this helps,


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, August 27, 2012 9:47 PM
  • Hello,

    Thanks for the reply.

    I would be grateful for solution of this problem in C#. At worts, I will rewrite my project to C++, if it isn't time-consuming (fortunately this is a beginning stage).

    Monday, August 27, 2012 10:12 PM