Android capturing slow motion video

后端 未结 4 2036
一个人的身影
一个人的身影 2020-12-31 08:51

How can i capture slow motion video in my app?

I tried using

 mMediaRecorder.setVideoFrameRate(100);

but app crashes if i set the v

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 08:59

    What worked for me was to put higher the capture rate of mMediaRecorder like:

    mMediaRecorder.setVideoFrameRate(profile.videoFrameRate / 2);
    mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate / 2);
    mMediaRecorder.setCaptureRate(profile.videoFrameRate);
    

    Where profile is the CamcorderProfileset with QUALITY_HIGH (I can't have more since I'm using a LG G2, API 19).

    Here in my case,profile.videoFrameRate is equal to 30.

    More info about setCaptureRate in the official documentation:

    Set video frame capture rate. This can be used to set a different video frame capture rate than the recorded video's playback rate. This method also sets the recording mode to time lapse. In time lapse video recording, only video is recorded. Audio related parameters are ignored when a time lapse recording session starts, if an application sets them.

    The video recorded result is twice as long as the initial capture. However setting the capture rate disables the audio. In my case, my max fps rate seems to be 30fps, and then it got played back at 15fps.

    Hope it helps.

提交回复
热议问题