AAC bug analysis; MP4 container;
来源:互联网 发布:织梦cms模板安装目录 编辑:程序博客网 时间:2024/05/22 17:17
Mediainfo tool is very good, 可以查看视频的 profile codec 等等信息;
http://mediainfo.sourceforge.net/zh-CN/Download/Ubuntu#11.04.i386
http://mediainfo.sourceforge.net/en
http://mediainfo.sourceforge.net/cn
What information can I get from MediaInfo?
- General: title, author, director, album, track number, date, duration...
- Video: codec, aspect, fps, bitrate...
- Audio: codec, sample rate, channels, language, bitrate...
- Text: language of subtitle
- Chapters: number of chapters, list of chapters
- Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB)...
(Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC...) - Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF...
- Subtitles: SRT, SSA, ASS, SAMI...
- Read many video and audio file formats
- View information in different formats (text, sheet, tree, HTML...)
- Customise these viewing formats
- Export information as text, CSV, HTML...
- Graphical Interface, Command Line, or DLL versions available
- Integrate with MS-Windows shell (drag 'n' drop, and Context menu)
- Internationalisation: display any language on any operating system
- Localisation capability (but volunteers needed)
1, AAC, 规格一览
http://zh.wikipedia.org/wiki/AAC
因为"AAC"是一个大家族,他们共分为 9 种规格,以适应不同场合的需要,也正是由于 AAC 的规格(Profile)繁多,导致普通电脑用户感觉十分困扰:
1, MPEG-2 AAC LC 低复杂度规格(Low Complexity)
2, MPEG-2 AAC Main 主规格
3, MPEG-2 AAC SSR 可变采样率规格(Scaleable Sample Rate)
4, MPEG-4 AAC LC 低复杂度规格(Low Complexity),现在的手机比较常见的 MP4 文件中的音频部份就包括了该规格音频文件
5, MPEG-4 AAC Main 主规格
6, MPEG-4 AAC SSR 可变采样率规格(Scaleable Sample Rate)
7, MPEG-4 AAC LTP 长时期预测规格(Long Term Predicition)
8, MPEG-4 AAC LD 低延迟规格(Low Delay)
9, MPEG-4 AAC HE 高效率规格(High Efficiency)
上述的规格中,主规格(Main)包含了除增益控制之外的全部功能,其音质最好,而低复杂度规格(LC)则是比较简单,没有了增益控制,但提高了编码效率,至“SSR”对“LC”规格大体是相同,但是多了增益的控制功能,另外,MPEG-4 AAC/LTP/LD/HE,都是用在低比特率下编码,特别是“HE”是有 Nero ACC 编码器支持,是近来常用的一种编码器,不过通常来说,Main 规格和 LC 规格的音质相差不大,因此目前使用最多的 AAC 规格多数是“LC”规格,因为要考虑手机目前的存储器能力未达合理水平。
MPEG-4 AAC LC (Low Complexity) 是最常用的规格,我们叫“低复杂度规格”,我们简称“LC-AAC”,这种规格在中等码率的编码效率以及音质方面,都能找到平衡点。所谓中等码率,就是指:96kbps-192kbps之间的码率。因此,如果要使用LC-AAC规格,请尽可能把码率控制在之前说的那个区间内。在这个区间内,LC-AAC 可以完全打败同码率的用LAME最高质量慢速编码模式的MP3
2, ADTS(http://honwsn.itpub.net/post/41648/497237) http://wiki.multimedia.cx/index.php?title=ADTS
adts_fixed_header()
{
syncword; 12 bslbf
ID; 1 bslbf
layer; 2 uimsbf
protection_absent; 1 bslbf
profile; 2 uimsbf
sampling_frequency_index; 4 uimsbf
private_bit; 1 bslbf
channel_configuration; 3 uimsbf
original/copy; 1 bslbf
home; 1 bslbf
}
adts_variable_header()
{
copyright_identification_bit; 1 bslbf
copyright_identification_start; 1 bslbf
frame_length; 13 bslbf
adts_buffer_fullness; 11 bslbf
number_of_raw_data_blocks_in_frame; 2 uimsfb
}
详细说明下ADTS头的重要数据部分:
syncword 同步字The bit string ‘1111 1111 1111’,说明一个ADTS帧的开始。
ID MPEG 标示符, 设置为1.
layer Indicates which layer is used. Set to ‘00’
protection_absent 表示是否误码校验
profile 表示使用哪个级别的AAC,profile, the MPEG-4 Audio Object Type minus 1 如01 Low Complexity(LC)--- AACLC
- 1: AAC Main -->>>0
- 2: AAC LC (Low Complexity) -->>>1
- 3: AAC SSR (Scalable Sample Rate) -->>>2
- 4: AAC LTP (Long Term Prediction) -->>>3
sampling_frequency_index 表示使用的采样率下标 sampling_frequency_index sampling frequeny [Hz]
0x0 96000
0x1 88200
0x2 64000
0x3 48000
0x4 44100
0x5 32000
0x6 24000
0x7 22050
0x8 16000
0x9 2000
0xa 11025
0xb 8000
0xc reserved
0xd reserved
0xe reserved
0xf reserved
channel_configuration 表示声道数
frame_length 一个ADTS帧的长度包括ADTS头和raw data block.
adts_buffer_fullness 0x7FF 说明是码率可变的码流
number_of_raw_data_blocks_in_frame
表示ADTS帧中有number_of_raw_data_blocks_in_frame + 1个AAC原始帧.
所以说number_of_raw_data_blocks_in_frame == 0 表示说ADTS帧中有一个AAC数据块并不是说没有。
(一个AAC原始帧包含一段时间内1024个采样及相关数据)
LetterLength (bits)DescriptionA12syncword 0xFFF, all bits must be 1B1MPEG Version: 0 for MPEG-4, 1 for MPEG-2C2Layer: always 0D1protection absent, Warning, set to 1 if there is no CRC and 0 if there is CRCE2profile, the MPEG-4 Audio Object Type minus 1F4MPEG-4 Sampling Frequency Index (15 is forbidden)G1private stream, set to 0 when encoding, ignore when decodingH3MPEG-4 Channel Configuration (in the case of 0, the channel configuration is sent via an inband PCE)I1originality, set to 0 when encoding, ignore when decodingJ1home, set to 0 when encoding, ignore when decodingK1copyrighted stream, set to 0 when encoding, ignore when decodingL1copyright start, set to 0 when encoding, ignore when decodingM13frame length, this value must include 7 or 9 bytes of header length: FrameLength = (ProtectionAbsent == 1 ? 7 : 9) + size(AACFrame)O11Buffer fullnessP2Number of AAC frames (RDBs) in ADTS frame minus 1, for maximum compatibility always use 1 AAC frame per ADTS frameQ16CRC if protection absent is 0
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
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
3, 使用工具mediainfo, bless, and gedit 查找audio的profile 与 channel 等信息;
mediainfo 工具打开, kms2097_I_am_legend_trailer_he_aac.mp4, 然后调出16进制的具体信息, 之后全部copy到gedit里面去;
在gedit里面搜索audioObjectType, 就可以看出“
E2profile, the MPEG-4 Audio Object Type minus 1”信息, 然后,找到其16进制的位置:000060A7 ,
000060A7 AudioSpecificConfig (7 bytes)
000060A7 audioObjectType - 2 - LC (1 bytes)
000060A7 audioObjectType: 2 (0x02)
000060A7 samplingFrequencyIndex: 6 (0x06) - 24000
000060A8 channelConfiguration: 6 (0x06) - Front: L C R, Side: L R, LFE
000060A8 GASpecificConfig (1 bytes)
000060A8 frameLengthFlag: No - 1024 bytes
000060A8 dependsOnCoreCoder: No
000060A8 extensionFlag: No
000060A9 syncExtensionType: 695 (0x02B7)
000060A9 extensionAudioObjectType - 5 - (2 bytes)
000060AA audioObjectType: 5 (0x05)
000060AB sbrPresentFlag: Yes
000060AB extensionSamplingFrequencyIndex: 3 (0x03) - 48000
000060AB syncExtensionType: 1352 (0x0548)
4, mp4 container:
moov mvhd trak tkhd edts elst mdia mdhd minf stbl stsd stco co64 stts stss stsc stsz trak trak ..mdat [data] [data] [...]
5, AAC profile:
http://stackoverflow.com/questions/3987850/mp4-atom-how-to-discriminate-the-audio-codec-is-it-aac-or-mp3
- AAC bug analysis; MP4 container;
- the analysis of some mp4 container boxes(stsd/avcC/stco...)
- 关于AAC封装至MP4
- MPMoviePlayerViewController播放MP4(H264+aac)
- QuickTimer Container(mov/mp4格式)
- linxu mp3转aac, aac转mp3, mp4转mp3 mp4转aac
- MP4中如何获取AAC格式头
- MP4V2 录制mp4(h264+aac)视频
- FFMPEG_avi转码到mp4(aac+h264)源码
- avi转码到mp4(aac+h264)源码分享
- MP4V2 录制mp4(h264+aac)视频
- FFMPEG_avi转码到mp4(aac+h264)源码
- FFMPEG_avi转码到mp4(aac+h264)源码
- MP4V2 录制mp4(h264+aac)视频
- MP4V2 录制mp4(h264+aac)视频
- MP4V2 录制mp4(h264+aac)视频
- FFMPEG_avi转码到mp4(aac+h264)源码
- MP4V2 录制mp4(h264+aac)视频
- java中提供了哪两种多态的机制
- 安卓获取蓝牙状态
- 基于ZF2的开源项目
- Base64算法介绍及android中Base64应用
- DIV居中显示
- AAC bug analysis; MP4 container;
- WEBAPP开发技巧(手机网站开发注意事项)
- Java Map 按key排序和按Value排序
- "30年---我与赛灵思FPGA的故事”:ZYNQ-7000使用总结(8) ——用户IP设计和应用程序设计流程
- 腾讯首发雷霆行动报告 网络黑色产业链呈三大趋势
- poj3682 King Arthur's Birthday Celebration
- 【c++程序】判断数组的排列方式
- Android UI编程(1)——九宫格(GridView)
- 根据验证结果js设置输入焦点(focus)