Android で AAC ELD をサポートするように AAC ADTS ヘッダーを正しく構成する方法。LC とメインを構成できます。
以下の記事によると
https://wiki.multimedia.cx/index.php?title=ADTS
プロファイルは 2 ビット (E 2 プロファイル、MPEG-4 オーディオ オブジェクト タイプから 1 を引いた値) しか取りませんが、AACObjectELD のプロファイル値は39 です。つまり、0010 0110 です。
private void addADTStoPacket(byte[] packet, int packetLen) {
int profile = 39; // 2 - AAC LC, 39 = MediaCodecInfo.CodecProfileLevel.AACObjectELD;
int freqIdx = 8; // 4 44.1KHz 8 16KHZ
int chanCfg = 2; //2 channel
// fill in ADTS data
packet[0] = (byte)0xFF;
packet[1] = (byte)0xF1;
packet[2] = (byte)(((profile-1)<<6) + (freqIdx<<2) +(chanCfg>>2));
packet[3] = (byte)(((chanCfg&3)<<6) + (packetLen>>11));
packet[4] = (byte)((packetLen&0x7FF) >> 3);
packet[5] = (byte)(((packetLen&7)<<5) + 0x1F);
packet[6] = (byte)0xFC;
}
よろしくお願いします。
よろしくお願いします
ジョセフ