Open scally81 opened 1 year ago
caveat: I'm no expert.
The likely reason for this might be that essentially every modern video format in use nowadays uses adaptive compression, with the sophistication of deploying higher frame rates only when they are actually most needed according to the varying complexity of the content signal, to maximize overall quality.
This issue usually comes up when someone wants to know a "total count of how many frames" are in a given MP4. As far as I know, long gone are the days where that answer can be determined by multiplying a putative "FrameRate" by the length of the video in seconds. Note that this is not to say that a given video doesn't have a fixed number of frames that can be determined, usually only by enumerating and counting them in sequence. That total should remain a permanently conclusive value--but possibly only given the specific MP4 decoder configuration you just measured it on..
So my understanding is that both questions are somewhat meaningless nowadays?
You would have to be more specific about what your ultimate goal for having this number is, in order to better choose from amongst the various available approximation methods or workarounds that might be avilable.
All this is needed to track the position of the current frame, for a clear transition to the desired frame and end after the desired frame. Roughly speaking, easy video editing on the fly. All other components have this parameter. Only in this component does not. Even DirectShow itself has GetFrameRate. In this component, it is even described in the MediaType.h file, but I don't know how to attach it to the graph to use. FrameRate always works in the solutions I need. But he, like AspectRatio and other goodies, is missing here. Well, even if FrameRate, like AspectRatio, can change during playback, then in any case it can somehow be received in some event, for example, make an event to change each frame "FrameProgress". Simple video editing always goes to the next, previous frame, or 10-20 frames back and forth, frames, not milliseconds.
Look at this PR #69 how to implement missing DirectShow functions. I added the framestep function which was initially not available on wpf-mediakit. Over there you can also find a commit with the framerate property you are looking for.
Unfortunately, I couldn't find any examples of using non-implemented DirectShow methods. Where can I get more different examples? The site to which everyone refers https://wpfmediakit.codeplex.com/ has not been available for a long time.
As mentioned, you can find the sample code here inside the active pullrequest #69 the commit link to review the code https://github.com/Sascha-L/WPF-MediaKit/pull/69/commits/76158bd2c4affbb315d89ef2ee819fb297567572 https://wpfmediakit.codeplex.com/ was the previous home of wpf-mediakit and got abandoned to be continued here. Codeplex was shut down from Microsoft long ago.
I have looked all over the internet but there is no information anywhere. It is logical that the FrameRate parameter should be received along with NativeVideoWidth(Heigth), but it is not in any of the base classes. How to get the number of frames per second of an open video?