问题描述
我正在使用Android MediaRecorder录制AAC编码的音频文件.将输出格式设置为MPEG-4效果很好.但是由于我的音频播放器既不支持MPEG-4也不支持3GP,所以我尝试使用输出格式 AAC_ADTS 来获取原始AAC文件,该格式从API级别16开始就受到Android的支持.
I'm using the Android MediaRecorder to record AAC encoded audio files. Setting the output format to MPEG-4 worked pretty well. But as my audio player supports neither MPEG-4 nor 3GP I tried to get raw AAC files by using the output format AAC_ADTS, which is supported by Android since API level 16.
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
这是我卡住的地方. MediaRecorder创建了一个文件,但是我无法使用任何播放器(我上面提到的Android MediaPlayer,Windows Media Player或我的音频播放器都不能播放该文件,该播放器可以播放ADTS AAC我在网上找到的文件).
Here is where I got stuck. The MediaRecorder created a file but I'm not able to play that file with any player (neither Android's MediaPlayer nor the Windows Media Player nor my audio player I mentioned above, which was able to play an ADTS AAC file I found on the web).
我做错什么了吗? AAC_ADTS输出格式甚至是推荐格式吗?有没有办法获取ADIF AAC文件?
Am I doing something wrong? Is the AAC_ADTS output format even a recommendable format? Is there a way to get an ADIF AAC file?
推荐答案
使用UNPROCESSED而不是MIC.
Use UNPROCESSED instead of MIC.
这篇关于如何使用MediaRecorder在Android中录制原始AAC音频文件? AAC_ADTS不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!