文档库 最新最全的文档下载
当前位置:文档库 › flv 格式 分析 官方

flv 格式 分析 官方

Video File Format Specification

Version 9

Copyright ? 2008 Adobe Systems Incorporated. All rights reserved. This manual may not be copied, photocopied, reproduced, translated, or converted to any electronic or machine-readable form in whole or in part without written approval from Adobe Systems Incorporated. Notwithstanding the foregoing, a person obtaining an electronic version of this manual from Adobe may print out one copy of this manual provided that no part of this manual may be printed out, reproduced, distributed, resold, or transmitted for any other purposes, including, without limitation, commercial purposes, such as selling copies of this documentation or providing paid-for support services.

Trademarks

Adobe, ActionScript, Flash, Flash Media Server, and Flash Player are either registered trademarks or trademarks of Adobe Systems Incorporated and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Adobe Systems Incorporated or other entities and may be registered in certain jurisdictions including internationally. No right or license is granted to any Adobe trademark.

Third-Party Information

This guide contains links to third-party websites that are not under the control of Adobe Systems Incorporated, and Adobe Systems Incorporated is not responsible for the content on any linked site. If you access a third-party website mentioned in this guide, then you do so at your own risk. Adobe Systems Incorporated provides these links only as a convenience, and the inclusion of the link does not imply that Adobe Systems Incorporated endorses or accepts any responsibility for the content on those third-party sites. No right, license or interest is granted in any third party technology referenced in this guide.

NOTICE: THIS PUBLICATION AND THE INFORMATION HEREIN IS FURNISHED “AS IS”, IS SUBJECT TO CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY KIND (EXPRESS, IMPLIED, OR STATUTORY) WITH RESPECT TO THIS PUBLICATION, AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSES, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.

Adobe Systems Incorporated

Published April 2008

Contents

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 The FLV file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 The F4V file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 1:The FL V File Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . .3

The FLV header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 The FLV file body. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 FLV tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Audio tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 AACAUDIODATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Video tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 AVCVIDEOPACKET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 Data tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 onMetaData. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Chapter 2:The F4V File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 The F4V box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 ftyp box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 moov box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 mvhd box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 trak box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 udta box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 meta box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 mdia box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 minf box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 stbl box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 tkhd box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 mdhd box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 stsd box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 stsc box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 stts box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 ctts box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 stco and co64 boxes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 stss box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27

i

stsz box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 chpl box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 pdin box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 mdat box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 Required structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 Supported media types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Unsupported boxes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32

Chapter 3:F4V Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33

Tag box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 ilst box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 Image metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Text metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 styl box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 hlit box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 hclr box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 krok box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 dlay box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 drpo box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 drpt box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 href box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 tbox box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 blnk box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 twrp box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 ii Contents

Introduction

This document provides technical format information for the video file formats supported by Adobe? Flash? Player software—FLV and F4V.

Adobe seriously considers all feedback to the video file format specification. E-mail any unclear or potentially erroneous information within the specification to Adobe at flashformat@https://www.wendangku.net/doc/da9471002.html,. All such email submissions shall be subject to the Submitted Materials guidelines in the Terms of Use at https://www.wendangku.net/doc/da9471002.html,/misc/copyright.html.

The FLV file format

Starting with SWF files published for Flash Player6, Flash Player can exchange audio, video, and data over RTMP connections with the Adobe Flash Media Server?. One way to feed data to Flash Media Server (and thus on to Flash Player clients) is from files in the FLV file format. Starting with SWF files published for Flash Player7, Flash Player can also play FLV files directly with MIME type video/x-flv.

An FLV file encodes synchronized audio and video streams. The audio and video data within FLV files are encoded in the same way as audio and video within SWF files.

This document describes FLV version 1. For more information on the FLV format, see Chapter 1, “The FLV File Format,” on page3.

The F4V file format

