Appendix G: RealMedia File Format (RMFF)
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; }}