Adobe Flash Video File Format Specification Version 10.1 ide
File Tag包括Tag Header和Tag Data兩部分。不一樣類型的Tag的Header結構是相同的,可是Data結構各不相同ui
File Tag Header數據。編碼
當前版本的Tag Header結構佔用11個字節,如上圖綠色部分所示:spa
第1個字節表示Tag類型,包括音頻(0x08)、視頻(0x09)和script data(0x12),其餘類型值被保留。 即爲0x09orm
第2-4字節爲UI24類型的值,表示該Tag Data部分的大小。 即爲0x1E=30視頻
第5-7字節爲UI24類型的值,表示該Tag的時間戳(單位爲ms),第一個Tag的時間戳老是0。即爲0x53=83,此時間戳表示解碼時間!!!server
第8個字節爲時間戳的擴展字節,當24位數值不夠時,該字節做爲最高位將時間戳擴展爲32位值。 即爲0x00ip
第9-11字節爲UI24類型的值,表示stream id,老是0. 即爲0x00ci
Video Tag Header數據:it
Type of video frame. The following values are defined:
1 = key frame (for AVC, a seekable frame)
2 = inter frame (for AVC, a non-seekable frame)
3 = disposable inter frame (H.263 only)
4 = generated key frame (reserved for server use only)
5 = video info/command frame
上圖中值爲2,表示inter frame
Codec Identifier. The following values are defined:
2 = Sorenson H.263
3 = Screen video
4 = On2 VP6
5 = On2 VP6 with alpha channel
6 = Screen video version 2
7 = AVC
上圖中值爲7,表示AVC編碼格式
The following values are defined:
0 = AVC sequence header
1 = AVC NALU
2 = AVC end of sequence (lower level NALU sequence ender is
not required or supported)
上圖中值爲1,表示AVC NALU。
IF AVCPacketType == 1, One or more NALUs (Full frames are required)
IF AVCPacketType == 1
Composition time offset
ELSE
0
See ISO 14496-12, 8.15.3 for an explanation of composition
times. The offset in an FLV file is always in milliseconds.
上圖中值爲0xA7=167,則PTS = CTS + DTS, 及PTS = 0xA7 + 0x53 = 0xFA
Video Tag Body