加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

FLASH FLV及F4V原版官方格式 不必翻译

发布时间:2020-12-15 20:06:33 所属栏目:百科 来源:网络整理
导读:?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Video File Format Specification Versio n 10 C o pyr i ght ? 2008 A dobe S ystems I ncorporated. ? All rights r ese r v ed. This ma n u al m a y not be copie d , photocop i e d, re p r oduc e d, tr
??

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

Video File Format Specification

Version 10


Copyright ? 2008 Adobe Systems Incorporated.?All rights reserved. This manual may not be copied, photocopied, reproduced,translated, or converted to any electronic ormachine-readable form in whole or in part without writtenapproval from AdobeSystems Incorporated. Notwithstanding ?the foregoing, apersonobtaining an electronic version of this manualfrom Adobe may print out one copy of this manual provided that nopart of this manual may beprinted out, reproduced, distributed, resold, ortransmitted for any other purposes, including, without limitation, commercial purposes, such as selling copies of thisdocumentation or providing paid-for support services.

?

Trademarks

Adobe, ActionScript,Flash, Flash Media Server, XMP, and Flash Player are either registered trademarks or trademarks of Adobe Systems Incorporated and may be registered inthe United States orin 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 SystemsIncorporated ?or other entities andmay be registered incertain jurisdictions includinginternationally. No right or license is grantedto any Adobe trademark.

?

Third-Party Information

This guide contains linksto third-party websites that are not under the control of Adobe SystemsIncorporated,?and AdobeSystems Incorporated is not responsible for the content on any linked site. If you access a third-party website mentioned inthis 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 isgranted in any third party technology referenced inthis guide.

?

NOTICE: THIS PUBLICATION AND THE INFORMATION HEREIN ISFURNISHED ?AS IS”, IS SUBJECT TOCHANGE WITHOUT NOTICE, AND SHOULDNOT BE CONSTRUED?AS A COMMITMENT ?BY ADOBESYSTEMS INCORPORATED. ADOBE SYSTEMS INCORPORATED ?ASSUMES NO RESPONSIBILITY ORLIABILITY 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 OFMERCHANTABILITY, FITNESSFOR PARTICULAR PURPOSES, AND NONINFRINGEMENT OFTHIRD PARTY RIGHTS.

?

Adobe Systems Incorporated

?

Published November 2008


?

?

Contents

?

?

?

?

?

?

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ?1

The FLV? file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

The F4V file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

What’s new in Video File Format 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Speex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

XMP ?Metadata .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

?

Chapter 1: The FLV File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

The FLV header .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

The FLV? file body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

FLV? tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Audiotags ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

AUDIODATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

AACAUDIODATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Videotags ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

VIDEODATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

AVCVIDEOPACKET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Data tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 onMetaData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

?

Chapter 2: The F4V File Format. . . . . . . . . . . . . . . . . . . . . . . . . . . 17

The F4V box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 ftyp box .. . .. . . . . . . .. . .. . .. . . . . . . .. . .. . .. . . . . . . .. . .. . .. . . . . . . .. 18moovbox ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 mvhd box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 trak box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 udta box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 meta box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 mdia box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .? 22 minf box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 stblbox ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .? 22 tkhd box?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .? 23 mdhd box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 stsd box? ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

?

?

?

i


?

stsc box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 stts box. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 ctts box? ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 stco and co64 boxes .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 stss box?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 stsz box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 chpl box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 pdin box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .?31 mdat box?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Required structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Supported media types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Unsupported boxes .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

?

Chapter 3: F4V Metadata. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Tag box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 ilst box ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

Imagemetadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Text metadata ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 styl box??. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 hlit box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 hclr box?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 krok box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 dlay?box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 drpo box?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 drpt box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .? 41 href ?box?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .? 41 tbox box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 blnk?box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 twrp box? ?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

XMP ?Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

uuid ?box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

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 considersall feedback to the video file format specification. E-mail any unclear or potentially erroneous information withinthe specification to Adobe at flashformat@adobe.com. ?All such email submissions shall besubject to the SubmittedMaterials guidelines inthe Terms of Use at www.adobe.com/misc/copyright.html.

?

?

The FLV file format

?

Starting with SWF files published for Flash Player 6,Flash Player can exchange audio, video,and data over RTMP connections with the Adobe Flash Media Server?. One way to feed datato Flash Media Server (and thus onto Flash Player clients) is from files inthe FLV file format.Starting with SWF files published for Flash Player 7,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 inthe same way as audio and video within SWF files.

