Android capturing slow motion video

后端 未结 4 2064
一个人的身影
一个人的身影 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:55

    From the source you provided (CamcorderProfile), all you have to do is INCREASE taken images per second:

    mMediaRecorder.setVideoFrameRate(QUALITY_HIGH_SPEED_LOW);
    

    or

    mMediaRecorder.setVideoFrameRate(QUALITY_HIGH_SPEED_HIGH);
    

    So, if you take a 100 images per seconds, and show 25 Frames per second, that recorded second takes 4 seconds to shown

    Please, read the documentation on the class you are using:

    public static final int QUALITY_HIGH_SPEED_LOW

    High speed ( >= 100fps) quality level corresponding to the lowest available resolution.

    For all the high speed profiles defined below ((from QUALITY_HIGH_SPEED_LOW to QUALITY_HIGH_SPEED_2160P), they are similar as normal recording profiles, with just higher output frame rate and bit rate. Therefore, setting these profiles with setProfile(CamcorderProfile) without specifying any other encoding parameters will produce high speed videos rather than slow motion videos that have different capture and output (playback) frame rates. To record slow motion videos, the application must set video output (playback) frame rate and bit rate appropriately via setVideoFrameRate(int) and setVideoEncodingBitRate(int) based on the slow motion factor. If the application intends to do the video recording with MediaCodec encoder, it must set each individual field of MediaFormat similarly according to this CamcorderProfile.

提交回复
热议问题