title: Recording slow motion video using MediaCodec on Android
body: <p>I'm implementing video recording with Android camera. I use <strong>MediaCodec</strong> to encode frames from onPreviewFrame() callback.</p>
  
  <p>Now I want to record slow motion video. <strong>How can I set the camera capture rate or frame rate?</strong> Where can I set these parameters, for example, if I want to record at 120fps, and play at 30fps?</p>
  
  <p>The following is what I have researched:</p>
  
  <p>I recorded a slow-motion video with MOTO X (having built-in slow-motion video recording function) and used <strong>FFmpeg</strong> to check its fps. I found it records at 110 fps(near 120fps) and playback at 30fps. This proves that it provides hardware support for recording at high fps.</p>
  
  <p>However, when I use <strong>getSupportedPreviewFpsRange</strong> to check its supported fps range, there are only 4 sets supported fps range with no one greater than 30fps:</p>
  
  <p>min_fps: 15.0 , max_fps15.0</p>
  
  <p>min_fps: 15.0 , max_fps20.0</p>
  
  <p>min_fps: 15.0 , max_fps30.0</p>
  
  <p>min_fps: 24.0 , max_fps30.0</p>
  
  <p>I used <strong>setPreviewFpsRange</strong> to set the fps higher, but it remains no more than 30fps. I also tried set KEY_FRAME_RATE and KEY_CAPTURE_RATE of <strong>MediaFormat</strong>. But it still does not work.</p>
  
  <p>I have also searched the <a href="https://stackoverflow.com/questions/33167617/android-capturing-slow-motion-video">solution</a> by setting CamcorderProfile or setVideoFrameRate with MediaRecorder. But I'm doing with MediaCodec.</p>
  
  <p>Can anyone help me with this problem?</p>