首页 > 其他分享 >音视频八股文(10)-- mp4结构

音视频八股文(10)-- mp4结构

时间:2023-05-05 20:57:03浏览次数:28  
标签:10 3780 Sample -- chunk bytes 音视频 sample flag

介绍

mp4⽂件格式⼜被称为MPEG-4 Part 14,出⾃MPEG-4标准第14部分 。它是⼀种多媒体格式容器,⼴泛⽤于包装视频和⾳频数据流、海报、字幕和元数据等。(顺便⼀提,⽬前流⾏的视频编码格式AVC/H264
定义在MPEG-4 Part 10)。

概述

mp4⽂件由box组成,每个box分为Header和Data。其中Header部分包含了box的类型和⼤⼩,Data包含了⼦box或者数据,box可以嵌套⼦box。

下图是⼀个典型mp4⽂件的基本结构:

在这里插入图片描述

MP4⽂件的基本组成单元是box,也就是说MP4⽂件是由各种各样的box组成的,有parent box,还有children box。因此,这些boxes之间存在⼀定的层次关系,总结如下表所示,表中标记出了各个box必选或可选特性,√代表Box必选。

ftyp file type and compatibility ⽂件类型和兼容性
pdin progressive download information
moov container for all the metadata 所有元数据的容器
mvhd movie header, overall declarations 电影头,整体声明
trak container for an individual track or stream 单个轨或流的容器
tkhd track header, overall information about the track 轨的头部,关于该轨的概括信息,⽐如视频宽⾼
tref track reference container
edts edit list container
elst an edit list
mdia container for the media information in a track 轨媒体信息的容器
mdhd media header, overall information about the media 媒体头,关于媒体的总体信息
hdlr handler, declares the media (handler) type 媒体的播放过程信息
minf media information container 媒体信息容器
vmhd video media header, overall information (video track only)
smhd sound media header, overall information (sound track only)
hmhd hint media header, overall information (hint track only)
nmhd Null media header, overall information (some tracks only)
dinf data information box, container 数据信息box,容器
dref data reference box, declares source(s) of media data in track 如何定位媒体信息
stbl sample table box, container for the time/space map 包含了track中的sample的所有时间和位置信息,以及sample的编解码等信息。利⽤这个表可以解析sample的时序、类型、⼤⼩以及在各⾃存储容器中的位置。
stsd sample descriptions (codec types,initialization etc.) 如果是视频,包含:编码类型、宽⾼、⻓度等信息;如果是⾳频,包含:声道、采样率等信息
stts (decoding) time-to-sample描述了sample时序的映射⽅法,我们可以通过它找到任何时间的sample。
ctts (composition) time to sample。
stsc sample-to-chunk, partial data-offset information ⽤chunk组织sample可以⽅便优化数据获取,⼀个chunk包含⼀个或多个sample。
stsz sample sizes (framing) 每个sample的⼤⼩。虽然这⾥没有打勾,但对于mp4还是⾮常必要的。
stz2 compact sample sizes (framing)
stco chunk offset, partial data-offset information 定义了每个chunk在媒体流中的偏移位置
co64 64-bit chunk offset
stss sync sample table (random access points) ⽤于确定media中的关键帧
stsh shadow sync sample table
padb sample padding bits
stdp sample degradation priority
sdtp independent and disposable samples
sbgp sample-to-group
sgpd sample group description
subs sub-sample information
mvex movie extends box
mehd movie extends header box
trex track extends defaults
ipmc IPMP Control Box
moof movie fragment
mfhd movie fragment header
traf track fragment
tfhd track fragment header
trun track fragment run
sdtp independent and disposable samples
sbgp sample-to-group
subs sub-sample information
mfra movie fragment random access
tfra track fragment random access
mfro movie fragment random access offset
mdat media data container
free free space
skip free space
udta user-data
cprt copyright etc.
meta metadata
hdlr handler, declares the metadata (handler) type
dinf data information box, container
dref data reference box, declares source(s) of metadata items
ipmc IPMP Control Box
iloc item location
ipro item protection
sinf protection scheme information box
frma original format box
imif IPMP Information box
schm scheme type box
schi scheme information box
iinf item information
xml XML container
bxml binary XML container
pitm primary item reference
fiin file delivery item information
paen partition entry
fpar file partition
fecr FEC reservoir
segr file delivery session group
gitn group id to name
tsel track selection
meco additional metadata container
mere metabox relation

