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: 为什么要又一次创造轮子? 写这个工具花了将近一周的时间.那 ...
随机推荐
- Mysql5.7的安装与卸载与数据迁移
Mysql5.7的安装与卸载 安装: 1.安装的时候 只选择安装 server即可 2.安装过程中,一定要重新选择安装路径和各个日志的路径,将来会非常大,不适合存在系统盘下面 3.安装时,取消MySQ ...
- linux下python程序部署
1.安装python 2.安装virtualenv https://blog.csdn.net/mulangren1988/article/details/59106682 3.指定virtualen ...
- Ubuntu解决无法远程连接
检查SSH是否安装 ssh localhost 如果没有安装,通过APT的命令安装 sudo apt install openssh-server 无法连接Ubuntu中的root用户 其他用户可以连 ...
- Laravel安装第一步:Windows 10 上laravel下载与安装需要注意。
1.下载了laravel,查看composer.json文件,搞清楚它需要的PHP版本 2.不要用 composer install !!! 用 composer -vvv install 这样 ...
- ansible介绍与简单的使用
在roles下建立site.yml文件#site.yml - hosts: webservers remote_user: root roles: - websrvs - dbsrvs#将文件拷贝到f ...
- 利用网络复制安装额外域控制器、利用介质安装额外域控制器、安装RODC额外域控制器
一.拥有多台域控制器的优势 1.分担用户身份验证的负担,改善用户登录的效率 2.容错功能:若有域控制器故障,此时仍然可以有其他正常的域控制器来继续提供服务,因此对用户的服务并不会停止 二.系统提供两种 ...
- 调用webservice校时
先调用网络获取网络时间 namespace Utility{ /// <summary> /// 网络时间 /// </summary> publ ...
- vue-print-nb的应用
1.cnpm i vue-print-nb 2.触发事件:v-print="printObj" 3.触发的是个对象: printObj:{ id: ...
- 痞子衡嵌入式:2021 TencentOS Tiny AIoT应用创新大赛 - 初赛阶段的38个作品速览
腾讯 TencentOS 团队于2021年12月8日联合恩智浦半导体.安谋科技发起的线上开发者活动 - TencentOS Tiny AIoT 应用创新大赛目前已经进入到了最后的决赛阶段. 参赛者的作 ...
- CSP-S划分 解题报告
n <= 10 爆搜即可 n <= 50 什么乱搞 n <= 400 有一个 \(n^3\) 的 dp 设 dp[i][j] 表示最后一段为 j+1~i 时的最小值 直接三层循环转移 ...