1

I am using MediaCodec to encode video from the camera into h264. I used to have 30 fps and this is the output I was getting, but now I need to switch to 25fps and the MediaFormat line:

    format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);

is not working: I always get 30fps regardless of this value (I even tried putting 5 fps and the video is still smooth).

Is there anything else I need to do to achieve my desired fps value?

MichelReap
  • 5,630
  • 11
  • 37
  • 99

1 Answers1

1

MediaFormat.KEY_FRAME_RATE does not tell the Encoder to drop frames. Visit for more information .

To reduce the overall framerate you have to either drop frames manually, correct the timestamps to match your desired fps (probably not what since the result will be a longer video)

A very basic but good doc on how to manipulate framerates (sadly mostly increasing the rate) can be found here

Greetings

Community
  • 1
  • 1
ChrisBe
  • 878
  • 9
  • 19