在我的应用程序中,我使用MediaRecorder在m4a (AAC编码)中录制音频。我所有的录音都被缩短了(大约半秒)。对于我的应用程序来说,拥有整个文件是很重要的。这是一个bug,还是我遗漏了什么?
记录代码:
//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 recording
recorder.stop();
recorder.release();
recorder = null;发布于 2014-06-07 08:39:11
这似乎是Android基于AAC的音频编码器中的一个错误。我发现唯一可行的解决方案是使用基于AMR的音频编码器。不幸的是,除了人类的声音之外,AMR_WB听起来并不是那么好。
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);据我所知,唯一的另一种选择是使用AudioRecord,这要困难得多。
https://stackoverflow.com/questions/15886416
复制相似问题