FLV
FLV
FLV
Version 10.1
© 2010 Adobe Systems Incorporated and its licensors. All rights reserved.
Adobe Flash Video File Format Specification Version 10.1
This user guide is protected under copyright law, furnished for informational use only, 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 that may appear in the informational content
contained in this guide.
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.
This user guide is licensed for use under the terms of the Creative Commons Attribution Non-Commercial 3.0
License. This License allows users to copy, distribute, and transmit the user guide for noncommercial purposes
only so long as (1) proper attribution to Adobe is given as the owner of the user guide; and (2) any reuse or
distribution of the user guide contains a notice that use of the user guide is governed by these terms. The best way to
provide notice is to include the following link. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/
Adobe, ActionScript, Flash, Flash Media Server, XMP, and Flash Player, are either registered trademarks or
trademarks of Adobe Systems Incorporated in the United States and/or other countries.
All other trademarks are the property of their respective owners.
Updated Information/Additional Third Party Code Information available at http://www.adobe.com/go/thirdparty.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
Notice to U.S. Government End Users: The Software and Documentation are “Commercial Items,” as that term is
defined at 48 C.F.R. §2.101, consisting of “Commercial Computer Software” and “Commercial Computer Software
Documentation,” as such terms are used in 48 C.F.R. §12.212 or 48 C.F.R. §227.7202, as applicable. Consistent with
48 C.F.R. §12.212 or 48 C.F.R. §§227.7202-1 through 227.7202-4, as applicable, the Commercial Computer
Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (a)
only as Commercial Items and (b) with only those rights as are granted to all other end users pursuant to the terms
and conditions herein. Unpublished-rights reserved under the copyright laws of the United States. Adobe agrees to
comply with all applicable equal opportunity laws including, if appropriate, the provisions of Executive Order
11246, as amended, Section 402 of the Vietnam Era Veterans Readjustment Assistance Act of 1974 (38 USC 4212),
and Section 503 of the Rehabilitation Act of 1973, as amended, and the regulations at 41 CFR Parts 60-1 through
60-60, 60-250, and 60-741. The affirmative action clause and regulations contained in the preceding sentence shall
be incorporated by reference.
Edit 47 2010-09-03
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 iii
Contents
Contents
Introduction-----------------------------------------------------------------------------------------------------1
The F4V Video File Format ------------------------------------------------------------------------------------ 1
New in the F4V Video File Format --------------------------------------------------------------------------- 1
The FLV Video File Format ------------------------------------------------------------------------------------ 1
1 The F4V File Format-------------------------------------------------------------------------------------2
1.1 Overview--------------------------------------------------------------------------------------------------- 2
1.2 Simple data types --------------------------------------------------------------------------------------- 2
1.3 F4V box format------------------------------------------------------------------------------------------- 3
1.4 F4V Box Hierarchy --------------------------------------------------------------------------------------- 4
1.5 Sample Description Box Hierarchy ------------------------------------------------------------------ 6
1.6 Handling Unsupported Boxes ----------------------------------------------------------------------- 6
1.7 Ordering of Boxes --------------------------------------------------------------------------------------- 7
1.8 Supported Media Types ------------------------------------------------------------------------------- 7
1.8.1 Supported audio types ------------------------------------------------------------------------------ 7
1.8.2 Supported video types ------------------------------------------------------------------------------ 8
1.8.3 Supported data types-------------------------------------------------------------------------------- 8
2 F4V Box Definitions -------------------------------------------------------------------------------------9
2.1 File Type box --------------------------------------------------------------------------------------------- 9
2.2 Progressive Download Information box------------------------------------------------------------ 9
2.3 Movie box ----------------------------------------------------------------------------------------------- 10
2.4 Movie Header box------------------------------------------------------------------------------------- 10
2.5 Track box ------------------------------------------------------------------------------------------------ 11
2.5.1 Track Header box ----------------------------------------------------------------------------------- 12
2.5.2 Edit box ------------------------------------------------------------------------------------------------ 13
2.5.2.1 Edit List box----------------------------------------------------------------------------------------- 13
2.6 Media box ----------------------------------------------------------------------------------------------- 14
2.6.1 Media Header box ---------------------------------------------------------------------------------- 14
2.6.2 Handler Reference box ---------------------------------------------------------------------------- 15
2.7 Media Information box ------------------------------------------------------------------------------- 16
2.7.1 Video Media Header box-------------------------------------------------------------------------- 16
2.7.2 Sound Media Header box ------------------------------------------------------------------------ 17
2.7.3 Hint Media Header box---------------------------------------------------------------------------- 17
2.7.4 Null Media Header box ---------------------------------------------------------------------------- 18
2.7.5 Data Information box------------------------------------------------------------------------------- 18
2.7.5.1 Data Reference box------------------------------------------------------------------------------- 18
2.7.6 Sample Table box ----------------------------------------------------------------------------------- 19
2.7.6.1 Decoding Time to Sample box----------------------------------------------------------------- 19
2.7.6.2 Composition Time to Sample box ------------------------------------------------------------- 20
2.7.6.3 Sample to Chunk box---------------------------------------------------------------------------- 21
2.7.6.4 Sample Size box ----------------------------------------------------------------------------------- 21
2.7.6.5 Chunk Offset box --------------------------------------------------------------------------------- 22
2.7.6.6 Sync Sample box---------------------------------------------------------------------------------- 22
2.7.6.7 Independent and Disposable Samples box ----------------------------------------------- 23
2.8 Sample Description Box Structure ----------------------------------------------------------------- 24
2.8.1 Sample Description box --------------------------------------------------------------------------- 24
2.8.2 VisualSampleEntry box ---------------------------------------------------------------------------- 24
2.8.3 AudioSampleEntry box ---------------------------------------------------------------------------- 25
2.8.4 MetaDataSampleEntry box ----------------------------------------------------------------------- 26
2.8.5 SampleEntry box ------------------------------------------------------------------------------------ 26
2.8.6 HintSampleEntry box ------------------------------------------------------------------------------ 27
2.8.7 Sample Descriptions for HTTP Streaming with Fragments -------------------------------- 27
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 iv
Contents
Introduction
Flash® is the de facto standard for dynamic media on the Web, supporting a number of media formats, including
two core container formats for delivering synchronized audio and video streams:
- F4V, for H.264/AAC–based content, and
- FLV, for other supported codecs such as Sorensen Spark and On2 VP6.
This document provides the technical format information for the F4V and FLV video file formats supported by
Adobe® products.
Adobe seriously considers all feedback to the specification of the video file format. E-mail any unclear or
potentially erroneous information within the specification to Adobe at [email protected]. All such email
submissions shall be subject to the Submitted Materials guidelines in the Terms of Use at
www.adobe.com/misc/copyright.html.
TimeScale UI32 The time coordinate system for the entire F4V file, in number of time
units per second. For example, 100 indicates the time units are 1/100
second each.
Duration IF Version == 0 The total length of the F4V file presentation, in TimeScale units. This is
UI32 also the duration of the longest track in the file.
IF Version == 1
UI64
Rate SI16.16 The preferred rate of playback, expressed as a fixed point 16.16
number (commonly 0x00010000 = 1.0, or normal playback rate)
Volume SI8.8 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
Reserved UI32 [2] Reserved. Set to 0
Matrix SI32 [9] Transformation matrix for the F4V file, shall be
{0x00010000, 0, 0,
0, 0x00010000, 0,
0, 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
shall not be 0 but may be all 1’s to indicate an undefined state
For more information, see section 8.2.2 of ISO/IEC 14496-12:2008.
CreationTime IF Version == 0 The creation time of the box, expressed as seconds elapsed since
UI32 midnight, January 1, 1904 (UTC)
IF Version == 1
UI64
ModificationTime IF Version == 0 The last modification time of the box, expressed as seconds elapsed
UI32 since midnight, January 1, 1904 (UTC)
IF Version == 1
UI64
TimeScale UI32 The time coordinate system for this track, in number of time units per
second
Duration IF Version == 0 The total duration of this track, in TimeScale units
UI32
IF Version == 1
UI64
Pad UI1 Padding, set to 0
Language UI5 [3] 3-character code specifying language (see ISO 639-2/T), each
character interpreted as 0x60 + (5 bit) code to yield an ASCII character
Reserved UI16 Reserved. Set to 0
For more information, see section 8.4.2 of ISO/IEC 14496-12:2008.
samples that use this sample description. Data references are stored
in Data Reference (dref) boxes.
Predefined UI16 Set to 0
Reserved UI16 Set to 0
Predefined UI32 [3] Set to 0
Width UI16 Max visual width (in pixels) from codec
Height UI16 Max visual height (in pixels) from codec
HorizResolution UI16.16 Resolution of the image pixels/inch, default value 0x00480000 (72
dpi)
VertResolution UI16.16 Resolution of the image pixels/inch, default value 0x00480000 (72
dpi)
Reserved UI32 Set to 0
FrameCount UI16 How many frames are stored in each sample, default value 1 (one
frame per sample)
CompressorName UI8 [32] Name of the compressor (for informative purpose only). First byte is
set to the number of bytes of displayable data that follows first byte.
Depth UI16 Bit depths. Default value 0x0018 (colors w/o alpha)
Predefined SI16 Set to -1
Boxes BOX [ ] Additional boxes as specified for the media type, or encryption
The details of the entries contained in these boxes, and the mechanism used by the DRM client to retrieve the keys
are outside the scope of this specification.
akey box
Field Type Comment
Header BOXHEADER BoxType = 'akey'
Version UI8 Shall be 1
Flags UI24 Shall be 0
Params IF AdobeDRMHeaderBox.Version == 1
APSParamsBox APSParamsBox is not described in this
ELSE document as it will no longer be produced by
FMRMSv2ParamsBox conforming applications
IVLength UI8 The size of the initialization vector in bytes. This length should be
consistent with the algorithms used. Shall be 16 (128 bits)
Each AFRAENTRY points to a sample within this fragment, and has the following format:
AFRAENTRY
Field Type Comment
Time UI64 The presentation time of the random access sample, in
TimeScale units
Offset IF LongOffsets == 0 The byte offset from the beginning of this Fragment
UI32 Random Access box to the sample
ELSE
UI64
Each GLOBALAFRAENTRY points to a sample outside this fragment, and has the following format:
GLOBALAFRAENTRY
Field Type Comment
Time UI64 The presentation time of the random access sample, in
TimeScale units
Segment IF LongIDs == 0 The number of the segment containing this random access
UI16 point
ELSE
UI32
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 39
F4V Box Definitions
Fragment IF LongIDs == 0 The number of the fragment containing this random access
UI16 point
ELSE
UI32
AfraOffset IF LongOffsets == 0 The byte offset from the beginning of the containing segment
UI32 to the afra box associated with this random access point
ELSE
UI64
OffsetFromAfra IF LongOffsets == 0 The byte offset from the associated afra box to the sample
UI32
ELSE
UI64
SampleCompositionTimeOffset IF Flags & 0x000800 == true Optional. The composition time offset for
UI32 each sample. If not present, default is used.
2.13.1.1 AdobeMuxHintSample
A collection of AdobeMuxHintSamples makes up a hint track that is in the Adobe Multiplexed Hint Track Format.
An AdobeMuxHintSample has the following layout:
AdobeMuxHintSample
Field Type Comment
PacketCount IF PacketCountField == 1 Number of AdobeMuxPacket entries in this
UI8 AdobeMuxHintSample. When PacketCountField == 0,
AdobeMuxPackets are self-describing and the number can
be implicitly determined.
Packets AdobeMuxPacket [PacketCount] Array of AdobeMuxPacket elements
2.13.1.2 AdobeMuxPacket
An AdobeMuxPacket has the following layout. The part up to and including EncryptionHeader is identical to the
corresponding part in the FLVTAG defined in Section E.4.1.
AdobeMuxPacket
Field Type Comment
Reserved UI2 Reserved for FMS, should be 0
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 49
F4V Box Definitions
2.13.1.3 AdobeMuxHintConstructor
An AdobeMuxHintConstructor has the following layout:
AdobeMuxHintConstructor
Field Type Comment
Mode If ModeField == 1 Hint track mode being used.
UI8 When ModeField == 0, the mode can be
determined from the Adobe Mux Hint Process
(amhp) box.
HintInfo If Mode == 2 As indicated by mode. Although there are three
AdobeMuxHintSampleConstructor hinting modes defined, only two Constructors are
ELSE specified since both the Immediate and the
Immediate noDuplication modes use the
AdobeMuxHintImmediateConstructor
AdobeMuxHintImmediateConstructor.
2.13.1.4 AdobeMuxHintImmediateConstructor
The AdobeMuxHintImmediateConstructor shall be used in the Immediate and Immediate NoDuplication modes.
These modes are described in the Adobe Multiplexed Hint Track Format.
The AdobeMuxHintImmediateConstructor has the following layout:
AdobeMuxHintImmediateConstructor
Field Type Comment
Length If LengthField == 1 Number of bytes to take from the data that follows.
UI24 If LengthField == 0, this field is not present, and the length
is computed from AdobeMuxPacket.DataSize.
Data UI8 [Length] Bytes of data to place into the payload portion
2.13.1.5 AdobeMuxHintSampleConstructor
The AdobeMuxHintSampleConstructor shall be used in the sample mode. The sample mode is described in the
Adobe Multiplexed Hint Track Format.
An AdobeMuxHintSampleConstructor has the following layout:
AdobeMuxHintSampleConstructor
Field Type Comment
TrackRefIndex SI8 Value that indicates which track the sample data will come
from. A value of 0 means that exactly one media track is
referenced. Values from 1 to 127 are indexes into the Hint
track reference Atom entries. These values indicate which
original media track the sample is to be read from. A value of
-1 means the hint track itself. That is, get the sample from
the same track as the hint sample you are currently parsing.
Length UI24 Number of bytes in the sample to copy.
LengthField shall be 1 for Mode == 2.
SampleNumber UI32 Sample number of the track.
SampleOffset UI32 Offset from the start of the sample to the point where to start
copying
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 51
F4V Box Definitions
The mfra box should be last in the file. The last box within the mfra box provides a copy of the length field from the
mfra box.
mfra box
Field Type Comment
Header BOXHEADER BoxType = 'mfra' (0x6D667261)
Boxes BOX [ ] Arbitrary number of boxes that define the random access points
For more information, see section 8.8.9 of ISO/IEC 14496-12:2008.
UI64
MoofOffset IF Version == 0 The byte-offset of the corresponding Movie
UI32 Fragment box, from the beginning of the file
IF Version == 1
UI64
TrafNumber { UI8, UI16, UI24, UI32 } Traf number containing the random
[LengthSizeTrafNumMinus1] accessible sample. The first traf in each moof is
numbered 1. Type is one of UI8, UI16, UI24,
UI32 indexed by LengthSizeTrafNumMinus1
TrunNumber { UI8, UI16, UI24, UI32 } Trun number containing the random
[LengthSizeTrunNumMinus1] accessible sample. The first trun in each traf is
numbered 1.
SampleNumber { UI8, UI16, UI24, UI32 } Sample number containing the random
[LengthSizeSampleNumMinus1] accessible sample. The first sample in each
trun is numbered 1.
For more information, see section 8.8.10 of ISO/IEC 14496-12:2008.
3 F4V Metadata
This section describes the metadata supported by the F4V file format
XMPMetadata UI8 [ ] XMP metadata, formatted according to the XMP metadata standard
ilst box
Field Type Comment
Header BOXHEADER BoxType = 'ilst' (0x696C7374)
TagCount UI32 The number of tags enumerated in the ilst box
Tags TAGRECORD [TagCount] A number of TAGRECORD entries
Each TAGRECORD has the following layout:
TAGRECORD
Field Type Comment
TagLength UI32 The total length of the TAGRECORD, including this length field
TagName UI8 [4] 4 bytes indicating the name of the tag. These bytes usually come from the
human-readable ASCII set, but not always
DataLength UI32 The total length of the data portion of the TAGRECORD
DataTag UI8 [4] The 4 bytes 'd', 'a', 't', and 'a' to indicate the data portion of the TAGRECORD
DataType UI32 Specifies the type of data in the data payload of the TAGRECORD
Reserved UI32 Reserved, set to 0
Payload UI8 [ ] An arbitrary number of bytes occupying the remainder of the TAGRECORD.
The precise payload format is dependent on the DataType
The supported values for the DataType are:
- 0: custom data. In the case of 'trkn' and 'disk' tag types, the data payload is interpreted as a single UI32
- 1: text data
- 13, 14: binary data
- 21: generic data
tbox box
Field Type Comment
Header BOXHEADER BoxType = 'tbox' (0x74626F78)
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 59
F4V Metadata
Top UI16 The top pixel coordinate, exposed to ActionScript via a DOUBLE property
named top
Left UI16 The left pixel coordinate, exposed to ActionScript via a DOUBLE property
named left
Bottom UI16 The bottom pixel coordinate, exposed to ActionScript via a DOUBLE property
named bottom
Right UI16 The right pixel coordinate, exposed to ActionScript via a DOUBLE property
named right
blnk box
Field Type Comment
Header BOXHEADER BoxType = 'blnk' (0x626C6E6B)
StartChar UI16 The first character in the blinking range, exposed to ActionScript via a
DOUBLE property named startchar
EndChar UI16 The ending character in the blinking range, exposed to ActionScript via a
DOUBLE property named endchar
This section should be read in conjunction with ISO 14496-12:2008 Section 8.12 (Support for Protected Streams).
It is critical that the reader understand the above file format before reading the next sections.
Figure 1 illustrates how the protection information is stored in F4V. In the example, placing a Protection Scheme
Info (sinf) box into each track's sample description entry, and specifying Adobe's DRM identifier as the key/rights
management system, protects the audio and video tracks.
The sinf box is per sample entry in a sample description box. While it is possible to have more than one sample
entry within a sample description box (there can be only one sample description box per track), this is not very
common. Hence, the above diagram only shows one sinf box per track. However, as it is possible to have more than
one per track, both the DRM packager and DRM decoder should be able to handle the case.
The above specified access unit header shall be added to every sample whose sample description entry has DRM
turned on (i.e. has a Protection Scheme Info (sinf) box present), even when the particular sample is not encrypted.
The header is the only way the decoder knows whether a particular sample is encrypted or not (in case
SelectiveEncryption is 1). Selective encryption of samples can improve performance, when only critical Keyframes
are encrypted.
The size of the padding can be determined unambiguously from a padded block since all the input is padded,
including input values that are already a multiple of the block size, and no padding sequence is a suffix of another.
The last octet indicates how many octets to trim.
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 68
The FLV File Format
E.4.2.1 AUDIODATA
The AudioTagHeader contains audio-specific metadata.
AudioTagHeader
Field Type Comment
SoundFormat UB [4] Format of SoundData. The following values are defined:
0 = Linear PCM, platform endian
(See notes following 1 = ADPCM
table, for special 2 = MP3
encodings) 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
11 = Speex
14 = MP3 8 kHz
15 = Device-specific sound
Formats 7, 8, 14, and 15 are reserved.
AAC is supported in Flash Player 9,0,115,0 and higher.
Speex is supported in Flash Player 10 and higher.
SoundRate UB [2] Sampling rate. The following values are defined:
0 = 5.5 kHz
1 = 11 kHz
2 = 22 kHz
3 = 44 kHz
SoundSize UB [1] Size of each audio sample. This parameter only pertains to
uncompressed formats. Compressed formats always decode
to 16 bits internally.
0 = 8-bit samples
1 = 16-bit samples
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 71
The FLV File Format
E.4.2.2 AACAUDIODATA
The AAC format is supported in Flash Player 9,0,115,0 and higher.
AACAUDIODATA
Field Type Comment
Data IF AACPacketType == 0 The AudioSpecificConfig is defined in ISO
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 72
The FLV File Format
E.4.3.1 VIDEODATA
The VideoTagHeader contains video-specific metadata.
VideoTagHeader
Field Type Comment
Frame Type UB [4] 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
CodecID UB [4] 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
AVCPacketType IF CodecID == 7 The following values are defined:
UI8 0 = AVC sequence header
1 = AVC NALU
2 = AVC end of sequence (lower level NALU sequence ender is
not required or supported)
CompositionTime IF CodecID == 7 IF AVCPacketType == 1
SI24 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.
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 73
The FLV File Format
The VIDEODATA segment contains video metadata, optional encryption metadata, and the video payload.
VIDEODATA
Field Type Comment
IF Encrypted See Annex F. FLV Encryption for details.
Body EncryptedBody VideoTagBody encrypted as specified in Section F.3.3.
ELSE
Body VideoTagBody
E.4.3.2 AVCVIDEOPACKET
An AVCVIDEOPACKET carries a payload of AVC video data.
AVCVIDEOPACKET
Field Type Comment
Data IF AVCPacketType == 0
AVCDecoderConfigurationRecord
IF AVCPacketType == 1
One or more NALUs (Full frames are required)
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.
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 74
The FLV File Format
E.4.4.1 SCRIPTDATA
The SCRIPTDATA segment contains optional encryption metadata, and the script payload.
SCRIPTDATA
Field Type Comment
IF Encrypted See Annex F. FLV Encryption for details.
Body EncryptedBody ScriptTagBody encrypted as specified in Section F.3.3.
ELSE
Body ScriptTagBody
The ScriptTagBody contains SCRIPTDATA encoded in the Action Message Format (AMF), which is a compact
binary format used to serialize ActionScript object graphs. The specification for AMF0 is available at:
http://opensource.adobe.com/wiki/display/blazeds/Developer+Documentation
ScriptTagBody
Field Type Comment
Name SCRIPTDATAVALUE Method or object name. SCRIPTDATAVALUE.Type = 2 (String)
Value SCRIPTDATAVALUE AMF arguments or object properties.
SCRIPTDATAVALUE.Type = 8 (ECMA array)
E.4.4.2 SCRIPTDATAVALUE
A SCRIPTDATAVALUE record contains a typed ActionScript value.
SCRIPTDATAVALUE
Field Type Comment
Type UI8 Type of the ScriptDataValue.
The following types are defined:
0 = Number
1 = Boolean
2 = String
3 = Object
4 = MovieClip (reserved, not supported)
5 = Null
6 = Undefined
7 = Reference
8 = ECMA array
9 = Object end marker
10 = Strict array
11 = Date
12 = Long string
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 75
The FLV File Format
E.4.4.3 SCRIPTDATADATE
A SCRIPTDATADATE record stores 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.
E.4.4.4 SCRIPTDATAECMAARRAY
A SCRIPTDATAECMAARRAY record stores an ECMA array. An ECMA Array is an associative array, and shall
be used when an ActionScript Array contains non-ordinal indices. All indices, ordinal or otherwise, are strings
instead of integers. For the purposes of serialization, this type is very similar to an anonymous ActionScript Object.
The list contains approximately ECMAArrayLength number of items. A SCRIPTDATAOBJECTEND record
follows the list of items.
SCRIPTDATAECMAARRAY
Field Type Comment
ECMAArrayLength UI32 Approximate number of items in ECMA array
Variables SCRIPTDATAOBJECTPROPERTY [ ] List of variable names and values
List Terminator SCRIPTDATAOBJECTEND List terminator
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 76
The FLV File Format
E.4.4.5 SCRIPTDATALONGSTRING
SCRIPTDATASTRING and SCRIPTDATALONGSTRING records store strings.
SCRIPTDATALONGSTRING
Field Type Comment
StringLength UI32 StringData length in bytes
StringData STRING String data, with no terminating NUL
E.4.4.6 SCRIPTDATAOBJECT
A SCRIPTDATAOBJECT record encodes the properties of an anonymous ActionScript object. A
SCRIPTDATAOBJECTEND record follows the list of properties.
SCRIPTDATAOBJECT
Field Type Comment
ObjectProperties SCRIPTDATAOBJECTPROPERTY [ ] List of object properties
List Terminator SCRIPTDATAOBJECTEND List terminator
E.4.4.7 SCRIPTDATAOBJECTEND
The SCRIPTDATAOBJECTEND record terminates a list of SCRIPTDATAOBJECTPROPERTY records. The
SCRIPTDATAOBJECTEND record is a SCRIPTDATAOBJECTPROPERTY record with a zero-length string and
an Object end marker.
SCRIPTDATAOBJECTEND
Field Type Comment
ObjectEndMarker UI8 [3] Shall be 0, 0, 9
E.4.4.8 SCRIPTDATAOBJECTPROPERTY
A SCRIPTDATAOBJECTPROPERTY record defines an object property of an ActionScript object or a variable of
associated array.
SCRIPTDATAOBJECTPROPERTY
Field Type Comment
PropertyName SCRIPTDATASTRING Name of the object property or variable
PropertyData SCRIPTDATAVALUE Value and type of the object property or variable
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 77
The FLV File Format
E.4.4.9 SCRIPTDATASTRICTARRAY
A SCRIPTDATASTRICTARRAY record stores a strict array. A strict array contains only ordinal indices, which
are implied, not stored in the record. The indices can be dense or sparse. Undefined entries in the sparse regions
between indices shall be serialized as undefined. The list shall contain StrictArrayLength number of values. No
terminating record follows the list.
SCRIPTDATASTRICTARRAY
Field Type Comment
StrictArrayLength UI32 Number of items in the array
StrictArrayValue SCRIPTDATAVALUE [ StrictArrayLength ] List of typed values
E.4.4.10 SCRIPTDATASTRING
SCRIPTDATASTRING and SCRIPTDATALONGSTRING records store strings.
The SCRIPTDATASTRING record may be used for strings no longer than 65535 characters.
SCRIPTDATASTRING
Field Type Comment
StringLength UI16 StringData length in bytes.
StringData STRING String data, up to 65535 bytes, with no terminating NUL
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 78
The FLV File Format
E.5 onMetaData
The FLV metadata object shall be carried in a SCRIPTDATA tag named onMetadata. Various properties are
available to a running ActionScript program via the NetStream.onMetaData property. The available properties
differ depending on the software creating the FLV file. Typical properties include:
onMetadata properties
Property Name Type Comment
audiocodecid Number Audio codec ID used in the file (see E.4.2.1 for available SoundFormat values)
audiodatarate Number Audio bit rate in kilobits per second
audiodelay Number Delay introduced by the audio codec in seconds
audiosamplerate Number Frequency at which the audio stream is replayed
audiosamplesize Number Resolution of a single audio sample
canSeekToEnd Boolean Indicating the last video frame is a key frame
creationdate String Creation date and time
duration Number Total duration of the file in seconds
filesize Number Total size of the file in bytes
framerate Number Number of frames per second
height Number Height of the video in pixels
stereo Boolean Indicating stereo audio
videocodecid Number Video codec ID used in the file (see E.4.3.1 for available CodecID values)
videodatarate Number Video bit rate in kilobits per second
width Number Width of the video in pixels
The filter parameters for (non-selective) encryption are defined in EncryptionFilterParams. All packets with this
field shall be encrypted.
EncryptionFilterParams
Field Type Comment
IV UI8 [16] Contains 16 bytes of IV data for AES-CBC.
F.3.3.1 Padding
All encrypted samples shall be padded to a multiple of the block cipher’s block length.
The padding scheme shall be as described in RFC 2630, which is reproduced here:
Block ciphers expect the input data to be a multiple of k octets (in case of AES 128, a multiple of 16 octets), where k
is greater than 1. For such algorithms, the input shall be padded at the trailing end with k - (length mod k) octets all
having the value k - (length mod k), where length is the length of the input.
The padding brings the block size to the next integral multiple of the block cipher’s block length. The padding is
present even when the plaintext is evenly divisible by the block length.
ADOBE FLASH VIDEO FILE FORMAT SPECIFICATION VERSION 10.1 83
FLV Encryption
EXAMPLE: If k is 16 bytes and length is 32 bytes, the padding is 16 bytes long containing 0x10, and the block size
is 48 bytes.