当前位置:网站首页>Introduction to FLV documents
Introduction to FLV documents
2022-07-29 01:08:00 【Mr.codeee】
1. brief introduction
FLV yes Adobe A published format that can be used as a live broadcast or an on-demand package , The format is very simple , in FLVTAG There is a form of , And each of these TAG They all exist independently .
2.FLV Introduction to format standards
2.1FLV The file header
| Field | Number of occupancy | explain |
| Signature field | 8 | character "F" (0x46) |
| Signature field | 8 | character "L" (0x4C) |
| Signature field | 8 | character "V" (0x56) |
| edition | 8 | Document version |
| Keep the tag type | 5 | Fixed for 0 |
| Audio tag type | 1 | 1 Show audio labels for |
| Keep the tag type | 1 | Fixed for 0 |
| Video tag type | 1 | 1 Show video tags for |
| Data migration | 32 | Bytes of this header |
Here's what I opened FLV file , see 16 Hexadecimal data .

According to the analysis in the above figure :
- 3 The label of the byte :“F”、“L”、“V”
- 1 Bytes of FLV Document version :0x01
- 5 Bits reserved :00000b
- 1 Bit audio mark bit :1b
- 1 Bits reserved :0b
- 1 Bit video marker bit :1b
- 4 Byte header data offset :0x00 00 00 09
2.2FLV File content format
FLV The contents of the document are as follows :
| Field | Type size | explain |
| the previous TAG Size | 4 byte | Has always been a 0 |
| TAG1 | FLVTAG | first TAG |
| the previous TAG Size | 4 byte | the previous TAG Byte size , Include TAG Of Header+Body,TAG Of Header The size is 11 byte , So for 11 byte +TAG Body Size |
| TAG2 | FLVTAG | the second TAG |
| the previous TAG Size | 4 byte | ......... |
| ......... | 4 byte | ......... |
You can see in the table FLV The format of file content is mainly FLVTAG,FLVTAG In two parts TAGHeader+TAGBody.
As shown in the figure below , I showed an audio TAG, Can see header by 11 byte body by 4 byte , Followed by a 4 Byte size “ the previous TAG Size ”, Values for 15.

The table below for FLVTAG Format analysis of :
| Field | Type size | explain |
| Retain | 2 position | by FMS Retain , by 0 |
| Filter | 1 position | It is mainly used to encrypt the contents of files 0: No preprocessing 1: Preprocessing |
| TAG type | 5 position | 0x08: Audio TAG 0x09: video TAG 0x12: Script data |
| data size | 24 position | TAG Of DATA Size of section |
| Time stamp | 24 position | Display time in milliseconds |
| Extended timestamp | 8 position | Supplementary timestamp added for timestamp |
| flow ID | 24 position | by 0 |
| TAG Of Data | Audio and video media data |
explain :
The size of the timestamp takes 3 Bytes , The biggest expression is 0xFFFFFF(16777215) millisecond , Convert to seconds 16777 second , Approximately equal to 4.66 Hours , If you use FLV The format of , The timestamp used can be stored up to 4.66 Hours .
The extended timestamp size accounts for 1 Bytes , The maximum is 0xFF(255), The extended timestamp makes FLV The original timestamp has been extended , It's not limited to 4.66 Hours , It can also be stored longer , You can probably store 1193 Hours , about 50 God .
2.3VideoTag Data analysis
The data format is shown in the table below :
| Field | Type size | explain |
| The frame type | 4 position | 1: Keyframes 2:P or B frame 3: Applied only to H.263 4: Generate keyframes ( Server usage ) 5: Video information / Command frame |
Code identification | 4 position | 2:Sorenson H.263 3:Screen Video 4:On2 VP6 5: belt Alpha The tunnel On2 VP6 6:Screen Video2 7:H.264 |
| H.264 The package type of | When the code ID is H.264 Time occupation 1 Bytes | 0:H.264 Of Sequence Header 1:NALU 2:H.264 Of Sequence end |
| CTS | When the code ID is H.264 Time occupation 3 Bytes | When encoding using B When the frame ,DTS and PTS It's not equal .CTS Used to represent PTS and DTS Difference between |
| Video data | Video data | Compressed video data |
The detailed explanation is shown in the figure below : Observe the structure on the right tag data()

