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: 为什么要又一次创造轮子? 写这个工具花了将近一周的时间.那 ...
随机推荐
- Excel 多表头导入导出(借助Aspose)
需求中Excell多表头,完成导入导出. Aspose 代码实现多表头方式借助代码比较繁琐, 借助模板方式. 简化逻辑. 注意,aspose从0开始索引. 导入部分代码: 实现选择导入Excel,导入 ...
- 网络数据请求get&post
- 统信桌面端专业版开启cron日志,确认定时任务执行情况
默认没有开启cron日志记录 1. 修改rsyslog vi /etc/rsyslog.conf #将cron前面的注释符去掉 cron.* /var/log/cron.log 排查完毕需关闭,重新注 ...
- 第一章 excel与数据格式
part1 数据缘何而来 excel中常见的文件格式有xls与xlsx,推荐后者(空间小.容量大.速度快等特点) 单个excel文件为工作簿,其下包含工作表sheet(最多255),sheet中的每个 ...
- element-ui el-tree 内容过多出现横向滚动条
/deep/ .el-tree>.el-tree-node { display: inline-block; min-width: 100%;}
- 01.html大致主体格式
<!DOCTYPE html> 不是HTML标签,就是文档声明标签 告诉浏览器使用哪种html版本来显示网页,其必须在文档中的最前面位置,要放在<html>标签之前, < ...
- CSS函数var
/*全局变量保存的地方*/ :root { --main-bg-color: red; /* 变量名必须以--开头 */ } var(custom-property-name, value) 值 描述 ...
- Github说明--如何在Github里面上传自己的代码
1.注册一个账号 这是必须的啦!不清楚注册步骤的,可以去看看我之前的博客,里面的步骤也是挺详细的呢! 2.进入到用户主界面 我们会看到这样的一个+标识: 选择其中的New Repository选项,点 ...
- Dcat admin 多文件上传,七牛云云端上传
进入官网 Dcat Admin - Php后台开发框架 这里要选择1.x 下面来安装框架 安装完laravel之后,需要修改.env文件,设置数据库链接设置正确 安装 dcat-admin comp ...
- Java面试——TCP与HTTP
更多内容,移步 IT-BLOG 一.Session 和 Cookie 的区别 [1]Cookie 保存在客户端,未设置存储时间的 Cookie,关闭浏览器会话 Cookie 就会被删除:设置了存储时间 ...