This document describes FLV version 1.For more information ontheFLV format, see

Chapter 1, The FLV File Format, onpage 3.

?

?

The F4V file format

?

Starting with SWF files published for Flash Player 9Update 3 (9,0,115,0), Flash Player canplay F4V files. The F4V format is based onthe 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, onpage 17.

A large part of the F4V format involves metadata. For more information onF4Vmetadata,see Chapter 3, F4V Metadata, onpage35.


?

What’s new in Video File Format 10

?

The following features are new in theFlash video file format specifications (both FLV and

F4V) corresponding to Flash Player 10.

?

?

Speex

?

Flash Player 10 supports the open source Speex audio codec. Speex data can serve as the audio stream in an FLV file. See AUDIODATA?onpage 6.

?

?

XMP ?Metadata

?

The F4V file format supports a box type called 'uuid' which canstore data formatted in Adobes Extensible Metadata Platform (XMP?) and present it to a SWF file via ActionScript?. See “XMP Metadata onpage 43.


?

?

?

?

CHAPTER 1

1

?

The FLV File Format

?

?

?

?

Each tag type in an FLV file constitutes asingle stream. There can be no more than one audioand one video stream, synchronized together, in an FLV file. AnFLV file cannot define multiple independent streams of a single type.

Unlike SWF files, FLV files store multibyte integers inbig-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 FLV file format, the byte sequence that represents thenumber 300 is

0x01 0x2C. Also, FLV files use a3-byte integer type that is not used inSWF files: a UI24 represents anunsigned 24-bit integer.


?

The FLV header

?

All FLV files begin with the following header:

?

FLV ?header

?

Field

?

?

Type

?

?

Comment

Signature

UI8

Signature byte always 'F' (0x46)

Signature

UI8

Signature byte always 'L' (0x4C)

Signature byte always 'V' (0x56)

Version

UI8

File version (for example, 0x01 for FLV

version 1)

TypeFlagsReserved

UB[5]

Must be 0

TypeFlagsAudio

UB[1]

Audio tags are present

TypeFlagsReserved

Must be 0

TypeFlagsVideo

Video tags are present

DataOffset

UI32

Offset in bytes from ?start of file to start of body (that is, size of header)

The DataOffset field usuallyhas a value of9 for FLV version 1. This field is present toaccommodate largerheaders 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

PreviousTagSize0

UI32

Always 0

Tag1

FLVTAG

First tag

PreviousTagSize1

UI32

Size of previous tag, including its header. For ?FLV version 1, this value is 11 plus the DataSize of the previous tag.

Tag2

Second tag

...

?

?


?

FLV ?file body

?

Field

?

?

Type

?

?

Comment

PreviousTagSizeN-1

TagN PreviousTagSizeN

UI32

FLVTAG UI32

Size of second-to-last tag

?

Last tag

?

Size of last tag

?

FLV tags

?

FLV tags have the following format:

?

FLVTAG

?

Field

?

?

Type

?

?

Comment

TagType

UI8

Type of this tag. Values are:

8: audio

9: video

18: script data

all others: reserved

DataSize

UI24

Length 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 SI32 value. This field represents the upper 8 bits, while the previous Timestamp field represents the lower 24 bits ?of the time in milliseconds.

StreamID

Always 0

Data

If TagType == 8

AUDIODATA If TagType == 9

VIDEODATA

If TagType == 18

Body of the tag

SCRIPTDATAOBJECT

?

In playback, thetime sequencing ofFLV tags depends onthe FLV timestamps only. Any timingmechanisms built into the payload data formatare ignored.


?

Audio tags

?

Audio tags are similar to the DefineSound tag inthe SWF file format. Their payload data isidentical except for the additional Nellymoser 8-kHz format,whichis not permittedin SWF. (For information on the SWF file format, see the SWF File Format Specification at www.adobe.com/go/swf_file_format.)

?

?

AUDIODATA

?

AUDIODATA

?

Field

?

?

Type

?

?

Comment

SoundFormat

?

(see notes following

UB[4]

0 = Linear PCM, platform endian

1 = ADPCM

Format of SoundData

?

Formats 7, 8, 14, and 15 are

table)

2 = MP3

3 = Linear PCM, little endian

4 = Nellymoser 16-kHz mono

reserved for internal use

?

AAC is supported in Flash

?

5 = Nellymoser 8-kHz mono

6 = Nellymoser

7 = G.711 A-law logarithmic PCM

Player 9,0,115,0 and higher.

?

Speex is supported in Flash

?

8 = G.711 mu-law logarithmic PCM

