MP4文件格式详解——结构概述

MP4文件格式详解(ISO-14496-12/14)

Author:Pirate Leo

Email:codeevoship@gmail.com

一、基本概念

1、 文件,由许多Box和FullBox组成。

2、 Box,每个Box由Header和Data组成。

3、 FullBox,是Box的扩展,Box结构的基础上在Header中增加8bits version和24bits flags。

4、 Header,包含了整个Box的长度size和类型type。当size==0时,代表这是文件中最后一个Box;当size==1时,意味着Box长度需要更多bits来描述,在后面会定义一个64bits的largesize描述Box的长度;当type是uuid时,代表Box中的数据是用户自定义扩展类型。

5、 Data,是Box的实际数据,可以是纯数据也可以是更多的子Boxes。

6、 当一个Box的Data中是一系列子Box时,这个Box又可成为Container Box。

Box的结构用伪代码表示如下:

aligned(8) class Box (unsigned int(32) boxtype,optional unsigned int(8)[16] extended_type) 
{ 
    unsigned int(32) size; 
    unsigned int(32) type = boxtype; 
    if (size==1) 
    { 
        unsigned int(64) largesize; 
    } 
    else if (size==0) 
    { 
        // box extends to end of file 
    } 
    if (boxtype==‘uuid’) 
    { 
        unsigned int(8)[16] usertype = extended_type; 
    } 

结构如下图:

 

                                                                                             文件基本结构描述图

二、MP4文件格式(ISO-14496-12/14)

MP4文件概述

MP4文件就是由各式各样的Box组成的,下表中列出了所有必选或可选的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

 

 

 

els

  • 28
    点赞
  • 86
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值