Introduction
FLV is the video container of Adobe Flash Player, first used by Macromedia in Flash Player 6 and 7. In the 2000s most video on the web, including early YouTube, was delivered as FLV. Flash Player has since been retired, but FLV files remain in archives, and the same tag format is still carried by RTMP live streaming.
Early FLV files held Sorenson Spark or On2 VP6 video with MP3 audio. Later files usually hold H.264 video and AAC audio. The related F4V format is based on MP4 instead.
Structure
An FLV file starts with a 9-byte header: the signature FLV, a version
byte of 1, a flags byte saying whether audio (04) and video
(01) are present, and a 32-bit big-endian header size of 9.
The rest of the file is a series of tags, each preceded by a 32-bit size of the tag
before it (zero for the first). Each tag has an 11-byte header: a type byte (8 for
audio, 9 for
video, 18 for
script data such as the
onMetaData object), a 24-bit data size, a 24-bit timestamp in milliseconds
with an extra byte for its upper bits, and a 24-bit stream ID that is always 0. The tag
data follows. See the file header and
tags for the fields.
An audio tag starts with a byte giving the sound format, rate, sample size and channels; a video tag with a byte giving the frame type and codec. The codec data follows: MP3, ADPCM, Nellymoser, PCM, G.711, AAC or Speex sound, and Sorenson H.263, Screen Video, On2 VP6 or H.264 pictures. Script data tags hold AMF values. Encrypted files mark each protected tag with a filter bit and add a small header to it (Encryption). Enhanced FLV, from the Enhanced RTMP specification, adds codecs named by FourCC (HEVC, AV1, VP9, Opus, FLAC, AC-3 and others), several tracks, multichannel audio and HDR colour information, inside the same tags.
0HeaderFLV, version, flags, header size9 bytes9PreviousTagSize0 always 04 bytes13Tag type, size, timestamp, stream ID, then the data11 bytes + data…PreviousTagSize then the next tagrepeated
Not described
Known, not yet covered
- Viewer: the pictures of HEVC, AV1, VP8, VP9, MPEG-4 Part 2 and ITU H.263 are not decoded (H.264 pictures are: the Video tab draws frames, interlaced streams (MBAFF and field pictures) too, and says why for a stream it cannot decode). Their packets are read as far as the headers, field by field (see what the viewer reads), and what lies beyond is shown as labelled bytes with the reason.
- Viewer: H.264 and HEVC: the CABAC coded slice data (H.264 reads the macroblock layer of I slices coded with CAVLC only, so P and B slices, CABAC, MBAFF pairs, slice groups and data partitions are shown as bytes), the SVC, MVC and 3D extension headers, and SEI payloads other than the common ones. HEVC’s tile syntax is read from the specification but no encoder here writes tiles to test it.
- Viewer: AV1: the tile data, the tile list OBU and metadata of types other than HDR, T.35, scalability and timecode. VP9: the compressed header and the tiles. VP8: the token probability updates (they need the 1056-entry update probability table of RFC 6386) and so everything after them in the first partition, and the macroblock data.
- Viewer: MPEG-4 Part 2: the macroblock data, the complexity estimation header, sprite trajectories and non-rectangular (binary and grayscale) shapes. The standard (ISO/IEC 14496-2) is not free, so the header reader was written from public descriptions and tested against FFmpeg’s encoder, not read from the standard.
- Viewer: ITU H.263: the group of blocks and macroblock layers, the picture header fields of B, Improved PB and enhancement pictures, and reference picture selection and resampling. Sorenson H.263 (CodecID 2) is decoded; ITU H.263 (CodecID 8) is not.
- Viewer: VVC (H.266): the NAL units are named and the configuration record read, but there is no reader for its parameter sets or slices.
- Reference: the encryption (Filter) bit and encryption headers, and the AMF0 markers MovieClip, Undefined, Reference, Unsupported and RecordSet, which are described from memory because Adobe’s FLV specification 10.1 (a PDF) was not opened.
Unknown
- Reference and viewer: the layout of Screen Video 2’s palette information and its IFrameImage combination, which Adobe never published.
- Reference and viewer: device-specific sound (format 15), which is undocumented. Shown as labelled bytes.
- Reference and viewer: Nellymoser has no official specification; it is decoded from a reverse-engineered description that nothing official can confirm.
Links
Software
- VLC media player – free media player that plays FLV files (Windows, macOS, Linux, mobile)
- mpv – free, minimal media player (Windows, macOS, Linux)
- HandBrake – free video converter that turns FLV into MP4 (Windows, macOS, Linux)
- FFmpeg – command-line tools that read, write and convert FLV (Windows, macOS, Linux)
- OBS Studio – free recording and streaming app that can record to FLV (Windows, macOS, Linux)
Developers
- libavformat – FFmpeg’s container library, which reads and writes FLV (C)
Reference
- Adobe Flash Video File Format Specification, version 10.1 – Adobe’s FLV and F4V specification (PDF); FLV is Annex E and its encryption Annex F
- Enhanced RTMP, version 2 – Veovera’s extension of FLV and RTMP: FourCC codecs, multitrack, multichannel audio, ModEx and HDR metadata
- Action Message Format – AMF 0 – Adobe’s specification of the encoding script data tags use (PDF)
- Action Message Format – AMF 3 – Adobe’s specification of AMF’s ActionScript 3 encoding (PDF)