1 Summary
MPEG-4 Part 14 or MP4 file format, formally ISO/IEC 14496-14:2003, is a multimedia container format standard specified as a part of MPEG-4. It is most commonly used to store digital video and digital audio streams, especially those defined by MPEG, but can also be used to store other data such as subtitles and still images. Like most modern container formats, MPEG-4 Part 14 allows streaming over the Internet. A separate hint track is used to include streaming information in the file. The official filename extension for MPEG-4 Part 14 files is .mp4, thus the container format is often referred to simply as MP4.
Note:MPEG-4 Part 14 -- MP4 file format(formally ISO/IEC 14496-14:2003) is a container format;MPEG-4 Part 2 -- MPEG-4 Visual (formally ISO/IEC 14496-2) is a video compression technology developed by MPEG.
1.1 Relative file extension
- (a)MPEG-4 files with audio and video generally use the standard .mp4 extension.
- (b)Audio-only MPEG-4 files generally have a .m4a extension. This is especially true of non-protected content.
- (c)MPEG-4 files with audio streams encrypted by FairPlay Digital Rights Management as sold through the iTunes Store use the .m4p extension. iTunes Plus tracks are unencrypted and use .m4aaccordingly.
- (d)Audio book and podcast files, which also contain metadata including chapter markers, images, and hyperlinks, can use the extension .m4a, but more commonly use the .m4b extension. An .m4a audio file cannot "bookmark" (remember the last listening spot), whereas .m4b extension files can.
- (e)The Apple iPhone uses MPEG-4 audio for its ringtones but uses the .m4r extension rather than the .m4a extension.
- Raw MPEG-4 Visual bitstreams are named .m4v but this extension is also sometimes used for video in MP4 container format.[19]
- (f)Mobile phones use 3GP, an implementation of MPEG-4 Part 12 (a.k.a MPEG-4/JPEG2000 ISO Base Media file format), similar to MP4. It uses .3gp and .3g2 extensions. These files also store non-MPEG-4 data (H.263, AMR, TX3G).
The common but non-standard use of the extensions .m4a and .m4v is due to the popularity of Apple’s iPod, iPhone, and iTunes Store.
1.2 Common-used data stream
Almost any kind of data can be embedded in MPEG-4 Part 14 files through private streams. The registered codecs for MPEG-4 Part 12-based files are published on the website of MP4 Registration authority (mp4ra.org),[20] but most of them are not widely supported by MP4 players. The widely-supported codecs and additional data streams are:[citation needed]
- Video: MPEG-4 Part 10 (also known as H.264/MPEG-4 AVC), MPEG-4 Part 2, (other compression formats are less used: MPEG-2, MPEG-1).
- Audio: Advanced Audio Coding (AAC - MPEG-4 Part 3 Subpart 4), (other compression formats are less used: MPEG-1 Audio Layer III (MP3), Apple Lossless, MPEG-4 Part 3 Audio Object Types: Audio Lossless Coding (ALS), Scalable Lossless Coding (SLS), MPEG-1 Audio Layer II (MP2), MPEG-1 Audio Layer I (MP1), CELP, HVXC (speech), TwinVQ (very low bitrates), Text To Speech Interface (TTSI),SAOL (MIDI) and others.
- Subtitles: MPEG-4 Timed Text (also known as 3GPP Timed Text). Some private stream examples includeNero's use of DVD subtitles (Vobsub) in MP4 files.
2 MPEG4文件结构
MP4文件中包含与媒体数据时间序列相关的时间、结构、媒体信息。MP4文件主要包括三个部分:场景描述符流(BIFS)(Binary Format for Scenes)、对象描述符OD(Object Descriptor)、流和流映射表(基本流ID或URL与物理位置间的映射)。
MP4文件游atom组合和嵌套而成,比如movie atom 包含track atom,track atom包含media atom。The lowest level is leaf atom,which contains non-atom data.The atom layout is(An MPEG-4 file is made of a number of discrete units called atoms (well, they were called atoms in the first version of the specification, now they are prosaically called 'boxes').):
Atom size:A 32-bits interger that indicates the size of atom,including both the autom header and the contents,including any contained atoms.Normally,the size field contains the actual size in bytes;However, the size field can contain special values to indicates an alterlate method of determining the atom size.If the size field is set to 0,which allowed only for a top level atom,this is the last atom of the file and it extends to the last of the file.If it is set to 1,then the actual size is given in the extended size field ,an 64-bits field that follow the type field.
Type:A 32-bits interger that contains the type of the atom.This can often be usefully treated as a four-character field with a mnemonic value,such as ‘moov’(0x6D6F6F76)for a movie atom,or ‘track’(0x74726168)for a track atom.Knowing an atoms’s type allows you to interpret it’s data.An atom’s data can be arranged as any arbitrary collection of fields,tables,or other atom.If your application encounters a atom of an unknown type,it should not attempt to inerpret the atom’s data.Use the atom’s size to skip it.
2.1 Common used atom(box)
所有atom的大体布局如下:
2.1.1 Movie atom(box)
Movie atom 通常包含一个Movie Header atom(mvhd),定义整个movie的time scale和duration;包含至少一个track atom;另外还存在一些可选的atom,如下图所示:
2.1.2 Movie header atom
定义整个movie的time scale和duration.
Layout如下所示:
2.1.3 Track Atom
Atom define a single track of movie.A movie consist of on or more tracks.At least one media track.
2.1.4 Track header atom
2.1.5 Media atom
Media atom describe and define a track’s media type and sample data.The media atom contains information that specify the media type,such as audio or video;the time scale,the track duration,and so on.
2.1.6 Media header atom
2.1.7 Media information atom
Including Video information atom and sound information atom.
2.2 An example
下面这个工具的下载地址:http://blog.chinaunix.net/u2/61880/showart_1101088.html
References:
http://en.wikipedia.org/wiki/MPEG-4_Part_2
http://en.wikipedia.org/wiki/MPEG-4_Part_14
http://www.digitalpreservation.gov/formats/fdd/fdd000155.shtml
ISO_IEC_14496-14-2003.pdf
qtff-2001.pdf(most important)
流媒体MP4文件的核心技术综述.pdf
相关推荐
MP4文件格式标准,详细介绍MP4文件格式的内容以及信息
3GP及MP4文件格式完整,一个不错的文档
举例说明mp4文件格式,每个box的定义,是学习多媒体必备资料。
MP4文件格式入门MP4文件格式入门MP4文件格式入门MP4文件格式入门MP4文件格式入门MP4文件格式入门MP4文件格式入门MP4文件格式入门MP4文件格式入门
MP4文件格式中,所有的内容存在一个称为movie的容器中。一个movie可以由多个tracks组成。每个track就是一个随时间变化的媒体序列,例如,视频帧序列。track里的每个时间单位是一个sample,它可以是一帧视频,或者...
MP4视频文件封装格式是基于QuickTime容器格式定义的,因此参考QuickTime的格式定义对理解MP4文件格式很有帮助。MP4文件格式是一个十分开放的容器,几乎可以用来描述所有的媒体结构,MP4文件中的媒体描述与媒体数据是...
mp4文件格式按字节解析,以box的树结构讲解MP4文件的构造。
mp4文件格式祥解,方便大家了解常见的文件格式的了解
MP4文件格式中文详解,MP4文件中的所有数据都装在box,也就是说MP4文件由若干个box组成,每个box有类型和长度,可以将box理解为一个数据对象块。
查看mp4文件格式内部详细信息的工具,对于分析mp4文件很有用
海康录像机mp4文件格式转换工具。可以把海康格式的mp4文件转换为avi文件,在普通的播放机上播放。
经典的MP4文件格式解析文章, 适合于初学者.
mp4文件格式详解,介绍了各个box的含义,以及如何解析出所需要的媒体信息
一份非常详细的讲解MP4文件的格式。希望对想了解MP4文件格式的朋友有帮助!