当前位置:网站首页>Detailed explanation of FLV format
Detailed explanation of FLV format
2022-07-06 16:41:00 【Dog egg L】
FLV Format Overview :
FLV(Flash Video) yes Adobe A popular streaming media format designed and developed by the company , Because of its lightweight video file size 、 Simple package and so on , Make it very suitable for application on the Internet . Besides ,FLV have access to Flash Player Play it , and Flash Player Plug ins have been installed in most browsers around the world , This makes it possible to play through the web FLV The video is very easy .
Flv File format
Flv By file header (File Header) and The file body (File Body) form .
Flv Body By a series of Tag form , Every Tag Another one preTagSize Field , Mark the front one Tag Size .
Flv Header
The file header consists of the following parts :
Signature(3 Byte)+Version(1 Byte)+Flags(1 Bypte)+DataOffset(4 Byte)
Signature Occupy 3 Bytes :
Fix FLV Three characters as a symbol . It is generally found that the first three characters are FLV I thought he was flv file .
Version Occupy 1 Bytes :
Mark FLV Version number of . Here we see 1
Flags Occupy 1 Bytes :
Content label . The first 0 Position and number 2 position , respectively video And audio Existing situation .(1 Indicates presence ,0 Does not exist ). notice 0x05, That is to say 00000101, Represents an existing video , There is also audio .
DataOffset Occupy 4 Bytes :
Express FLV Of header length .
The picture below is Flv Header The content of ,(UI8 Indicates no sign 8 position , That's one byte ;UB[5] Represents... In a byte 5 position )
Flv Body
Flv Body One by one Tag form , Every Tag There is one. preTagSize Field , Mark the front one Tag Size .
Tag There are three types ,Audio Tag( Audio Tag),Video Tag( video Tag),script Tag( also called Metadata Tag)
Every Tag from “Tag Header” and “Tag Data” form , For different types of Tag,“Tag Header” The format of is the same ,“Tag Body” The format of is different .
The following figure summarizes the above content , After watching it, right flv There should be an overall understanding .
Generally one flv The file consists of a header message , One script Tag, And several video Tag and audio Tag form .
Let's explain each type of Tag Data
Tag Data
Flv There are three kinds of tag:“Audio Tag Data”、“Video Tag Data”、“Script Tag Data”
Aideo tag By tag Header + Tag Data form :
tag Header:
TagType: 8 (1 byte)
TagType The meaning of the representative is as follows :
8: audio
9 : video
18 : script data
DataSize: 7 (3 bytes)
tag Data size
tag Header size = Previous Tag Size - DataSize
TimeStamp: 0 (3 bytes) Time stamp
TimestampExtended: 0 (1 byte) Extended timestamp
StreamId: 0 (3 bytes) flow ID
Audio Tag Data:
Video tag analysis :
video tag By tag Header + Tag Data form :
tag Header:
TagType: 9 (1 byte)
TagType The meaning of the representative is as follows :
- 8: audio
- 9 : video
- 18 : script data
DataSize: 50 (3 bytes)
tag Data size
tag Header size = Previous Tag Size - DataSize
TimeStamp: 0 (3 bytes) Time stamp
TimestampExtended: 0 (1 byte) Extended timestamp
StreamId: 0 (3 bytes) flow ID
Video Tag Data
scripts tag analysis :
This type of Tag Also commonly known as MetadataTag, Will put some about FLV Metadata information of video and audio, such as :duration、width、height etc. . Usually this type Tag Will follow FileHeader Later as the first Tag appear , And there's only one .
tag Header:
TagType: 18 (1 byte)
TagType The meaning of the representative is as follows :
8: audio
9 : video
18 : script data
DataSize: 293 (3 bytes)
tag Data size
tag Header size = Previous Tag Size - DataSize
TimeStamp: 0 (3 bytes) Time stamp
TimestampExtended: 0 (1 byte) Extended timestamp
StreamId: 0 (3 bytes) flow ID
tag Data:
AMF package : The first byte indicates AMF Packet type 
first AMF package :
The first byte is generally 0x02, Representation string , The first 2-3 Bytes represents the length of the string , It's usually 0x000A, Followed by a string , It's usually "onMetaData".
second AMF package :
The first byte is 0x08, Represents an array , The first 2-5 Bytes represent the number of array elements , Followed by the elements of the array , The format is : Element name length (UI16) + Element name (UI8[n]) + The value of the element (double), Finally “009” ending .
边栏推荐
- antd upload beforeUpload中禁止触发onchange
- Market trend report, technological innovation and market forecast of double door and multi door refrigerators in China
- Li Kou: the 81st biweekly match
- Log statistics (double pointer)
- FLV格式详解
- 力扣——第298场周赛
- Codeforces Round #798 (Div. 2)A~D
- 第2章 HFDS的Shell操作
- 去掉input聚焦时的边框
- (lightoj - 1349) Aladdin and the optimal invitation (greed)
猜你喜欢

Anaconda下安装Jupyter notebook

原生js实现全选和反选的功能 --冯浩的博客

js封装数组反转的方法--冯浩的博客

Spark独立集群Worker和Executor的概念
![Story of [Kun Jintong]: talk about Chinese character coding and common character sets](/img/d5/9a9e3a0ba57328749d80ec71cb9467.png)
Story of [Kun Jintong]: talk about Chinese character coding and common character sets

Codeforces Round #797 (Div. 3)无F
![Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)](/img/92/9465a6c9f1ab88c4851a47fabe750c.jpg)
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)

Codeforces Round #801 (Div. 2)A~C

Codeforces round 797 (Div. 3) no f

Submit several problem records of spark application (sparklauncher with cluster deploy mode)
随机推荐
SQL快速入门
CMake速成
腾讯面试算法题
音视频开发面试题
Problem - 1646C. Factorials and Powers of Two - Codeforces
字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
Oneforall installation and use
JS encapsulates the method of array inversion -- Feng Hao's blog
ByteDance new programmer's growth secret: those glittering treasures mentors
生成随机密码/验证码
Codeforces - 1526C1&&C2 - Potions
QT style settings of qcobobox controls (rounded corners, drop-down boxes, up expansion, editable, internal layout, etc.)
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
我在字节跳动「修电影」
Codeforces Round #800 (Div. 2)AC
Hbuilder x format shortcut key settings
Install Jupiter notebook under Anaconda
第2章 HFDS的Shell操作
Simply try the new amp model of deepfacelab (deepfake)
Problem - 1646C. Factorials and Powers of Two - Codeforces