当前位置:网站首页>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
边栏推荐
- UE4 common printing information methods for debugging
- 如何在WordPress中创建一个自定义404错误页面
- Main thread and daemon thread
- Thread lock and its ascending and descending levels
- Classification prediction | MATLAB realizes time series classification prediction of TCN time convolution neural network
- ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
- [Commons lang3 topic] 005- objectutils topic
- The method of tracking the real-time market of London Silver
- Implement Lmax disruptor queue from scratch (VI) analysis of the principle of disruptor solving pseudo sharing and consumers' elegant stopping
- [untitled]
猜你喜欢

PLATO上线LAAS协议Elephant Swap,用户可借此获得溢价收益
![[unity] configure unity edit C as vscode](/img/f6/5675a96115fb97737c8b36a3fcc6ed.png)
[unity] configure unity edit C as vscode

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

小程序毕设作品之微信校园浴室预约小程序毕业设计成品(8)毕业设计论文模板

【unity】将unity编辑c#配置为vscode

Irregular clipping of NC data with CDO

Consumer unit 消费单元

solidity实现智能合约教程(5)-NFT拍卖合约

Summary of preprocessing methods for time series data

Connect with Alipay payment
随机推荐
Solid smart contract tutorial (5) -nft auction contract
Seven marketing strategies of NFT project
[Commons lang3 topic] 004- numberutils topic
Recursion and divide and conquer
Machine learning | matlab implementation of RBF radial basis function neural network Newrbe parameter setting
对接支付宝支付
A new generation of ultra safe cellular battery, Sihao aipao, is on the market, starting from 139900
[notes for question brushing] specified interval reversal in the linked list
返回*this的成员函数
Summary of preprocessing methods for time series data
Station B "crashed" from beginning to end 2021.07.13 we collapsed like this (Reprint)
一文让你搞懂MYSQL底层原理。-内部结构、索引、锁、集群
Asynchronous mode worker thread
How to explain JS' bind simulation implementation to your girlfriend
消费行业数字化升级成“刚需”,weiit新零售SaaS为企业赋能!
B- 树 ~
QT static compiler (MinGW compilation)
【commons-lang3专题】001-StringUtils 专题
[Yugong series] go teaching course in July 2022, an array of 020 go containers
Interview shock 69: is TCP reliable? Why?