RM文件结构
### RM文件结构详解 #### 一、概述 RM文件(RealMedia文件)是RealNetworks公司开发的一种多媒体容器格式,广泛应用于互联网上流媒体的传输。RM文件结构(RealMedia File Format, RMFF)是一种标准的标记文件格式,它允许Real系统在多种网络带宽条件下提供高质量的多媒体内容。RMFF支持第三方开发者将其媒体格式转换为RMFF格式,从而使Real服务器能够将这些文件传输给RealPlayer或其他基于Real System SDK构建的应用程序。因此,RMFF不仅用于传输视频和音频,还能够与开发者自定义的应用程序集成。 #### 二、RM文件结构基础知识 **四字符码(FourCC)** RM文件格式使用四字符码来标识文件中的元素。四字符码是一个32位的数据类型,由1到4个ASCII字母数字字符组成,并在右侧填充空格字符。为了方便转换,可以使用`PN_FOURCC`宏将四个字符转化为一个四字符码。 **块(Chunk)** RM文件的基本构成单元是块。每个块包含以下字段: 1. **四字符码**:标识块的类型。 2. **32位值**:表示块数据成员的大小。 3. **不透明数据块**:实际的块数据。 根据其类型,顶级块可能包含子对象。本文档将详细介绍RMFF中的标记块以及每种类型块中存储的数据格式。 #### 三、头部区域结构 由于RMFF是一种标记文件格式,除了RealMedia文件头必须是文件的第一个块外,其他块的顺序并不固定。但是,大多数应用程序会按照一定的顺序将标准头部写入文件的头部区域。以下是在RMFF头部区域中常见的块: 1. **RealMedia文件头**:必须是文件的第一个块。 2. **属性头**:存储文件的一些基本属性信息。 3. **媒体属性头**:详细描述媒体数据的属性。 4. **内容描述头**:描述文件内容的元数据。 除了索引头之外,所有头部都是必需的。 ##### RealMedia文件头 每个RealMedia文件都以RealMedia文件头开始,该头标识文件为RMFF格式。一个RealMedia文件中只有一个RealMedia文件头。因为RealMedia文件头的内容可能会随着不同版本的RMFF而变化,所以文件头结构非常重要。接下来我们将具体介绍各个头部对象的详细内容和结构。 #### 四、具体头部对象解析 **RealMedia文件头**:这个头部对象是文件的起始部分,标识文件为RMFF格式。它是RM文件中唯一的一个RealMedia文件头,并且包含了版本号等基本信息。 **属性头**:这部分包含了文件的一些基础属性信息,如创建日期、作者等。 **媒体属性头**:提供了关于媒体数据的具体描述,包括编码方式、采样率、声道数量等。 **内容描述头**:用来描述文件内容的元数据,例如标题、作者、版权信息等。 以上介绍了RM文件格式的基础结构和主要组成部分。通过理解这些基础知识,开发者可以更好地利用RMFF进行媒体文件的处理和传输,同时也能够更好地与其他基于Real System的应用程序集成。
RealSystem Architecture introduces RealMedia File Format (RMFF), which lets RealSystem deliver high-quality multimedia content over a variety of network bandwidths. Third-party developers can convert their media formats into RMFF, enabling RealServer to deliver the files to RealPlayer or other applications built with the RealSystem SDK. Third-party developers can thereby use RealSystem to transport content over the Internet to their own applications.
RealMedia File Format is a standard tagged file format that uses four-character codes to identify file elements. These codes are 32-bit, represented by a sequence of one to four ASCII alphanumeric characters, padded on the right with space characters. The data type for four-character codes is FOURCC. Use the PN_FOURCC macro to convert four characters into a four-character code.
The basic building block of a RealMedia File is a chunk, which is a logical unit of data, such as a stream header or a packet of data. Each chunk contains the following fields:
four-character code specifying the chunk identifier
32-bit value specifying the size of the data member in the chunk
blob of opaque chunk data
Depending on its type, a top-level chunk can contain subobjects. This document describes the tagged chunks contained in RMFF, as well as the format of the data stored in each type of tagged chunk.
Tagged File Formats
Header Section
Because RMFF is a tagged file format, the order of the chunks is not explicit, except that the RealMedia File Header must be the first chunk in the file. However, most applications write the standard headers into the file's header section. The following chunks are typically found in the header section of RMFF:
RealMedia File Header (This must be the first chunk of the file)
Properties Header
Media Properties Header
Content Description Header
After the RealMedia File Header object, the other headers may appear in any order. All headers are required except the Index Header. The following sections describe the individual header objects .
RealMedia File Header
Each RealMedia file begins with the RealMedia File Header, which identifies the file as RMFF. There is only one RealMedia File Header in a RealMedia file. Because the contents of the RealMedia File Header may change with different versions of RMFF, the header structure supports an object version field for determining what additional fields exists. The following pseudo-structure describes the RealMedia File Header:
RealMedia_File_Header{ UINT32 object_id; UINT32 size; UINT16 object_version; if (object_version == 0) { UINT32 file_version; UINT32 num_headers; }}
The RealMedia File Header contains the following fields:
object_id: 32 bits
The unique object ID for a RealMedia File (.RMF). All RealMedia files begin with this identifier.
size: 32 bits
The size of the RealMedia header section in bytes.
object_version: 16 bits
The version of the RealMedia File Header object. All files created according to this specification have an object_version number of 0 (zero).
file_version: 32 bits
The version of the RealMedia file in PN Version format. All files created according to this specification have a major version number of 1. This member is present on all RealMedia_File_Header objects with an object_version of 0 (zero).
num_headers: 32 bits
The number of headers in the header section that follow the RealMedia File Header. This member is present on all RealMedia_File_Header objects with an object_version of 0 (zero).
Properties Header
The Properties Header describes the general media properties of the RealMedia File. Components of the RealMedia system use this object to configure themselves for handling the data in the RealMedia file or stream. There is only one Properties Header in a RealMedia file. The following pseudo-structure describes the Properties header:
Properties{ UINT32 object_id; UINT32 size; UINT16 object_version; if (object_version == 0) { UINT32 max_bit_rate; UINT32 avg_bit_rate; UINT32 max_packet_size; UINT32 avg_packet_size; UINT32 num_packets; UINT32 duration; UINT32 preroll; UINT32 index_offset; UINT32 data_offset; UINT16 num_streams; UINT16 flags; }}
剩余22页未读,继续阅读
- hushoubo2011-11-21表示看起来很有鸭梨!全英文的
- 粉丝: 74
- 资源: 12
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助