当前位置:网站首页>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 .
边栏推荐
- Codeforces Round #797 (Div. 3)无F
- Click QT button to switch qlineedit focus (including code)
- (lightoj - 1349) Aladdin and the optimal invitation (greed)
- Investigation report of bench type Brinell hardness tester industry - market status analysis and development prospect prediction
- 第五章 Yarn资源调度器
- antd upload beforeUpload中禁止触发onchange
- ByteDance new programmer's growth secret: those glittering treasures mentors
- Summary of FTP function implemented by qnetworkaccessmanager
- Anaconda下安装Jupyter notebook
- Submit several problem records of spark application (sparklauncher with cluster deploy mode)
猜你喜欢
CMake速成
【锟斤拷】的故事:谈谈汉字编码和常用字符集
Anaconda下安装Jupyter notebook
Codeforces Round #799 (Div. 4)A~H
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
SF smart logistics Campus Technology Challenge (no T4)
OneForAll安装使用
力扣——第298场周赛
Chapter III principles of MapReduce framework
提交Spark应用的若干问题记录(sparklauncher with cluster deploy mode)
随机推荐
我在字节跳动「修电影」
字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
Chapter 1 overview of MapReduce
新手必会的静态站点生成器——Gridsome
The concept of spark independent cluster worker and executor
Gridhome, a static site generator that novices must know
Chapter 2 shell operation of hfds
Codeforces Round #800 (Div. 2)AC
(lightoj - 1236) pairs forming LCM (prime unique decomposition theorem)
useEffect,函数组件挂载和卸载时触发
Research Report on market supply and demand and strategy of double drum magnetic separator industry in China
MP4格式详解
Market trend report, technological innovation and market forecast of China's double sided flexible printed circuit board (FPC)
第7章 __consumer_offsets topic
SQL快速入门
Acwing: Game 58 of the week
两个礼拜速成软考中级软件设计师经验
antd upload beforeUpload中禁止触发onchange
Market trend report, technological innovation and market forecast of desktop electric tools in China
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines