MediaRecorder disables end of file

In my application, I record audio in m4a (AAC encoded) using MediaRecorder. All my notes are shortened (about half a second). For the purposes of my application, it is important that I have the entire file. Is this a mistake or is something missing?

Record Code:

//set up recorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION); recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); recorder.setAudioChannels(1); recorder.setAudioSamplingRate(16000); recorder.setOutputFile(fileName); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC); //begin recording recorder.prepare(); recorder.start(); 

Stop code:

  //stop recording recorder.stop(); recorder.release(); recorder = null; 
+4
source share
1 answer

This seems to be a bug in Android AAC-based audio encoders. The only solution I found is to use an AMR audio encoder. Unfortunately, AMR_WB does not sound as good as a human voice.

 recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB); 

The only other option, as far as I can tell, is to use AudioRecord, which is much more complicated.

+4
source

All Articles