Starting with SWF files published for Flash Player9 Update3 (9,0,115,0), Flash Player can play F4V files. The F4V format is based on the format specified by ISO/IEC 14496-12: ISO base media file format. For more information on the F4V format, see Chapter 2, “The F4V File Format,” on page15.

A large part of the F4V format involves metadata. For more information on F4V metadata, see Chapter 3, “F4V Metadata,” on page33.

1

2Introduction

1 CHAPTER 1

The FLV File Format

Each tag type in an FLV file constitutes a single stream. There can be no more than one audio

and one video stream, synchronized together, in an FLV file. You cannot define multiple independent streams of a single type.

Unlike SWF files, FLV files store multibyte integers in big-endian byte order. For example, as

a UI16 in SWF file format, the byte sequence that represents the number300 (0x12C) is

0x2C0x01; as a UI16 in FLV file format, the byte sequence that represents the number300 is

0x010x2C. Also, FLV files use a 3-byte integer type, UI24, that is not used in SWF files.

3

The FLV header

All FLV files begin with the following header:

FLV header

Field Type Comment

Signature UI8Signature byte always 'F' (0x46) Signature UI8Signature byte always 'L' (0x4C) Signature UI8Signature byte always 'V' (0x56)

Version UI8File version (for example, 0x01 for FLV

version 1)

TypeFlagsReserved UB[5]Must be 0

TypeFlagsAudio UB[1]Audio tags are present TypeFlagsReserved UB[1]Must be 0

TypeFlagsVideo UB[1]Video tags are present

DataOffset UI32Offset in bytes from start of file to start

of body (that is, size of header)

The DataOffset field usually has a value of 9 for FLV version 1. This field is present to accommodate larger headers in future versions.

The FLV file body

After the FLV header, the remainder of an FLV file consists of alternating back-pointers and tags. They interleave as shown in the following table:

FLV file body

Field Type Comment

PreviousTagSize0UI32Always 0

Tag1FLVTAG First tag

PreviousTagSize1UI32Size of previous tag, including its

header. For FLV version 1, this value

is11 plus the DataSize of the previous

tag.

Tag2FLVTAG Second tag

...

4The FLV File Format

FLV tags 5

FLV tags

FLV tags have the following format:

In playback, the time sequencing of FLV tags depends on the FLV timestamps only. Any timing mechanisms built into the payload data format are ignored.

PreviousTagSizeN-1UI32Size of second-to-last tag TagN

FLVTAG Last tag PreviousTagSizeN

UI32

Size of last tag

FLVTAG Field

Type

Comment

TagType

UI8

Type of this tag. Values are:8: audio 9: video

18: script data

all others: reserved

DataSize UI24Length of the data in the Data field Timestamp

UI24

Time in milliseconds at which the data in this tag applies. This value is relative to the first tag in the FLV file, which always has a timestamp of 0.

TimestampExtended UI8

Extension of the Timestamp field to form a UI32 value. This field

represents the upper 8bits, while the previous Timestamp field

represents the lower 24bits of the time in milliseconds.StreamID UI24

Always 0Data

If TagType = 8AUDIODATA If TagType = 9VIDEODATA If TagType = 18

SCRIPTDATAOBJECT

Body of the tag

FLV file body Field

Type

Comment

6

The FLV File Format

Audio tags

