FLV video tag

Adobe Flash Video File Format Specification Version 10.1 ide

File Tag包括Tag HeaderTag Data两部分。不一样类型的TagHeader结构是相同的,可是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

  • 第一个字节中的前4bit表示frame type

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

  • 第一个字节中的后4bit表示CodeID

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编码格式

  • 第二个字节表示AVCPacketType若是是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)

 

  • 第三到五字节表示CompositionTime 若是是AVC编码而且AVCPacketType等于1时,则存在此值

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

相关文章
相关标签/搜索