2.4AudioTag Data analysis
The data format is shown in the table below :
| Field | Type size | explain |
| Sound format | 4 position | I won't list all the details : List a few common 2:MP3 10:AAC 11:Speex |
Audio sampling rate | 2 position | 0:5.5kHz 1:11kHz 2:22kHz 3:44kHz |
| Sample size | 1 position | 0:8 position 1:16 position |
| Audio type | 1 position | 0:Mono sound 1:Stereo sound |
| Audio package type | When the audio is AAC Occupy this byte ,1 Bytes | 0:AAC Sequence Header 1:AAC raw data |
| Audio data | Specific encoded audio data |
The detailed explanation is shown in the figure below : Observe the structure on the right tag data()

2.5ScriptData Data analysis
ScriptData The common way to show is FLV Of MetaData, The data format stored inside is generally AMF data , The table below for ScriptData Storage format .
| Field | Type size | explain |
| type | 8 position | Different values represent AMF Different types of formats 0:Number 1:Boolean 2:String 3:Object 5:Null 6:Undefined 7:Reference 8:ECMA Array 9:Object end marker 10:Strict Array 11:Data 12:Long String |
| data |
3.FLV View tools
边栏推荐
- QT static compiler (MinGW compilation)
- 18张图,直观理解神经网络、流形和拓扑
- y80.第四章 Prometheus大厂监控体系及实战 -- kube-state-metrics组件介绍和监控扩展(十一)
- Mathematical modeling and detailed explanation of basic knowledge (common knowledge points of Chemistry)
- “index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“
- Cloud function realizes website automatic check-in configuration details [web function /nodejs/cookie]
- Plato launched the LAAS protocol elephant swap, which allows users to earn premium income
- ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
- Wechat campus bathroom reservation applet graduation design finished product (5) assignment
- Time series prediction | MATLAB realizes time series prediction of TCN time convolution neural network
猜你喜欢
![“index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“](/img/f2/37a1e65eb1104d72128f96fc5d9c85.png)
“index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“

对接支付宝支付

Summary of process and thread knowledge points 2

Consumer unit

Interview shock 69: is TCP reliable? Why?

How to explain JS' bind simulation implementation to your girlfriend

【Web开发】Flask框架基础知识

Wechat campus bathroom reservation applet graduation design finished product (8) graduation design thesis template

Inftnews | yuanuniverse shopping experience will become a powerful tool to attract consumers

Huawei releases harmonyos 3.0, taking another step towards "Internet of all things"
随机推荐
Selenium docking agent and selenium wire access developer tool network
递归与分治
Some considerations about ThreadPool
Cloud function realizes website automatic check-in configuration details [web function /nodejs/cookie]
新一代超安全蜂窝电池,思皓爱跑上市,13.99万起售
Wechat campus bathroom reservation of small program completion work (6) opening defense ppt
Visual full link log tracking
Connect with Alipay payment
如何给女友讲明白JS的bind模拟实现
小程序毕设作品之微信校园浴室预约小程序毕业设计成品(7)中期检查报告
A new generation of ultra safe cellular battery, Sihao aipao, is on the market, starting from 139900
Huawei releases harmonyos 3.0, taking another step towards "Internet of all things"
【AD学习】本次海上航行器大赛画pcb图的历程
深度学习 | MATLAB实现TCN时间卷积神经网络spatialDropoutLayer参数描述
SQL server only has database files and no log files. The solution to the 1813 error in restoring data times
Station B "crashed" from beginning to end 2021.07.13 we collapsed like this (Reprint)
How to explain JS' bind simulation implementation to your girlfriend
[raspberry pie] how does the windows computer connect with raspberry pie
Main thread and daemon thread
New pseudo personal guide page source code