How to I extract the frame rate of a recorded video file? I know that there is MediaFormat.KEY_FRAME_RATE and that I can access MediaFormat objects through MediaExtractor. H
When using MediaExtractor
, if your video track has a stable FPS, then you know for sure your MediaExtractor
is advancing by the frame duration you are searching for.
Before doing anything, just after having set up your MediaExtractor
, you can do the following:
mediaExtractor.Advance();
var fps = 1000000f / (float) mediaExtractor.SampleTime;
mediaExtractor.SeekTo(0, MediaExtractorSeekTo.None);
Like I said, you can't take for grant that all your frames have the same duration. Frame presentation time are totally arbitrary, but I feel it's not common to not have a stable FPS.