1

I want to implement slow motion feature in our app. Here is the code that I used. Its making video to move slowly but not smoothly. We want slow motion feature as in default camera app. Is it possible to do so or not??

mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
if (mNextVideoAbsolutePath == null || mNextVideoAbsolutePath.isEmpty()) {
    mNextVideoAbsolutePath = getVideoFilePath(getActivity());
}
mMediaRecorder.setOutputFile(mNextVideoAbsolutePath);

CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate);
mMediaRecorder.setCaptureRate(profile.videoFrameRate / 0.25f);
mMediaRecorder.setVideoFrameRate(profile.videoFrameRate);
mMediaRecorder.setVideoSize(mVideoSize.getWidth(), mVideoSize.getHeight());
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.HEVC);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
jass patel
  • 51
  • 5
  • Looks you are limiting the captureRate, meaning taking *less* frames per second. To have a smooth slow motion video, you need *more* frames per second. Try `mMediaRecorder.setCaptureRate(profile.videoFrameRate *4 );` – Michael A. Schaffrath Aug 16 '18 at 08:44
  • Tried thies but doesn't work...Video captured is not smooth as captured from default slow motion camera – jass patel Aug 16 '18 at 09:18

0 Answers0