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?

解决方案

Use UNPROCESSED instead of MIC.

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