AAC音频格式分析

关于AAC音频格式基本情况,可参考维基百科http://en.wikipedia.org/wiki/Advanced_Audio_Coding

 

AAC音频格式分析

AAC音频格式有ADIF和ADTS: 

ADIF:Audio Data Interchange Format 音频数据交换格式。这种格式的特征是可以确定的找到这个音频数据的开始,不需进行在音频数据流中间开始的解码,即它的解码必须在明确定义的开始处进行。故这种格式常用在磁盘文件中。 

ADTS:Audio Data Transport Stream 音频数据传输流。这种格式的特征是它是一个有同步字的比特流,解码可以在这个流中任何位置开始。它的特征类似于mp3数据流格式。 

简单说,ADTS可以在任意帧解码,也就是说它每一帧都有头信息。ADIF只有一个统一的头,所以必须得到所有的数据后解码。且这两种的header的格式也是不同的,目前一般编码后的和抽取出的都是ADTS格式的音频流。 

语音系统对实时性要求较高,基本是这样一个流程,采集音频数据,本地编码,数据上传,服务器处理,数据下发,本地解码 

ADTS是帧序列,本身具备流特征,在音频流的传输与处理方面更加合适。 

  

ADTS帧结构:

header

body

ADTS帧首部结构:

序号 长度(bits) 说明
1 Syncword 12 all bits must be 1
2 MPEG version 1 0 for MPEG-4, 1 for MPEG-2
3 Layer 2 always 0
4 Protection Absent 1 et to 1 if there is no CRC and 0 if there is CRC
5 Profile 2 the MPEG-4 Audio Object Type minus 1
6 MPEG-4 Sampling Frequency Index 4 MPEG-4 Sampling Frequency Index (15 is forbidden)
7 Private Stream 1 set to 0 when encoding, ignore when decoding
8 MPEG-4 Channel Configuration 3 MPEG-4 Channel Configuration (in the case of 0, the channel configuration is sent via an inband PCE)
9 Originality 1 set to 0 when encoding, ignore when decoding
10 Home 1 set to 0 when encoding, ignore when decoding
11 Copyrighted Stream 1 set to 0 when encoding, ignore when decoding
12 Copyrighted Start 1 set to 0 when encoding, ignore when decoding
13 Frame Length 13 this value must include 7 or 9 bytes of header length: FrameLength = (ProtectionAbsent == 1 ? 7 : 9) + size(AACFrame)
14 Buffer Fullness 11 buffer fullness
15 Number of AAC Frames 2 number of AAC frames (RDBs) in ADTS frame minus 1, for maximum compatibility always use 1 AAC frame per ADTS frame
16 CRC 16 CRC if protection absent is 0


MPEG-4 Audio

Specification links:

MPEG-4 Audio

MPEG-4 includes a system for handling a diverse group of audio formats in a uniform matter. Each format is assigned a unique Audio Object Type (AOT) to represent it. The common format Global header shared by all AOTs is called the Audio Specific Config. 

Subparts

  • Subpart 0: Overview
  • Subpart 1: Main (Systems Interaction)
  • Subpart 2: Speech coding - HVXC
  • Subpart 3: Speech coding - CELP
  • Subpart 4: General Audio coding (GA) - AAC, TwinVQ, BSAC
  • Subpart 5: Structured Audio (SA)
  • Subpart 6: Text To Speech Interface (TTSI)
  • Subpart 7: Parametric Audio Coding - HILN
  • Subpart 8: Parametric coding for high quality audio - SSC (and Parametric Stereo)
  • Subpart 9: MPEG-1/2 Audio in MPEG-4
  • Subpart 10: Lossless coding of oversampled audio - DST
  • Subpart 11: Audio lossless coding - ALS
  • Subpart 12: Scalable lossless coding - SLS

Audio Specific Config

The Audio Specific Config is the global header for MPEG-4 Audio:

5 bits: object type
if (object type == 31)
    6 bits + 32: object type
4 bits: frequency index
if (frequency index == 15)
    24 bits: frequency
4 bits: channel configuration
var bits: AOT Specific Config

Audio Object Types