9 = reserved

10 = AAC

11 = Speex

14 = MP3 8-Khz

15 = Device-specific sound

Player 10 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. This parameter only pertains to uncompressed formats. Compressed formats always decode to 16 bits internally.

0 = snd8Bit

1 = snd16Bit


?

AUDIODATA

?

Field

?

?

Type

?

?

Comment

SoundType

UB[1]

0 = sndMono

1 = sndStereo

Mono or stereo sound

For ?Nellymoser: always 0

For ?AAC: always 1

SoundData

UI8[size of sound data]

if SoundFormat == 10

AACAUDIODATA

else

Sound data—varies by format

?

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

Format 0PCM is the same as format 3 PCM,except that format 0 stores 16-bit PCM samples inthe endian order of the platformon which the file was created. For this reason,format 0 is not recommended for use.

Nellymoser 8-kHz and 16-kHz are special cases— 8- and 16-kHz sampling rates are not supported in other formats, and the SoundRate bits cant represent this value. WhenNellymoser 8-kHz or Nellymoser 16-kHz is specified inSoundFormat, theSoundRate and SoundType fields are ignored. For other Nellymoser samplingrates, specify the normal Nellymoser SoundFormat and use the SoundRate and SoundType?fields as usual.

If the SoundFormat indicates AAC, the SoundType should be set to 1 (stereo) and the SoundRate should be set to 3 (44 kHz). However, this does not mean that AAC audio in FLV is always stereo, 44kHz data. Instead, the Flash Player ignores these values and extracts the channel and sample rate data is encoded in the AAC bitstream.

For information ?regarding Speex capabilities and limitationswhen stored in a SWF file, seethe SWF File Format Specification.


?

AACAUDIODATA

?

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

?

AACAUDIODATA

?

Field

?

?

Type

?

?

Comment

AACPacketType

UI8

0: AAC sequence header

1: AAC raw

Data

UI8[n]

if AACPacketType == 0

AudioSpecificConfig

else if AACPacketType == 1

Raw AAC frame data

?

The AudioSpecificConfig is explainedin 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.

?

?

Video tags

?

Video tags aresimilar 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 atwww.adobe.com/go/swf_file_format.)


?

VIDEODATA

?

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.263

3: Screen video

4: On2 VP6

5: On2 VP6 with alpha channel

6: Screen video version 2

7: AVC

VideoData

If CodecID == 2

H263VIDEOPACKET

Video frame payload or UI8 (see note following table)

If CodecID == 3

SCREENVIDEOPACKET If CodecID == 4

VP6FLVVIDEOPACKET If CodecID == 5

VP6FLVALPHAVIDEOPACKET If CodecID == 6

SCREENV2VIDEOPACKET

if CodecID == 7

AVCVIDEOPACKET

?

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

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

????? ?1 = End of client-sideseeking video frame sequence


?

AVCVIDEOPACKET

?

An AVCVIDEOPACKET ?carries apayload of AVC video data.

?

AVCVIDEOPACKET

?

Field

?

?

Type

?

?

Comment

AVCPacketType

UI8

0: AVC sequence header

1: AVC NALU

2: AVC end of sequence (lower level ?NALU

sequence ender is not ?required or supported)

CompositionTime

SI24

if AVCPacketType == 1

Composition time offset

else

0

?

Data??????????????????????????????? ?UI8[n]?????????????????????? ?if AVCPacketType == 0

AVCDecoderConfigurationRecordelse if AVCPacketType== 1

One or more NALUs (can be individual slices per FLV packets; that is, full framesarenot ?strictly required)

else ifAVCPacketType == 2

Empty

?

See ISO 14496-12, 8.15.3 for an explanation ofcomposition times. The offset in an FLV fileis always inmilliseconds.

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

?

?

Data tags

?

Data tags encapsulate single-method invocation, which is usually called ona NetStream object inFlash 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

UI24

Always 9, also known as a

SCRIPTDATAOBJECTEND


?

SCRIPTDATAOBJECT and SCRIPTDATAOBJECTEND

A SCRIPTDATAOBJECT record defines objectdata inActionScript. Lists of SCRIPTDATAOBJECT records are terminated by using the SCRIPTDATAOBJECTEND tag.

?

SCRIPTDATAOBJECT

?

Field

?

?

Type

?

?

Comment

ObjectName

?

ObjectData

SCRIPTDATASTRING

?

SCRIPTDATAVALUE

Name of the object

?

Data of the object

?

SCRIPTDATAOBJECTEND

Field

Type

Comment

