flv文件格式解读之视频tags

来源:互联网 发布:java abstract关键字 编辑:程序博客网 时间:2024/05/02 02:36

tag类型 0x09

tag数据大小 3个字节的视频数据大小

tag时间戳 3个字节tag数据应用的时间(毫秒)

tag时间戳扩展 1个字节的时间戳扩展,让时间戳变成4字节,本字节作为时间戳的高位.

streamID 3个字节的类id,总是0

视频tags的数据

//-----------------------------------------------------------------------------------------------------------
视频tags的数据:

视频tags数据和swf文件格式中的VideoFrame是相似的.他们的数据是一样的

视频格式的数据的组成如下:

帧类型 4bit

1: 关键帧keyframe(视频中的关键帧,数据存储的是整个画面完整的数据,可以提取它来生成图片)
2: 中间帧inter frame(关键帧之间的状态,不完整的画面数据,需要依靠前面帧的数据生成)
3: 可任意使用的中间帧disposable inter frame(H.263 only)

视频编码id 4bit

2: Sorenson H.263(mencoder转换所使用的视频编码)
3: Screen video
4: On2 VP6
5: On2 VP6 with alpha channel
6: Screen video version 2

//---------------

视频数据

If CodecID = 2
H263VIDEOPACKET
If CodecID = 3
SCREENVIDEOPACKET
If CodecID = 4
VP6FLVVIDEOPACKET
If CodecID = 5
VP6FLVALPHAVIDEOPAC
KET
If CodecID = 6
SCREENV2VIDEOPACKET

//--------------------------------------------------------------------------------------------

这里说一下Sorenson H.263视频编码以及其数据包:

从swf6开始,flash使用被称作Sorenson H.263的视频编码格式,这种格式基于h.263,一个公开视频编码标准由ITU(国际电信联盟)
提出的.想了解h.263编码格式的朋友可以看http://www.chinavideo.org/index.php?option=com_content&task=view&id=123&Itemid=0


但是Sorenson H.263编码和H.263是有差别的:
下面的特性不存在Sorenson H.263中:
■ GOB (group of blocks) layer
■ Split-screen indicator
■ Document camera indicator
■ Picture freeze release
■ Syntax-based arithmetic coding
■ PB frames
■ Continuous-presence multipoint
■ Overlapped block-motion compensation
下面的特性是Sorenson H.263增加的:
■ Disposable frames (difference frames with no future dependencies)
■ Arbitrary picture width and height up to 65535 pixels
■ Unrestricted motion vector support is always on
■ A deblocking flag is available to suggest the use of a deblocking filter

//---------------------------------------------------------------------------------
H263VIDEOPACKET数据结构:

PictureStartCode UB[17]  和H.263 5.1.1相似
    0000 0000 0000 0000 1

Version  UB[5]  视频格式版本
    Flash Player 6 supports 0 and 1
TemporalReference UB[8]  察看 H.263 5.1.2

PictureSize UB[3]  图像尺寸:
    000: custom, 1 byte
    001: custom, 2 bytes
    010: CIF (352x288)
    011: QCIF (176x144)
    100: SQCIF (128x96)
    101: 320x240
    110: 160x120
    111: 保留

CustomWidth   If PictureSize = 000 UB[8]
    If PictureSize = 001 UB[16]
    否则不存在
    注意:UB[16]不一样UI16,这里不是字节交换的
    单位是像素

CustomHeight   If PictureSize = 000 UB[8]
此信息来自〖闪无忧〗
查看原网址:http://www.5uflash.com/Html/fms/220804900.html 

原创粉丝点击