视频封装格式——MP4

一:介绍

MP4(MPEG-4 Part 14)是一种常见的多媒体容器格式,它是在“ISO/IEC 14496-14”标准文件中定义的,属于MPEG-4的一部分,是“ISO/IEC 14496-12(MPEG-4 Part 12 ISO base media file format)”标准中所定义的媒体格式的一种实现,后者定义了一种通用的媒体文件结构标准。MP4是一种描述较为全面的容器格式,被认为可以在其中嵌入任何形式的数据,各种编码的视频、音频等都不在话下,不过我们常见的大部分的MP4文件存放的AVC(H.264)MPEG-4(Part 2)编码的视频和AAC编码的音频。MP4格式的官方文件后缀名是“.mp4”,还有其他的以mp4为基础进行的扩展或者是缩水版本的格式,包括:M4V,  3GPF4V等。


二:BOX结构

mp4是由一个个“box”组成的,大box中存放小box,一级嵌套一级来存放媒体信息。box的基本结构是:



三:BOX类型

MP4的Box种类繁多,以下为参照(√为必须包含的Box):

MP4 Format
Box Type Option Description
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
          dref data reference box, declares source(s) of media data in track
        stbl   sample table box, container for the time/space map
          stsd sample descriptions (codec types, initialization etc.)
          stts (decoding) time-to-sample
          ctts   (composition) time to sample
          stsc sample-to-chunk, partial data-offset information
          stsz   sample sizes (framing)
          stz2   compact sample sizes (framing)
          stco chunk offset, partial data-offset information
          co64   64-bit chunk offset
          stss   sync sample table (random access points)
          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           primary item reference
  pitm           primary item reference
  fiin           file delivery item information
    paen         partition entry
      fpar       FEC reservoir
      fecr       FEC reservoir
    segr         file delivery session group
    gitn         group id to name
    tsel         track selection
meco             additional metadata container
  mere           metabox relation


四:示例




补充:具体的各种Box结构需另外参考。

参考:

http://blog.163.com/niuxiangshan@126/blog/static/1705965952012102011316978/
http://blog.csdn.net/pirateleo/article/details/7061452
http://www.cnblogs.com/haibindev/archive/2011/10/17/2214518.html
http://www.xuebuyuan.com/1799539.html

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值