How to record raw AAC audio files in Android using MediaRecorder? AAC_ADTS doesn't work

纵饮孤独 提交于 2019-12-21 18:33:34

问题


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);

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).

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?


回答1:


Use UNPROCESSED instead of MIC.



来源:https://stackoverflow.com/questions/21552297/how-to-record-raw-aac-audio-files-in-android-using-mediarecorder-aac-adts-doesn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!