FFMpeg笔记(十二)MP4 box解析 |
您所在的位置:网站首页 › 麦当劳标志解析视频 › FFMpeg笔记(十二)MP4 box解析 |
MP4包含3大box。 一、ftypfile type box,包含视频文件使用的mp4标准,也作为probe mp4的标志; 二、moov包含媒体的元数据信息,包含一个mvhd(也就是header box)和若干个trak(track)。trak包含一条音/视频轨道信息和音视频数据的编码格式、音视频数据样本、chunks的大小,存储位置,PTS等。 1、mvhd movie header box,包含duration和timescale,duration是媒体时长,timescale是单位为秒的媒体时长,可以理解为每秒经历的时间刻度。 2、tkhd track header box,如果是视频track,会包含宽高信息; 三、mdatmedia data box,moov box记录的每帧音视频数据位置信息,实际都存储在mdat box中,通过解析moov box可以获取到每帧音视频数据具体位置,方便播放器进行seek操作。 四、表格总结 Box 含义 备注 ftyp file type box 作为probe标识 moov mvhd movie header duration和timescale meta trak track 每读到一个track,新增一个AVStream tkhd track header 视频宽高 tref trgr edts elst meta mdia mdhd hdlr 指定流类型 ...... stbl sample table box stsd sample descriptions 采样描述容器:包含codec type,extradata(即SPS、PPS) stts (decoding)time-to-samplestts stss ctts三个box用于保存媒体数据和时间戳的对应关系。 采样时间容器:stts可以计算每个sample的dts ctts(composition) time to sample pts stscsample-to-chunk, patial data-offset infomation stsc stsz stco三个box用于保存每帧视频或音频数据在文件中的保存位置。 stsz sample sizes 样本大小 stsssync sample table 采样时间容器:存放了关键字的序号(I帧),seek时需从关键帧开始解码。 stco chunk offset chunk偏移容器 mdat本文来自博客园,作者:jiayayao,邮箱:[email protected],转载请注明原文链接:https://www.cnblogs.com/jiayayao/p/17433297.html |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |