In fact, you execute mMediaRecorder.setOutputFormat()twice: one time explicitly, and then mMediaRecorder.setProfile()tries to do it again, as you can see in your stack.
Android Media Recorder has very low reliability for such things.
So delete the line that says
mMediaRecorder.setOutputFormat();
and the error should disappear. And by the way. remove
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
what has already been done mMediaRecorder.setProfile().
source
share