ObjectEndMarker2

UI24

Always 9


?

SCRIPTDATASTRING and SCRIPTDATALONGSTRING

The SCRIPTDATASTRING and SCRIPTDATALONGSTRING records are used todefinestrings for data tags.

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

?

SCRIPTDATASTRING

?

Field

?

?

Type

?

?

Comment

StringLength

?

StringData

UI16

?

STRING

String length in bytes

?

String data

?

SCRIPTDATALONGSTRING

Field

Type

Comment

StringLength

?

StringData

UI32

?

STRING

String length in bytes

?

String data

?

SCRIPTDATAVALUE

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

?

SCRIPTDATAVALUE

?

Field??????????????????????????????? ?Type????????????????????????????????????? ?Comment


?

Type

?

(see notes following table)


UI8??????????????????????????????????????????????????????????Type ofthe 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 stringtype


?

ECMAArrayLength?????????????? ?If Type = 8, UI32???????????????????????????????? ?Approximate number of fields of ECMA array


?

SCRIPTDATAVALUE

?

Field??????????????????????????????? ?Type????????????????????????????????????? ?Comment


?

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

UI16

If Type == 8

SCRIPTDATAVARIABLE[EC MAArrayLength]

If Type == 10

SCRIPTDATAVARIABLE[n] If Type == 11

SCRIPTDATADATE If Type == 12

SCRIPTDATALONGSTRING


Script data values


?

ScriptDataValueTerminator? ?If Type == 3

SCRIPTDATAOBJECTENDIf Type == 8

SCRIPTDATAVARIABLEEND


Terminators for Object and

Strict array lists


?

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 untilSCRIPTDATAVARIABLEEND appears.

If Type = 10 (strictarray type), the array begins with a UI32 type and contains that exact number of items. Thearray does notterminate with a SCRIPTDATAVARIABLEEND tag.


?

SCRIPTDATAVARIABLE and

SCRIPTDATAVARIABLEEND

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

?

SCRIPTDATAVARIABLE

?

Field

Type

Comment

VariableName

?

VariableData

SCRIPTDATASTRING

?

SCRIPTDATAVALUE

Name of the variable

?

Data of the variable

?

SCRIPTDATAVARIABLEEND

Field

Type

Comment

?

VariableEndMarker1

UI24

Always 9

?

?

SCRIPTDATADATE

A SCRIPTDATADATE?record definesa particular date and time.

?

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.

?

onMetaData

?

An FLV file can contain metadata with an onMetaData marker. Various stream properties are available to a running ActionScriptprogram via the NetStream.onMetaData property. The availableproperties differ dependingon the software used. Common propertiesinclude:

??????? ?duration: a DOUBLE indicating the totalduration of the file in seconds

??????? ?width: a DOUBLE indicating the width of the video inpixels

??????? ?height: a DOUBLE indicating the height of the video inpixels

??????? ?videodatarate: a DOUBLE indicating thevideo bit rate in kilobits per second


?

??????? ?framerate: a DOUBLE indicating the number of frames per second

?????? videocodecid: a DOUBLEindicating the video codec ID used in the file (see Video tags onpage 8for available CodecID values)

?????? audiosamplerate: a DOUBLE indicating the frequency at which the audiostream is replayed

??????? ?audiosamplesize: a DOUBLE indicating theresolution ofa single audio sample

??????? ?stereo: a BOOL indicating whether the data is stereo

?????? audiocodecid: a DOUBLEindicating the audio codec IDused in the file (see Audio tags onpage 6for available SoundFormat ?values)

??????? ?filesize: a DOUBLE indicating the total size ofthe file in bytes


?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

16???????? ?The FLV File Format


?

?

?

?

CHAPTER 2

2

?

The F4V File Format

?

?

?

?

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

Unlike SWF files, F4V files store multibyte integers in big-endianbyte order. For example, asa UI16 in SWF file format, the byte sequence that represents the number 300 (0x12C) is

0x2C 0x01; as aUI16 in F4V file format, the byte sequence that represents the number 300 is

0x01 0x2C.

This chapter discusses all aspectsof the F4V formatexcept metadata. For information on metadata, see Chapter 3,“F4V Metadata, onpage 35.

?

?

The F4V box

?

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

?

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

?

Each box structure begins with a BOXHEADER structure:

BOXHEADER

?

?

Field

Type

Comment

TotalSize

UI32

The total size of the box ?in bytes, including this ?header

BoxType

UI32

The type of atom

ExtendedSize

If TotalSize equals 1

UI64

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


?

