FLV video tag

本文详细解析了FLV文件中的VideoTag结构,包括TagHeader和TagData的具体字段含义及其所代表的信息,例如帧类型、编码格式等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Adobe Flash Video File Format Specification Version 10.1 

File Tag包括Tag HeaderTag Data两部分。不同类型的TagHeader结构是相同的,但是Data结构各不相同

102611_LyeD_2326611.png

File Tag Header数据。

    当前版本的Tag Header结构占用11个字节,如上图绿色部分所示

    第1个字节表示Tag类型,包括音频(0x08)、视频(0x09)和script data(0x12),其他类型值被保留。  即为0x09

    第2-4字节为UI24类型的值,表示该Tag Data部分的大小。 即为0x1E=30

    第5-7字节为UI24类型的值,表示该Tag的时间戳(单位为ms),第一个Tag的时间戳总是0。即为0x53=83,此时间戳表示解码时间!!!

    第8个字节为时间戳的扩展字节,当24位数值不够时,该字节作为最高位将时间戳扩展为32位值。  即为0x00

    第9-11字节为UI24类型的值,表示stream id,总是0. 即为0x00

102620_4YAq_2326611.png

 

Video Tag Header数据:

  • 第一个字节中的前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

102634_17v6_2326611.png

转载于:https://my.oschina.net/u/2326611/blog/679702

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值