Search code examples
androidvideomediaandroid-mediacodecmediaextractor

How to determine a video file's framerate with MediaCodec, MediaExtractor or MediaMetadataRetriever?


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. However KEY_FRAME_RATE is only available for encoders. Instead I want to find out the frame rate of an already recorded video.

Any ideas?


Solution

  • It looks like there is no way to get framerate through any of official API functions. It might require some extra logic - count times between timestamps or to parse headers info. in general h.264 standard allows variable framerate, so frame times could differ from one to one. for example if can show some static picture for several seconds or so