FLV audio tag
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
Adobe Flash Video File Format Specification Version 10.1?
File Tag包括Tag Header和Tag Data兩部分。不同類型的Tag的Header結(jié)構(gòu)是相同的,但是Data結(jié)構(gòu)各不相同
File Tag Header數(shù)據(jù)。
????當(dāng)前版本的Tag Header結(jié)構(gòu)占用11個(gè)字節(jié),如上圖綠色部分所示:
????第1個(gè)字節(jié)表示Tag類型,包括音頻(0x08)、視頻(0x09)和script data(0x12),其他類型值被保留。? 即為0x08
????第2-4字節(jié)為UI24類型的值,表示該Tag Data部分的大小。 即為0x0C=12
????第5-7字節(jié)為UI24類型的值,表示該Tag的時(shí)間戳(單位為ms),第一個(gè)Tag的時(shí)間戳總是0。即為0x74=116,此時(shí)間戳表示解碼時(shí)間!!!
????第8個(gè)字節(jié)為時(shí)間戳的擴(kuò)展字節(jié),當(dāng)24位數(shù)值不夠時(shí),該字節(jié)作為最高位將時(shí)間戳擴(kuò)展為32位值。? 即為0x00
????第9-11字節(jié)為UI24類型的值,表示stream id,總是0. 即為0x00
Audio Tag Header數(shù)據(jù):
- 第一個(gè)字節(jié)中的前4個(gè)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編碼
- 第一個(gè)字節(jié)中第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
- 第一個(gè)字節(jié)中第7bit表示SoundSize,即采樣點(diǎn)的大小
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采樣
- 第一個(gè)字節(jié)中第8bit表示SoundType,即聲音類型
Mono or stereo sound
0 = Mono sound
1 = Stereo sound
上圖中值為1,即為立體聲
?
轉(zhuǎn)載于:https://my.oschina.net/u/2326611/blog/679704
總結(jié)
以上是生活随笔為你收集整理的FLV audio tag的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于C语言中运算符优先级的一次错误
- 下一篇: 字符串查找KMP算法(转)