Internet Draft Rahul Agarwal, RealNetworksDraft-Heftagaub-RMFF-00.txt Jeff Ayars, RealNetworks Brad Hefta-Gaub, RealNetworks Dale Stammen, RealNetworksMarch 13, 1998 Expires: August 13, 1998
Realmedia File Format
STATUS OF this Memo
This document is an Internet-Draft. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as `` work In progress ''.
To Learn the Current Status of Any Internet-Draft, please check the `` 1ID-abstracts.txt '' listing contained in the Internet-Drafts Shadow Director on ftp.is.co.za (africa), nic.nordu.net Europe), Munnari.oz.au (Pacific Rim), DS.Ist Coast, or ftp.isi.edu (US West Coast).
Distribution of this document is unlimited.
Abstract:
Introduction
The RealMedia File Format (RMFF) is designed to be a generic container for streaming media data. This data may then be played back locally or streamed over a network using protocols such as RTSP and RTP. The format is data-independent, allowing any data Type to be recorded, manipulated and played back.
Note: This document is intended to be informational in nature of what the file format in use by RealNetworks' RealServer and RealPlayer implementations Though we think that there are a lot of important concepts embodied in this specification, and that it may even make the basis. OF A "Standard" File Format, this is intended to eventually End Up as an informational rfc.copyright NOTES:
Copyright (c) RealNetworks (1998). All Rights Reserved.
R. Agarwal, J. Ayars, B. Hefta-Gaub, D. Stammen Page 1 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
Realmedia File Format (RMFF)
1. File Format 2. Header Section 2.1 RealMedia File Header 2.2 Properties Header 2.3 Media Properties Header 2.4 Content Description Header 3. Data Section 3.1 Data Chunk Header 3.2 Data Packet Header 4. Index Section 4.1 Index Section Header 4.2 Index Record
FILE FORMAT
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 dataR. Agarwal, J. Ayars, B. Hefta-Gaub, D. Stammen Page 2-- -------------------------------------------------- ---------------------------- Draft RTSP MARCH 13, 1998
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 Tagged Chunk.
Tagged chunk ---------------------- | ID | -------------------- - | SIZE | ---------------------- | Data | Tagged Chunk -------------- -------- | ID | ---------------------- | Size | ---------- ------------ | | / ------------- | Subchunk / | data | | / | | / | | | / ----------- | Subchunk / | Data | | / | | | / | | | ------------- | ---------------------- Figure Tagged File Formats2. 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 Heoot Of RMFF:
* RealMedia File Header (This must be the first chunk of the file) * Properties Header * Media Properties Header * Content Description HeaderAfter 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,
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 3 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
2. 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).
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 4 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
2.2 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;}} The Properties Header contains the following fields :
Object_id: 32 Bits The Unique Object ID for a Properties Header ('Prop').
SIZE: 32 Bits The size of the property header in bytes.
Object_version: 16 Bits The Version of the Realmedia File Header Object. All Files Created According To this specification has an object_version number of 0 (zero).
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 5 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
Max_bit_rate: 32 Bits The Maximum Bit Rate Required To Deliver This File over A Network. This MEMBER IS Present On All Properties Objects with an Object_version of 0 (Zero).
Avg_bit_rate: 32 Bits The aveger Bit Required To Deliver this file over a network. This Member is presents on all proPerties Objects with an Object_version of 0 (zero).
Max_packet_size: 32 Bits The Largest Packet Size (in Bytes) In The Media Data. This MEMBER IS Present On All Properties Objects with an Object_version of 0 (ZERO).
avg_packet_size: 32 bits The average packet size (in bytes) in the media data This member is present on all Properties objects with an object_version of 0 (zero) .num_packets:. 32 bits The number of packets in the media data This member is. Present On All Properties Objects with an Object_version of 0 (Zero).
Duration: 32 Bits The Duration of the File IN MilliseConds. This Member IS Present On All Properties Objects with an Object_version of 0 (ZERO).
PREROLL: 32 BITS The Number of MilliseConds to Pre-Buffer Before Starting Playback. This MEMBER IS Present On All Properties Objects with an Object_version of 0 (ZERO).
INDEX_OFFSET: 32 BITS The offset in bytes from the start of the file to the start of the index header object. This Member IS Present ON All Properties Objects WITH AN Object_version of 0 (Zero).
Data_offset: 32 Bits the offset in bytes from the start of the file to the start of the data section. This MEMBER IS Present On All Properties Objects with an Object_version of 0 (ZERO).
Num_Streams: 16 Bits The Number of Media Streams Contained in The File. This MEMBER IS Present On All Properties Objects With An Object_version of 0 (Zero).
R. Agarwal, J. Ayars, B. Hefta-Gaub, D. Stammen Page 6 --------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
Flags: 16 Bits Flags Indicating Characteristics of the Realmedia File. The Following Flags Are Defined:
O #define pn_save_enabled 0x0001
Allows Clients to save a copy of the realmedia file to disk.
o #define pn_perfect_play_enabled 0x0002
Allows Clients To Use extra buffering to ensure perfect play.
O #define pn_live_broadcast 0x0004
The Realmedia File Is Being generated by a live broadcast.2.3 Media Properties Header
The Media Properties Header describes the specific media properties of each stream in a RealMedia File. Components of the RealMedia system use this object to configure themselves for handling the media data in each stream. There is one Media Properties Header for each media stream in a RealMedia File. The Following Pseudo-Structure Describes The Media Properties Header:
Media_Properties {uint32 Object_id; uint32 size; uint16 Object_version;
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 7 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
if (object_version == 0) {UINT16 stream_number; UINT32 max_bit_rate; UINT32 avg_bit_rate; UINT32 max_packet_size; UINT32 avg_packet_size; UINT32 start_time; UINT32 preroll; UINT32 duration; UINT8 stream_name_size; UINT8 [stream_name_size] stream_name; UINT8 mime_type_size; UINT8 [mime_type_size] mime_type; UINT32 TYPE_SPECIFIC_LEN; uint8 [type_specific_len] type_specific_data;}}
The Media Properties Header Contains The Following Fields: Object_ID: 32 Bits The Unique Object ID for a Media Properties Header ('MDPR').
SIZE: 32 Bits The Size of the Media Properties Header in Bytes.
Object_version: 16 Bits The Version of The Media Properties Header Object.
stream_number: 32 bits The stream_number (synchronization source identifier) is a unique value that identifies a media stream Every data packet that belongs to a media stream contains the same STREAM_NUMBER The STREAM_NUMBER enables a receiver of multiple media streams to distinguish which packets belong to.. Each Media Stream. This MEMBER IS Present On All MediaProperties Objects with an Object_version of 0 (ZERO).
Max_bit_rate: 32 Bits The Maximum Bit Rate Required To Deliver This Stream over A Network. This MEMBER IS Present ON All MediaProperties Objects with an Object_version of 0 (ZERO).
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 8 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
AVG_bit_rate: 32 Bits The average bit Rate Required To Deliver this Stream over A Network. This Member IS presents with an Object_version of 0 (Zero).
Max_packet_size: 32 Bits The Largest Packet Size (in Bytes) In The Stream of Media Data. This MEMBER IS Present On All MediaProperties Objects with an Object_version of 0 (ZERO).
AVG_PACKET_SIZE: 32 BITS The avele packet size (in Bytes) in The Stream of Media Data. This Member IS Present On All MediaProperties Objects with an Object_version of 0 (Zero).
start_time: 32 bits The time offset in milliseconds to add to the timestamp of each packet in a media stream This member is present on all MediaProperties objects with an object_version of 0 (zero) .preroll:. 32 bits The time offset in milliseconds to subtract To the TimeStamp of Each Packet in a Media Stream. This Member IS Present On All MediaProperties Objects with an Object_version of 0 (ZERO).
Duration: 32 Bits The Duration of The Stream in Milliseconds. This Member IS Present On All MediaProperties Objects with an Object_version of 0 (Zero).
Stream_name_size: 8 Bits The Length of The Following Stream_name Field in Bytes. This Member IS Present On All MediaProperties Objects with an Object_version of 0 (Zero).
Stream_name: Variable Length A Non-Unique Alias OR Name for the Stream. This Member IS Present On All MediaProperties Objects with an Object_version of 0 (ZERO).
MIME_TYPE_SIZE: 8 BITS The Length of The Following Mime_type Field in Bytes. This Member IS Present ON All MediaProperties Objects with an Object_version of 0 (Zero).
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 9 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
MIME_TYPE: VARIABLE LENGTH A NON-UNIQUE MIME STYLE / SUBTYPE STRING for Data Associated with the Stream. This Member IS Present On All MediaProperties Objects with an Object_version of 0 (ZERO).
type_specific_len: 32 bits The length of the following type_specific_data in bytes The type_specific_data is typically used by the data-type renderer to initialize itself in order to process the media stream This member is present on all MediaProperties objects with an object_version of 0 (zero.. ) .type_specific_data: variable length The type_specific_data is typically used by the data-type renderer to initialize itself in order to process the media stream This member is present on all MediaProperties objects with an object_version of 0 (zero)..
2.4 Content Description HEADER
The Content Description Header contains the title, author, copyright, and comments information for the RealMedia File All text data is in ASCII format The following pseudo-structure describes the Content Description Header..:
Content_description {uint32 Object_id; uint32 size; uint16 Object_version;
if (object_version == 0) {UINT16 title_len; UINT8 [title_len] title; UINT16 author_len; UINT8 [author_len] author; UINT16 copyright_len; UINT8 [copyright_len] copyright; UINT16 comment_len; UINT8 [comment_len] comment;}}
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 10 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
The Content Description Header Contains The Following Fields:
Object_id: 32 Bits The Unique Object ID for the Content Description Header ('Cont'). size: 32 Bits The size of the content description header in bytes.
Object_version: 16 Bits The Version of The Content Description Header Object.
Titl That The Length Data IS Not Null Tertes. This MEMBER IS Present ON All Content Description Header Objects with an Object_version of 0 (Zero).
Title: Variable Length AN Array Of Ascii Characters That Real Desten. This MEMBER IS Present ON All Content Description Header Objects with an Object_version of 0 (ZERO).
Author_len: 16 Bits The Length of The Author Data in Bytes. Note That The Author Data IS Not Null Terminated. This Member IS Present On All Content Description Header Objects with an Object_version of 0 (Zero).
author:. variable length An array of ASCII characters that represents the author information for the RealMedia file This member is present on all Content Description Header objects with an object_version of 0 (zero).
copyright_len: 16 bits The length of the copyright data in bytes Note that the copyright data is not null terminated This member is present on all Content Description Header objects with an object_version of 0 (zero)...
copyright: variable length An array of ASCII characters that represents the copyright information for the RealMedia file This member is present on all Content Description Header objects with an object_version of 0 (zero)..
comment_len: 16 bits The length of the comment data in bytes Note that the comment data is not null terminated This member is present on all Content Description Header objects with an object_version of 0 (zero) .R Agarwal, J. Ayars,... B. HEFTA-GAUB, D. Stammen Page 11 -------------------------------------- ----------------------------------------- Internet-Draft RTSP MARCH 13, 1998
comment: variable length An array of ASCII characters that represents the comment information for the RealMedia file This member is present on all Content Description Header objects with an object_version of 0 (zero)..
3. Data Section
The data section of the RealMedia file consists of a Data Section Header that describes the contents of the data section, followed by a series of interleaved media data packets. Note that the size field of the Data Chunk Header is the size of the entire data chunk , inclinening the Media data packets.
3.1 Data Chunk Header
.. The Data Chunk Header marks the start of the data chunk There is usually only one data chunk in a RealMedia file, however for extremely large files there may be multiple data chunks The following pseudo-structure describes the Data chunk header:
Data_chunk_header {uint32 Object_id; uint32 size; uint16 Object_version;
IF (object_version == 0) {uint32 num_packets; uint32 next_data_header;}}
The Data Chunk Header Contains The Following Fields:
Object_id: 32 Bits The Unique Object ID for the Data Chunk Header ('data').
SIZE: 32 BITS The size of the data chunk in bytes.Object_version: 16 Bits The Version of The Data Chunk Header Object.
R. Agarwal, J. Ayars, B. Hefta-Gaub, D. Stammen Page 12 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 1998
Num_packets: 32 Bits Number of Packets in The Data Chunk. This MEMBER IS Present ON All Data Chunk Header Objects with an Object_version of 0 (Zero).
Next_data_header: 32 Bits Offset from Start of File to the next data chunk. this field is not type 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子 帖子.
3.2 Data Packet Header
The data section of a RealMedia file consists of a series of interleaved data objects. Each data object contains a packet of data for a media stream. Because a RealMedia file can contain numerous media streams, data objects for each stream are interleaved. The following pseudo -Structure Describes The Details of Each Interleaved Packet:
Media_packet_header {uint16 Object_version;
IF (object_version == 0) {uint16 length; uint16 stream_number; uint32 timestamp; uint8 reserved; uint8 flags; uint8 [length] Data;}}
The Media Packet Header Contains The Following Fields:
Object_version: 16 Bits The Version of The Media Packet Header Object.
Length: 16 Bits The Length of The Packet in Bytes. This Member Is Present on All Media Packet Header Objects with an Object_version of 0 (ZERO).
stream_number: 16 bits The 16-bit alias used to associate data packets with their associated Media Properties Header This member is present on all Media Packet Header objects with an object_version of 0 (zero) .R Agarwal, J. Ayars, B... Hefta-Gaub, D. Stammen Page 13 ----------------------------------------- --------------------------------------- Internet-Draft RTSP MARCH 13, 1998
TimeStamp: 32 Bits The TimeStamp of The Packet in Milliseconds this Member IS Present ON All Media Packet Header Objects with an Object_version of 0 (ZERO).
RESERVED: 8 BITS this is not used. This MEMBER IS Present On All Media Packet Header Objects with an Object_version of 0 (ZERO).
Flags: 16 Bits Flags Describing The Properties of the Packet. The Following Flags Are Defined:
o #define pn_reliable_flag 0x0001
IF this flag is set, The packet is delivered reliably.
o #define pn_keyframe_flag 0x0002
IF this flag is set, The packet is part of a key frame or in some way marks a boundary in your data stream.
This Member Is Present ON All Media Packet Header Objects with an Object_version of 0 (Zero).
Data: Variable Length The Application-Specific Media Data. This MEMBER IS Present On All Media Packet Header Objects with an Object_version of 0 (ZERO).
4. INDEX Section
The index section of the RealMedia file consists of a Index Chunk Header that describes the contents of the index section, followed by a series of index records. Note that the size field of the Index Chunk Header is the size of the entire index chunk, including The index records.
4.1 INDEX Section Header
The Index Chunk Header marks the start of the index chunk. There is usually one index chunk per stream in a RealMedia file. The following pseudo-structure describes the Index chunk header.R. Agarwal, J. Ayars, B. Hefta-Gaub, D. Stammen Page 14 --------------------------------------------- ----------------------------------- Internet-Draft RTSP MARCH 13, 1998
Index_chunk_header {u_int32 Object_id; u_int32 size; u_int16 Object_version;
IF (Object_version == 0) {u_int32 num_indices; u_int16 stream_number; u_int32 next_index_header;}}
The INDEX CHUNK HEADER Contains The Following Fields:
Object_id: 32 Bits the Unique Object ID for the index chunk header ('indx').
SIZE: 32 BITS The size of the index chunk in bytes.
Object_version: 16 Bits the Version of The Index Chunk Header Object.
Num_indices: 32 BITS NUMBER OF INDEX RECORDS in The Index Chunk. This Member IS Present On All INDEX Chunk Header Objects with an Object_version of 0 (Zero).
Stream_Number: 16 Bits The Stream Number for Which THEX RECORDS in This Index Chunk Are Associated. This Member IS Present ON All INDEX Chunk Header Objects with an Object_version of 0 (ZERO).
next_index_header: 32 bits Offset from start of file to the next index chunk This field lets RealMedia file format readers find all the index chunks quickly This member is present on all Index Chunk Header objects with an object_version of 0 (zero)...
R. Agarwal, J. Ayars, B. HEFTA-GAUB, D. Stammen Page 15 ------------------------------- ------------------------------------------------ Internet -Draft RTSP MARCH 13, 19984.2 Index Record
.. The index section of a RealMedia file consists of a series of index record objects Each index record contains information for quickly finding a packet of a particular time stamp for a media stream The following pseudo-structure describes the details of each index record:
IndexRecord {uint16 object_version;
IF (Object_version == 0) {u_int32 timestamp; u_int32 offset; u_int32 packet_count_for_this_packet;}}
An Index Record Contains the Following Fields:
Object_version: 16 Bits The Version of The Index Record Object.
Timestamp: 32 Bits The TimeStamp in Milliseconds Associated with this record. This Member is presents with an Object_version of 0 (zero).
Offset: 32 Bits The Offset from The Start of The File at Which This Packet Can Be Found. This MEMBER IS Present ON All INDEX RECORD Objects with an Object_version of 0 (ZERO).
packet_count_for_this_packet:. 32 bits The packet number of the packet for this record This is the same number of packets that would have been seen had the file been played from the beginning to this point This member is present on all Index Record objects with an object_version. Of 0 (ZERO).
R. Agarwal, J. Ayars, B. Hefta-Gaub, D. Stammen Page 16ORIGINAL