Audio tags are similar to the DefineSound tag in the SWF file format. Their payload data is identical except for the additional Nellymoser 8-kHz format, which is not permitted in SWF . (For information on the SWF file format, see the SWF File Format Specification at https://www.wendangku.net/doc/da9471002.html,/go/swf_file_format .)

Format 3, linear PCM, stores raw PCM samples. If the data is 8-bit, the samples are unsigned bytes. If the data is 16-bit, the samples are stored as little endian, signed numbers. If the data is stereo, left and right samples are stored interleaved: left - right - left - right - and so on.

AUDIODATA Field

Type Comment

SoundFormat

(see notes following table)UB[4]

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

14 = MP3 8-Khz

15 = Device-specific sound Format of SoundData Formats 7, 8, 14, and 15 are reserved for internal use Format 10 (AAC) is supported in Flash Player 9,0,115,0 and higher.

SoundRate

UB[2]

0 = 5.5-kHz 1 = 11-kHz 2 = 22-kHz 3 = 44-kHz Sampling rate

For AAC: always 3

SoundSize

UB[1]

0 = snd8Bit 1 = snd16Bit Size of each sample For AAC: always 1SoundType

UB[1]

0 = sndMono 1 = sndStereo

Mono or stereo sound For Nellymoser: always 0For AAC: always 1

SoundData

UI8[size of sound data]

if SoundFormat == 10AACAUDIODATA else

Sound data—varies by format

Format0 PCM is the same as format3 PCM, except that format0 stores 16-bit PCM samples in the endian order of the platform on which the file was created. For this reason, format0 is not recommended for use.

Nellymoser 8-kHz is a special case—the 8-kHz sampling rate is not supported in other formats, and the SoundRate bits can’t represent this value. When Nellymoser 8-kHz mono is specified in SoundFormat, the SoundRate and SoundType fields are ignored. For other Nellymoser sampling rates, specify the normal Nellymoser SoundFormat and use the SoundRate and SoundType fields as usual.

AACAUDIODATA

The AAC format is supported in Flash Player9,0,115,0 and higher.

AACAUDIODATA

Field Type Comment

AACPacketType UI80: AAC sequence header

1: AAC raw

Data UI8[n]if AACPacketType == 0

AudioSpecificConfig

else if AACPacketType == 1

Raw AAC frame data

The AudioSpecificConfig is explained in ISO 14496-3. Note that it is not the same as the contents of the esds box from an MP4/F4V file. This structure is more deeply embedded.

Audio tags7

8The FLV File Format

Video tags

Video tags are similar to the VideoFrame tag in the SWF file format, and their payload data is identical. (For information on the SWF file format, see the SWF File Format Specification at https://www.wendangku.net/doc/da9471002.html,/go/swf_file_format .)

If FrameType =5, instead of a video payload, the message stream contains a UI8 with the following meaning:

■0 = Start of client-side seeking video frame sequence ■

1 = End of client-side seeking video frame sequence

VIDEODATA Field

Type

Comment

FrameType

UB[4]

1: keyframe (for AVC, a seekable frame)

2: inter frame (for AVC, a non-seekable frame)

3: disposable inter frame (H.263 only)

4: generated keyframe (reserved for server use only)

5: video info/command frame CodecID UB[4]

1: JPEG (currently unused)2: Sorenson H.2633: Screen video 4: On2 VP6

5: On2 VP6 with alpha channel 6: Screen video version 27: AVC

VideoData

If CodecID = 2 H263VIDEOPACKET If CodecID = 3 SCREENVIDEOPACKET If CodecID = 4

VP6FLVVIDEOPACKET If CodecID = 5

VP6FLVALPHAVIDEOPACKET If CodecID = 6

SCREENV2VIDEOPACKET if CodecID = 7

AVCVIDEOPACKET

Video frame payload (see note following table)

AVCVIDEOPACKET

An AVCVIDEOPACKET carries a payload of AVC video data.

AVCVIDEOPACKET

Field Type Comment

AVCPacketType UI80: AVC sequence header

1: AVC NALU

2: AVC end of sequence (lower level NALU

sequence ender is not required or supported)

CompositionTime UI24if AVCPacketType == 1

Composition time offset

else

Data UI8[n]if AVCPacketType == 0

AVCDecoderConfigurationRecord

else if AVCPacketType == 1

One or more NALUs (can be individual slices

per FLV packets; that is, full frames are not

strictly required)

else if AVCPacketType == 2

Empty

See ISO 14496-12, 8.15.3 for an explanation of composition times. The offset in an FLV file is always in milliseconds.

See ISO 14496-15, 5.2.4.1 for the description of AVCDecoderConfigurationRecord. This contains the same information that would be stored in an avcC box in an MP4/FLV file. Data tags

Data tags encapsulate single-method invocation, which is usually called on a NetStream object in Flash Player. Data tags are formed from a method name and a set of arguments. SCRIPTDATA

Field Type Comment

Objects SCRIPTDATAOBJECT[]Arbitrary number of

SCRIPTDATAOBJECT structures

End UI24Always 9, also known as a

SCRIPTDATAOBJECTEND

Data tags9

SCRIPTDATAOBJECT and SCRIPTDATAOBJECTEND

A SCRIPTDATAOBJECT record defines object data in ActionScript?. Lists of SCRIPTDATAOBJECT records are terminated by using the SCRIPTDATAOBJECTEND tag.

SCRIPTDATAOBJECT

Field Type Comment

ObjectName SCRIPTDATASTRING Name of the object

ObjectData SCRIPTDATAVALUE Data of the object

SCRIPTDATAOBJECTEND

Field Type Comment

ObjectEndMarker2UI24Always 9

10The FLV File Format

Data tags 11

SCRIPTDATASTRING and SCRIPTDATALONGSTRING

The SCRIPTDATASTRING and SCRIPTDATALONGSTRING records are used to define strings for data tags.

The SCRIPTDATALONGSTRING record can be used to specify strings larger than 65535 characters.

SCRIPTDATAVALUE

A SCRIPTDATAVALUE record represents an abstract definition of an ActionScript value or object. It can contain a list of values, objects, variables, or arrays.

SCRIPTDATASTRING Field

Type

Comment

StringLength UI16String length in bytes StringData

STRING

String data

SCRIPTDATALONGSTRING Field

Type

Comment

StringLength UI32String length in bytes StringData

STRING

String data

SCRIPTDATAVALUE Field

Type

Comment

Type

(see notes following table)

UI8

Type of the variable:0 = Number type 1 = Boolean type 2 = String type 3 = Object type 4 = MovieClip type 5 = Null type

6 = Undefined type

7 = Reference type

8 = ECMA array type 10 = Strict array type 11 = Date type

12 = Long string type ECMAArrayLength If Type = 8, UI32

Approximate number of fields of ECMA array

12The FLV File Format

If Type =8 (ECMA array type), the ECMAArrayLength provides a hint to the software about how many items might be in the array. The array continues until SCRIPTDATAVARIABLEEND appears.

If Type =10 (strict array type), the array begins with a UI32 type and contains that exact number of items. The array does not terminate with a SCRIPTDATAVARIABLEEND tag.

SCRIPTDATAVARIABLE and SCRIPTDATAVARIABLEEND

A SCRIPTDATAVARIABLE record defines variable data in ActionScript. Lists of SCRIPTDATAVARIABLE records are terminated by using the SCRIPTDATAVARIABLEEND tag.

ScriptDataValue

If Type = 0, DOUBLE If Type = 1, UI8

If Type = 2, SCRIPTDATASTRING If Type = 3,

SCRIPTDATAOBJECT[n]

If Type = 4, SCRIPTDATASTRING defining the MovieClip path If Type = 7, UI16If Type = 8,

SCRIPTDATAVARIABLE[ECMAArr ayLength]If Type = 10,

SCRIPTDATAVARIABLE[n]If Type = 11, SCRIPTDATADATE If Type = 12,

SCRIPTDATALONGSTRING

Script data values ScriptDataValueTerminator If Type = 3,

SCRIPTDATAOBJECTEND If Type = 8,

SCRIPTDATAVARIABLEEND

Terminators for Object and Strict array lists

SCRIPTDATAVARIABLE Field

Type

Comment

VariableName SCRIPTDATASTRING Name of the variable VariableData

SCRIPTDATAVALUE

Data of the variable

SCRIPTDATAVALUE Field

Type Comment

onMetaData 13

SCRIPTDATADATE

A SCRIPTDATADATE record defines a particular date and time.

onMetaData

An FLV file can contain metadata with an “onMetaData” marker. Various stream properties are available to a running ActionScript program via the NetStream.onMetaData property. The available properties differ depending on the software used. Common properties include:

■duration : a DOUBLE indicating the total duration of the file in seconds ■width : a DOUBLE indicating the width of the video in pixels ■height : a DOUBLE indicating the height of the video in pixels

■videodatarate : a DOUBLE indicating the video bit rate in kilobits per second ■framerate : a DOUBLE indicating the number of frames per second

videocodecid : a DOUBLE indicating the video codec ID used in the file (see “Video

tags” on page 8 for available CodecID values)

audiosamplerate : a DOUBLE indicating the frequency at which the audio stream is

replayed

■audiosamplesize : a DOUBLE indicating the resolution of a single audio sample ■stereo : a BOOL indicating whether the data is stereo

audiocodecid : a DOUBLE indicating the audio codec ID used in the file (see “Audio

tags” on page 6 for available SoundFormat values)

filesize : a DOUBLE indicating the total size of the file in bytes

SCRIPTDATAVARIABLEEND Field

Type

Comment

VariableEndMarker1

UI24

Always 9

SCRIPTDATADATE Field

Type

Comment

DateTime

DOUBLE Number of milliseconds since Jan 1, 1970 UTC.

LocalDateTimeOffset

SI16

Local time offset in minutes from UTC. For time zones located west of Greenwich, UK, this value is a negative number. Time zones east of Greenwich, UK, are positive.

14The FLV File Format

15

2

CHAPTER 2

The F4V File Format

Flash Player Update 3 (9,0,115,0) and higher can play F4V files. The F4V format is based on the format specified by ISO/IEC 14496-12: ISO base media file format.

Unlike SWF files, F4V files store multibyte integers in big-endian byte order. For example, as a UI16 in SWF file format, the byte sequence that represents the number 300 (0x12C) is 0x2C 0x01; as a UI16 in F4V file format, the byte sequence that represents the number 300 is 0x010x2C.

This chapter discusses all aspects of the F4V format except metadata. For information on metadata, see Chapter 3, “F4V Metadata,” on page 33.

The F4V box

The fundamental building block of an F4V file is a box which has the following BOX format:

Each box structure begins with a BOXHEADER structure:

F4V box Field

Type

Comment

Header BOXHEADER A consistent header that all boxes have Payload

UI8[]

A number of bytes, the length of which is defined by the BOXHEADER

BOXHEADER Field

Type

Comment

TotalSize UI32The total size of the box in bytes, including this header BoxType UI32

The type of atom

ExtendedSize

If TotalSize equals 1UI64

The total 64-bit length of the box in bytes, including this header

Many boxes are well under 4 gigabytes in length and can store their size in the TotalSize field. The format also supports very large boxes by setting the 32-bit TotalSize field to 1 and storing a 64-bit size in ExtendedSize.

Each box is identified with a 32-bit type. For most boxes, this 32-bit type doubles as a human-readable four-character ASCII code or FourCC, such as 'moov' (0x6D6F6F76) and 'mdat' (0x6D646174).

The box payload immediately follows the box header. The size of the payload in bytes is equal to the total size of the box minus either 8 bytes or 16 bytes, depending on the size of the header.

For more information, see section 4.2 of ISO/IEC 14496-12.

ftyp box

The F4V format is based on the ISO MP4 format, which in turn is based on the Apple QuickTime container format. The subsets of the format support different features. The ftyp box helps identify the features that a program must support to play a particular file.

Flash Player does not enforce any restrictions with respect to ftyp boxes. The program tries to play any file it is given, within the restrictions of the codec types it supports.

ftyp box

Field Type Comments

Header BOXHEADER BoxType = 'ftyp' (0x66747970) MajorBrand UI32The primary brand identifier MinorVersion UI32The secondary brand identifier

CompatibleBrands UI32[]Arbitrary number of compatible

brands, until the end of the box

For more information, see section 4.3 of ISO/IEC 14496-12.

16The F4V File Format

相关文档
相关文档 最新文档