基础知识:视频文件格式综述

http://bbs.chinavideo.org/redirect.php?tid=1795&goto=lastpost

 

Multimedia Files
----------------
Many multimedia files that carry both audio and video bear extensions
such as .avi (Microsoft AVI files), .asf (a.k.a., .wmv and .wma,
collectively known as Microsoft ASF files), .mov (Apple Quicktime files),
and .rm (RealMedia files). Confusion often arises as one wonders what
application can, for example, "play .mov files". That is a very difficult
question to answer and here is why:

All of the formats mentioned in the preceding paragraph are also
referred to as multimedia container formats. All they do is pack chunks
of audio and video data together, interleaved, along with some
instructions to inform a playback application how the data is to be
decoded and presented to the user. This is the typical layout of many
multimedia file formats:

file header
title, creator, other meta-info
video header
video codec FourCC
width, height, colorspace, playback framerate
audio header
audio codec FourCC
bits/sample, playback frequency, channel count
file data
encoded audio chunk #0
encoded video chunk #0
encoded audio chunk #1
encoded video chunk #1
encoded audio chunk #2
encoded video chunk #2
encoded audio chunk #3
encoded video chunk #3
..
..

Those audio and video chunks can be encoded with any number of audio or
video codecs, the FourCCs of which are specified in the file header.

See The Almost Definitive FourCC Definition List listed in the reference
for more information on the jungle of FourCCs out there, and where they
commonly appear.
Interleaving
------------
Interleaving is the process of storing alternating audio and video chunks
in the data section of a multimedia file:

encoded audio chunk #0
encoded video chunk #0
encoded audio chunk #1
encoded video chunk #1
encoded audio chunk #2
encoded video chunk #2
..
..
encoded audio chunk #n
encoded video chunk #n

Why is this done? Why not just place all of the video data in the file,
followed by all of the audio data? For example:

encoded video chunk #0
encoded video chunk #1
encoded video chunk #2
..
..
encoded video chunk #n
encoded audio chunk #0
encoded audio chunk #1
encoded audio chunk #2
..
..
encoded audio chunk #n

Conceptually, this appears to be a valid solution. In practice, however,
it falls over. Assuming these audio and video streams are part of the same
file on the same disk (almost always the case), there is a physical
mechanism called the disk read head which has to constantly make a leap
between two different positions on the disk. When the chunks are
interleaved, the read head does not need to seek at all; it can read all
the data off in a contiguous fashion.

 

 

翻译了一下,全都是意译;如有不准确指出,还请指出,谢谢;

 

多媒体文件
----------------
多数的多媒体文件都带有音视频的后缀名,像.avi (Microsoft AVI 文件), .asf (a.k.a., .wmv and .wma,
共同作为Microsoft ASF 文件), .mov (Apple Quicktime文件),
.rm (RealMedia文件)等。然而,我们却总因为不知道应该使用什么应用程序比如“播放.mov文件”而感到疑惑;这个问题其实很难回答,下面给出这么说的原因:
前一个段落中提到的所有的文件格式也是指多媒体容器格式。他们所作的就是把音视频数据在一起打包,交错存放,同时加入一些播放程序能够识别的指令帮助其正确解码数据并给最终用户播放出来。下面是多数多媒体文件格式的一个经典的陈列:
文件头
标题,制作者,其他的元数据信息
视频头
视频解码器FourCC标识
宽,高,颜色空间,播放帧速
音频头
音频解码器FourCC标识
比特数/采样率,播放频率,声道数
文件数据
encoded audio chunk #0
音频编码数据块1
encoded video chunk #0
视频编码数据块1
encoded audio chunk #1
encoded video chunk #1
encoded audio chunk #2
encoded video chunk #2
encoded audio chunk #3
encoded video chunk #3
..
..

这些音视频块可以使用任一音频或视频编码器编码,在头文件中有对应的FourCC标识指明所使用的编码器。
查看参考文档里的严格的FourCC定义列表可以从一堆的东西中得到更多的有关FourCC的信息,以及他们常常在哪里用到。
交错
------------
交错是多媒体文件中数据段中音视频分别存放的过程;
encoded audio chunk #0
encoded video chunk #0
encoded audio chunk #1
encoded video chunk #1
encoded audio chunk #2
encoded video chunk #2
..
..
encoded audio chunk #n
encoded video chunk #n

为什么要这么做呢?为什么不把所有的音频数据放在文件中视频数据的后面呢?就像下面这样子:
encoded video chunk #0
encoded video chunk #1
encoded video chunk #2
..
..
encoded video chunk #n
encoded audio chunk #0
encoded audio chunk #1
encoded audio chunk #2
..
..
encoded audio chunk #n

从概念上来讲,这看上去是一个可行的方案。但实际上,这却是行不通的。我们假设这些音视频流同属于一块硬盘上的同一个文件(大多数情况确是这样),那么物理机制上磁盘的读磁头就必须要在磁盘中两块不同的地方来回跳跃读取。而这些块交错存储的话,读磁头就不需要反复寻道了;它可以在邻近的地方读取所有的数据了。

 

你可能感兴趣的:(video,Microsoft,File,application,audio,playback)