MPEG-4 Audio Object Types:

  • 0: Null 
  • 1: AAC Main
  • 2: AAC LC (Low Complexity)
  • 3: AAC SSR (Scalable Sample Rate)
  • 4: AAC LTP (Long Term Prediction)
  • 5: SBR (Spectral Band Replication)
  • 6: AAC Scalable
  • 7: TwinVQ
  • 8: CELP (Code Excited Linear Prediction)
  • 9: HXVC (Harmonic Vector eXcitation Coding)
  • 10: Reserved
  • 11: Reserved
  • 12: TTSI (Text-To-Speech Interface)
  • 13: Main Synthesis
  • 14: Wavetable Synthesis
  • 15: General MIDI
  • 16: Algorithmic Synthesis and Audio Effects
  • 17: ER (Error Resilient) AAC LC
  • 18: Reserved
  • 19: ER AAC LTP
  • 20: ER AAC Scalable
  • 21: ER TwinVQ
  • 22: ER BSAC (Bit-Sliced Arithmetic Coding)
  • 23: ER AAC LD (Low Delay)
  • 24: ER CELP
  • 25: ER HVXC
  • 26: ER HILN (Harmonic and Individual Lines plus Noise)
  • 27: ER Parametric
  • 28: SSC (SinuSoidal Coding)
  • 29: PS (Parametric Stereo)
  • 30: MPEG Surround
  • 31: (Escape value)
  • 32: Layer-1
  • 33: Layer-2
  • 34: Layer-3
  • 35: DST (Direct Stream Transfer)
  • 36: ALS (Audio Lossless)
  • 37: SLS (Scalable LosslesS)
  • 38: SLS non-core
  • 39: ER AAC ELD (Enhanced Low Delay)
  • 40: SMR (Symbolic Music Representation) Simple
  • 41: SMR Main
  • 42: USAC (Unified Speech and Audio Coding) (no SBR)
  • 43: SAOC (Spatial Audio Object Coding)
  • 44: LD MPEG Surround
  • 45: USAC

Sampling Frequencies

There are 13 supported frequencies:

  • 0: 96000 Hz
  • 1: 88200 Hz
  • 2: 64000 Hz
  • 3: 48000 Hz
  • 4: 44100 Hz
  • 5: 32000 Hz
  • 6: 24000 Hz
  • 7: 22050 Hz
  • 8: 16000 Hz
  • 9: 12000 Hz
  • 10: 11025 Hz
  • 11: 8000 Hz
  • 12: 7350 Hz
  • 13: Reserved
  • 14: Reserved
  • 15: frequency is written explictly

Channel Configurations

These are the channel configurations:

  • 0: Defined in AOT Specifc Config
  • 1: 1 channel: front-center
  • 2: 2 channels: front-left, front-right
  • 3: 3 channels: front-center, front-left, front-right
  • 4: 4 channels: front-center, front-left, front-right, back-center
  • 5: 5 channels: front-center, front-left, front-right, back-left, back-right
  • 6: 6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel
  • 7: 8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel
  • 8-15: Reserved

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ffmpeg 是一款非常强大的音视频处理工具,可以用于各种音视频格式的转码、剪辑、合并等操作。它支持多种音视频格式,包括 AAC 音频格式。 如果你遇到了无法解析 AAC 音频格式的问题,可能是因为 ffmpeg 编译时未添加对 AAC 格式的支持。在编译 ffmpeg 时,需要添加相应的编解码库来支持 AAC 格式,如 FAAC、FDK-AAC 等。 如果你已经编译了支持 AAC 格式的 ffmpeg,但仍然无法解析 AAC 音频,可能是因为输入的 AAC 音频文件格式存在问题。在这种情况下,可以尝试使用其他工具AAC 音频文件进行修复或转换,或者尝试使用不同的 AAC 解码器进行解码。 以下是一些常用的 ffmpeg 命令,可以用来处理 AAC 音频文件: 1. 转码为其他格式 ``` ffmpeg -i input.aac -c:a libmp3lame output.mp3 ``` 上述命令将输入的 AAC 音频文件转码为 MP3 格式。 2. 提取音频 ``` ffmpeg -i input.mp4 -vn -acodec copy output.aac ``` 上述命令将从输入的 MP4 视频文件中提取音频,并将音频保存为 AAC 格式。 3. 剪辑音频 ``` ffmpeg -i input.aac -ss 00:00:10 -t 00:00:30 -c copy output.aac ``` 上述命令将从输入的 AAC 音频文件中剪辑出从第 10 秒到第 40 秒的音频,并将音频保存为 AAC 格式。 4. 合并音频 ``` ffmpeg -i "concat:input1.aac|input2.aac" -c copy output.aac ``` 上述命令将合并输入的两个 AAC 音频文件,并将合并后的音频保存为 AAC 格式。注意,在使用 concat 滤镜时,输入文件的编解码器要一致。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值