Android MediaRecorder is not generating a streamable AAC-LC audio using AudioEncoder.AAC

十年热恋 提交于 2019-12-12 14:08:25

问题


I am using a Nexus 7 with Android version 4.2+. So according to the Android Supported Media Formats all listed encoders and container formats are supported.

Now I want to record an audio using the AAC-LC encoder and the MPEG-4 container format (file type).

In the generated file, when I open it in an HEX-Editor, I see that the file is an ISO Base Media file having the isom File Type Box (Section 4.3) with the following compatible brands: isom and 3gp4. The remaining of the file is mostly an mdat Box (containing the actual audio data). The following HEX snippet from the beginning of the file was telling me this:

00000018 66747970 69736F6D 00000000 69736F6D 33677034 00029708 6D646174 ...

translated as:

      24 ftyp     isom     no-minor isom     3gp4     0x29708  mdat     ...

which means:

the file (ftyp) is complying with the ISO/IEC 14496-12 (isom) and specifies no minor version. The compatible brands with this file are: isom and 3gp4. Then follows the audio data box (mdat) with length 0x29708

Where is the part telling me that this is an AAC-LC (AAC Low complexity) encoded file?

Moreover, compared to other AAC-LC files on the web their header (file box) is different mentioning mp42 as ftyp and mp42, isom, ndia as compatible brands. Such a file is also streamable (how AAC-LC should be).

But the Android generated AAC_LC (MP4) file is NOT streamable. So what is Android MediaRecorder or me doing wrong? I am using the following code:

mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
// the bit rate should be adjusted silently if out of range
mRecorder.setAudioEncodingBitRate(320000);
mRecorder.setAudioSamplingRate(48000);

来源:https://stackoverflow.com/questions/16124198/android-mediarecorder-is-not-generating-a-streamable-aac-lc-audio-using-audioenc

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