FLV文件分析
很久没看,做下关于FLV文件格式知识点回顾!
一、简单介绍

二、FLV文件头
FLV Header 官方协议文档定义如下:

针对FLV Header相关字段,解释下其中的含义:

46 4c 56 01 05 20 20 20 09 //就代表该FLV文件包含音频、视频
二、FLV文件Body
FLV Body 官方协议文档定义如下:


针对FLV Body相关字段,解释下其中的含义:

2.1 FLV Tag

针对FLV Tag相关字段,解释下其中含义:

2.2 Tag data
2.2.1 Audio data tags(音频数据tag)
AUDIODATA官方协议文档定义如下:


针对AUDIODATA相关字段,解释下其中的含义:

AACAUDIODATA官方协议定义如下:

其中如果AACPacketType==0时,AudioSpecificConfig结构在ISO 14496-3文档中有定义该结构,部分结构如下图:
AudioSpecificConfig() {
audioObjectType = GetAudioObjectType();
samplingFrequencyIndex; // 4 bslbf
if (samplingFrequencyIndex == 0xf) {
samplingFrequency; // 24 uimsbf
}
channelConfiguration; // 4 bslbf
sbrPresentFlag = -1;
psPresentFlag = -1;
if (audioObjectType == 5 || audioObjectType == 29) {
// ...
}
else {
extensionAudioObjectType = 0;
}
switch (audioObjectType) {
case 1: case 2: case 3: case 4: //...
GASpecificConfig();
break:
case ...:
//...
}
if (extensionAudioObjectType != 5 && bits_to_decode() >= 16) {
//...
}
GetAudioObjectType() {
audioObjectType; // 5 uimsbf
if (audioObjectType == 31) {
audioObjectType = 32 + audioObjectTypeExt; // 6 uimsbf
}
return audioObjectType;
}
2.2.2 Video data tags(视频数据Tag)

针对VIDEODATA相关字段,解释下其中的含义:

AVCVIDEOPACKET官方协议定义如下:

其中如果是AVCPacketType==0时,即AVC sequence header,AVCDecoderConfigurationRecord在ISO 14496-15中定义如下:
aligned(8) class AVCDecoderConfigurationRecord {
unsigned int(8) configurationVersion = 1;
unsigned int(8) AVCProfileIndication;
unsigned int(8) profile_compatibility;
unsigned int(8) AVCLevelIndication;
bit(6) reserved = '111111'b;
unsigned int(2) lengthSizeMinusOne;
bit(3) reserved = '111'b;
unsigned int(5) numOfSequenceParameterSets;
for (i = 0; i < numOfSequenceParameterSets; i++) {
unsigned int(16) sequenceParameterSetLength ;
bit(8*sequenceParameterSetLength) sequenceParameterSetNALUnit;
}
unsigned int(8) numOfPictureParameterSets;
for (i = 0; i < numOfPictureParameterSets; i++) {
unsigned int(16) pictureParameterSetLength;
bit(8*pictureParameterSetLength) pictureParameterSetNALUnit;
}
if (profile_idc == 100 || profile_idc == 110 ||
profile_idc == 122 || profile_idc == 144)
{
bit(6) reserved = '111111'b;
unsigned int(2) chroma_format;
bit(5) reserved = '11111'b;
unsigned int(3) bit_depth_luma_minus8;
bit(5) reserved = '11111'b;
unsigned int(3) bit_depth_chroma_minus8;
unsigned int(8) numOfSequenceParameterSetExt;
for (i = 0; i < numOfSequenceParameterSetExt; i++) {
unsigned int(16) sequenceParameterSetExtLength;
bit(8*sequenceParameterSetExtLength) sequenceParameterSetExtNALUnit;
}
}
}
如果是H265,HEVCDecoderConfigurationRecord定义如下:
aligned(8) class HEVCDecoderConfigurationRecord {
unsigned int(8) configurationVersion = 1;
unsigned int(2) general_profile_space;
unsigned int(1) general_tier_flag;
unsigned int(5) general_profile_idc;
unsigned int(32) general_profile_compatibility_flags;
unsigned int(48) general_constraint_indicator_flags;
unsigned int(8) general_level_idc;
bit(4) reserved = ‘1111’b;
unsigned int(12) min_spatial_segmentation_idc;
bit(6) reserved = ‘111111’b;
unsigned int(2) parallelismType;
bit(6) reserved = ‘111111’b;
unsigned int(2) chromaFormat;
bit(5) reserved = ‘11111’b;
unsigned int(3) bitDepthLumaMinus8;
bit(5) reserved = ‘11111’b;
unsigned int(3) bitDepthChromaMinus8;
bit(16) avgFrameRate;
bit(2) constantFrameRate;
bit(3) numTemporalLayers;
bit(1) temporalIdNested;
unsigned int(2) lengthSizeMinusOne;
unsigned int(8) numOfArrays;
for (j=0; j < numOfArrays; j++) {
bit(1) array_completeness;
unsigned int(1) reserved = 0;
unsigned int(6) NAL_unit_type;
unsigned int(16) numNalus;
for (i=0; i< numNalus; i++) {
unsigned int(16) nalUnitLength;
bit(8*nalUnitLength) nalUnit;
}
}
}
FLV文件分析的更多相关文章
- 【转】打包AAC码流到FLV文件
AAC编码后数据打包到FLV很简单.1. FLV音频Tag格式 字节位置 意义0x08, ...
- linux实践之ELF文件分析
linux实践之ELF文件分析 下面开始elf文件的分析. 我们首先编写一个简单的C代码. 编译链接生成可执行文件. 首先,查看scn15elf.o文件的详细信息. 以16进制形式查看scn15elf ...
- 蓝屏 Dump文件分析方法
WinDbg使用有点麻烦,还要符号表什么的.试了下,感觉显示很乱,分析的也不够全面... 试试其他的吧!今天电脑蓝屏了,就使用其dump文件测试,如下: 1.首先,最详细的,要属Osr Online这 ...
- C# 版 flvmerge:快速合并多个flv文件
网上的视频很多都是分片的flv文件,怎么把他们合为一体呢?GUI工具就不考虑了,不适合批量执行,不适合在后台运行.有没有命令行工具或库可以实现呢? ffmpeg 提供了一个方法: (1)先把flv文件 ...
- KEIL MDK输出map文件分析
一.文件分析流程 1.第一部分:Section Cross References 主要是各个源文件生成的模块之间相互引用的关系. stm32f10x.o(STACK) refers (Special) ...
- ecshop init.php文件分析
1. ecshop init.php文件分析 2. <?php 3. 4. /** 5. * ECSHOP 前台公用文件 6. * ===================== ...
- [转载]mysql慢日志文件分析处理
原文地址:mysql慢日志文件分析处理作者:maxyicha mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,要修改my.cnf或者在mysq ...
- 使用 Eclipse Memory Analyzer 进行堆转储文件分析
Eclipse Memory Analyzer(MAT)是著名的跨平台集成开发环境 Eclipse Galileo 版本的 33 个组成项目中之一,它是一个功能丰富的 JAVA 堆转储文件分析工具,可 ...
- Android JNI入门第三篇——jni头文件分析
一. 首先写了java文件: public class HeaderFile { private native void doVoid(); native int doShort(); native ...
- Java class文件分析工具 -- Classpy
Classpy Classpy是一个图形化的class文件分析工具,功能和javap类似,界面主要參考了Java Class Viewer: 为什么要又一次创造轮子? 写这个工具花了将近一周的时间.那 ...
随机推荐
- Docker 修改容器中的mysql密码
1.查看容器服务 docker ps2.进入mysql容器 docker exec -it mysql /bin/bash 注:mysql为容器的名字 3.登录MySQL mysql -u root ...
- List转Map处理
List对象装一个Map<String,String> 在Java8中新增了stream流的操作,对于代码书写更为简便,而且更容易看的懂 List<Unit> unitList ...
- Angular架构学习
定义 Angular 是一个用 HTML 和 JavaScript 或者一个可以编译成 JavaScript 的语言(例如 Dart 或者 TypeScript ),来构建客户端应用的框架. 写 An ...
- 关于QT编译程序找不到MSVCRT.DLL和其他动态链接库的解决办法
先上图(一大堆无法解析的外部符号): 解决办法分两个步骤: 1.系统环境变量设置,把这些dll文件所在目录加入到PATH中.比如C:\Windows\SysWOW64, C:\Windows\Syst ...
- C#中Socket连接请求的超时设置
C#中Socket连接请求的超时设置 <转载> C#中, 对于Socket的请求,无论是同步还是异步,都没有提供超时机制,SendTimeout,ReceiveTimeout均无用.. 对 ...
- Java's absolute and relative path
在java中文件目录中带"/"的是绝对路径,不带"/"的是相对路径. 请求页面的写法,在web中,页面路径主要写的有以下几种 1.重定向 2.转发 3.超链接 ...
- [Unity移动端]Mono与IL2Cpp
参考链接: https://blog.csdn.net/linxinfa/article/details/87358809 https://blog.csdn.net/Aison_/article/d ...
- 使用 ww.cad 完成dwg文件转shp(包含所有属性)
单纯使用ArcEngine提供的接口读取dwg数据转shp存在众多属性无法读取的情况(最直观的 南方cass生产的dwg文件有SOUTH这一字段,为目标要素的类型) private void Conv ...
- 定制centos发行版
//轻量级Centos定制发行版==================================================================================== ...
- .NET周报 【3月第2期 2023-03-12】
国内文章 ASP.NET Core中如何限制响应发送速率(不是调用频率) https://www.cnblogs.com/coredx/p/17195492.html ASP.NET Core中有很多 ...