Many boxes are wellunder 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 to1 and storing a 64-bit size inExtendedSize.

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

'mdat' (0x6D646174).

The box payload immediatelyfollows the box header. Thesize ofthe payload in bytes is equal to the total size of the box minuseither 8 bytes or16 bytes, depending on the size ofthe header.

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

?

?

ftyp box

?

The F4V formatis based on the ISO MP4 format, which inturn is based onthe Apple QuickTime container format. The subsets ofthe format support different features. The ftyp boxhelps identify the features that a program must support to play a particular file.

Flash Player does not enforce anyrestrictionswith respect toftyp boxes. The program tries toplay 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

UI32

The primary brand identifier

MinorVersion

UI32

The 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.


?

moov box

?

An F4V file must containone and only one moov box. Themoov box is effectively the“header ofan F4V file. The moov box itselfcontains one or more other boxes, which in turn contain other boxes which define the structure of the F4V data.

?

moov box

?

Field

Type

Comment

Header

BOXHEADER

BoxType = 'moov' (0x6D6F6F76)

Boxes

BOX[]

Many other boxes which define the structure

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

?

?

mvhd box

?

An F4V file must containone and only one mvhd box. The mvhd box is contained within a moov box and defines playback information that applies to the entire F4V file.

?

mvhd box

?

Field

?

?

Type

?

?

Comment

Header

BOXHEADER

BoxType = 'mvhd' (0x6D766864)

Version

UI8

Either 0 or 1

Flags

UI24

Reserved, set to 0

CreationTime

if Version == 0

SI32

if Version == 1

The creation time of the F4V file,expressed as seconds elapsed since midnight, January 1, 1904 (UTC)


SI64

?

ModificationTime????????????? ?if Version == 0

SI32

if Version == 1

SI64


?

The last modification time of the F4V file, expressed as seconds elapsed since midnight, January1, 1904 (UTC)


?

TimeScale

SI32

Specifies the time coordinate system

?

for the entire F4V file; for example,

100 indicates the time units are 1/100

second each


?

mvhd box

?

Field

?

?

Type

?

?

Comment

Duration

if Version == 0

SI32

if Version == 1

SI64

The total length of the F4V file presentation with respect to the TimeScale; this ?value is also the duration of the longest track in the file

Rate

SI32

The preferred rate of playback,expressed as a fixed ?point 16.16 number (commonly 0x00010000 =

1.0, or normal playback rate)

Volume

SI16

The master volume of the file, expressed as a fixed point 8.8 number (commonly 0x0100 = 1.0, or full volume)

Reserved

UI16

Reserved, set to 0

UI32[2]

set to 0

Matrix

UI32[9]

Transformation matrix for the F4V file; F4V restricts these values to

{0x00010000, 0, 0, 0,

0x00010000, 0,

0x40000000}

Reserved

UI32[6]

Reserved, set to 0

NextTrackID

UI32

The ID of the next track to be added to the presentation; this ?value may not

be 0 but ?might be all 1’s to indicate an undefined state

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


?

trakbox

?

An F4V file must containone or more trak boxes. Each trak box is contained?within a moov box. Eachtrak box corresponds toan individual media track within the F4V file and contains other boxes which further define theproperties ofthe media track.

?

trak box

?

Field

Type

Comment

Header

BOXHEADER

BoxType = 'trak' (0x7472616B)

Boxes

BOX[]

Arbitrary number of boxes that define the media track

For more information, see section8.4 of ISO/IEC 14496-12.

?

?

udta box

?

The optional udta boxdefines free-form user data. Flash Player does not care what is contained inthisbox. An F4V file cancontain at most one udta box.

?

udta box

?

Field

?

?

Type

?

?

Comment

Header

?

UserData

BOXHEADER

?

UI8[]

BoxType = 'udta' (0x75647461)

?

Free-form user data

For more information,?seesection 8.27 of ISO/IEC 14496-12.

?

?

meta box

?

The optional meta box can contain a variety ofother boxes that carry metadata. An F4V filecancontain at most one meta box.

?

meta box

?

Field

Type

Comment

Header

BOXHEADER

BoxType = 'meta' (0x6D657461)

Boxes

BOX[]

Arbitrary number of boxes that define the file’s metadata

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


?

mdia box

?

Each trak box must containone and only one mdia box. The mdia box contains boxes that define media track properties.

?

mdia box

?

Field

Type

Comment

Header

BOXHEADER

BoxType = 'mdia' (0x6D646961)

Boxes

BOX[]

Arbitrary number of boxes that define media track properties

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读