本⽂使⽤mediainfo和mp4box进⾏分析

图中看到mp4⽂件由⼏个主要组成部分,下⾯以

标签:10,3780,Sample,--,chunk,bytes,音视频,sample,flag
From: https://www.cnblogs.com/waitmoon/p/17375337.html

相关文章

  • 2023-05-05:给定一个无向、连通的树 树中有 n 个标记为 0...n-1 的节点以及 n-1 条边
    2023-05-05:给定一个无向、连通的树树中有n个标记为0...n-1的节点以及n-1条边。给定整数n和数组edges,edges[i]=[ai,bi]表示树中的节点ai和bi之间有一条边。返回长度为n的数组answer,其中answer[i]:树中第i个节点与所有其他节点之间的距离之和。输入......
  • java基础-什么是方法,方法的定义和调用,方法的重载,方法的内存
    一、什么是方法方法method是程序中最小的执行单元。在实际开发中,可以将重复的代码、具有独立功能的代码抽取到方法中,这样可以提高代码的复用性和可维护性。二、方法的定义(打包)和调用注意:方法要写在main主方法的外面(在main方法外面定义)。1、最简单的方法定义和调用//最简单......
  • register at least one qt version using“qt vs tools“->“qt options“问题描述及解
    问题描述:在安装了Qt5.9.8,vs2022,QTVSTool2022并配置好环境变量之后创建Qt项目时无法创建,提示至少需要注册一个Qt版本到QtVSTools的QtOptions 解决方法:1.重新打开一个可以创建的C++vs文件,在上方菜单栏中“工具-选项-找到Qt的version”,点击加号,再点击windows右侧的......
  • 2023/5/5
    -1有序数组(类模板)分数 10全屏浏览题目作者 何振峰单位 福州大学实现一个类模板,它可以接受一组数据,能对数据排序,也能输出数组的内容。每行输入的第一个数字为0,1,2或3:为0时表示输入结束;为1时表示将输入整数,为2时表示将输入有一位小数的浮点数,为3时表......
  • 随笔
    2023-5-5RISC-Xx0寄存器RISC-V有32个通用寄存器,其中第1个寄存器x0硬编码为0,即读出来总是0,写进去总是被丢弃。可以很方便的简单化取反,nor等操作(可以有很多,没记住所以,没列出来makeinclude机制当make看到include指令时,会先找⼀下有没有这个⽂件,如果有则读⼊。接着,make......
  • 正则中r原串的使用
    1.r原串的使用: 2.r原串总结: ......
  • Go笔记(十一):方法
    Go语言没有Java语言面向对象的特性,也无类对象的概念。但可以使用结构体实现这些特性。1、方法的声明Go中的方法是一种特殊的函数,与struct相关联,被称为struct的接收者。可以理解为方法就是有接收者的函数。语法格式如下:typemystructstruct{}func(recvmystruct)my......
  • ST表
    ST表的数组st[i][k]指从i开始2^k个数里的最值最直观的用法应该就是求区间最值,即RMQ问题(RangeMinimum/MaximumQuery)预处理O(nlogn)查询O(1)例题洛谷P3865【模板】ST表https://www.luogu.com.cn/problem/P3865#include<iostream>#include<cmath>#defineforup(i,l,r)f......
  • 解决OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll alread
    错误如下所示:OMP:Error#15:Initializinglibiomp5md.dll,butfoundlibiomp5md.dllalreadyinitialized.OMP:HintThismeansthatmultiplecopiesoftheOpenMPruntimehavebeenlinkedintotheprogram.Thatisdangerous,sinceitcandegradeperformanceorcau......
  • re.finall方法的使用
    finall()特点:1.如果正则表达式中没有()则返回与整个正则匹配的列表2.如果正则表达式中有(),则返回()中匹配的内容列表,小括号两边东西都是负责确定提取数据所在位置1.正则表达式匹配单个数字和多个数字: 2.正则表达式_findall方法中flag参数的作用:3.finall方法中分组的......