Adobe Flash Video File Format Specification Version 10.1
File Tag包括Tag Header和Tag Data两部分。不同类型的Tag的Header结构是相同的,但是Data结构各不相同
File Tag Header数据。
当前版本的Tag Header结构占用11个字节,如上图绿色部分所示:
第1个字节表示Tag类型,包括音频(0x08)、视频(0x09)和script data(0x12),其他类型值被保留。 即为0x08
第2-4字节为UI24类型的值,表示该Tag Data部分的大小。 即为0x0C=12
第5-7字节为UI24类型的值,表示该Tag的时间戳(单位为ms),第一个Tag的时间戳总是0。即为0x74=116,此时间戳表示解码时间!!!
第8个字节为时间戳的扩展字节,当24位数值不够时,该字节作为最高位将时间戳扩展为32位值。 即为0x00
第9-11字节为UI24类型的值,表示stream id,总是0. 即为0x00
Audio Tag Header数据:
- 第一个字节中的前4个bit表示SoundFormat,即编码格式。
Format of SoundData. The following values are defined:
0 = Linear PCM, platform endian
1 = ADPCM
2 = MP3
3 = Linear PCM, little endian
4 = Nellymoser 16 kHz mono
5 = Nellymoser 8 kHz mono
6 = Nellymoser
7 = G.711 A-law logarithmic PCM
8 = G.711 mu-law logarithmic PCM
9 = reserved
10 = AAC
11 = Speex
14 = MP3 8 kHz
15 = Device-specific sound
Formats 7, 8, 14, and 15 are reserved.
AAC is supported in Flash Player 9,0,115,0 and higher.
Speex is supported in Flash Player 10 and higher.
上图中值为0xA,即音频为AAC编码
- 第一个字节中第5和6 bit表示SoundRate,即采样率
Sampling rate. The following values are defined:
0 = 5.5 kHz
1 = 11 kHz
2 = 22 kHz
3 = 44 kHz
上图中值为3,即采样率为44kHz
- 第一个字节中第7bit表示SoundSize,即采样点的大小
Size of each audio sample. This parameter only pertains to
uncompressed formats. Compressed formats always decode
to 16 bits internally.
0 = 8-bit samples
1 = 16-bit samples
上图中值为1,即16 bit采样
- 第一个字节中第8bit表示SoundType,即声音类型
Mono or stereo sound
0 = Mono sound
1 = Stereo sound
上图中值为1,即为立体声