RealMedia FormatThis is the newer format which stores both audio and video. All multi-byte numbers are stored in big-endian format.A RealMedia file consists of a series of chunks. Each chunk has the following format:dword chunk type (FOURCC)dword chunk size, including 8-byte preambleword chunk versionbyte[] chunk payloadReal chunk types:∙.RMF: RealMedia file header (only one per file, must be the first chunk)∙PROP: File properties (only one per file)∙MDPR: Stream properties (one for each stream)∙CONT: Content description/metadata (typically one per file)∙DATA: File data∙INDX: File index (typically one per stream)RealMedia file header (.RMF)This must be the first chunk in a RealMedia file. Only one .RMF can be present in a file. The only useful information carried by .RMF is the number of headers.A .RMF chunk has the following formatdword chunk type ('.RMF')dword chunk size (typically 0x12)word chunk version (always 0, for every known file)dword file versiondword number of headersFile properties header (PROP)This chunk contains some information about the general properties of a RealMedia file. Only one PROP chunk can be present in a file.A PROP chunk has the following formatdword Chunk type ('PROP')dword Chunk size (typically 0x32)word Chunk version (always 0, for every known file)dword Maximum bit ratedword Average bit ratedword Size of largest data packetdword Average size of data packetdword Number of data packets in the filedword File duration in msdword Suggested number of ms to buffer before starting playback dword Offset of the first INDX chunk form the start of the file dword Offset of the first DATA chunk form the start of the fileword Number of streams in the fileword Flags (bitfield, see below)Flags:∙bit 0: file can be saved on disk∙bit 1: PerfectPlay can be used (extra buffering)∙bit 2: the file is a live broadcastMedia properties header (MDPR)This chunk contains information about the properties of a RealMedia stream. This header defines the type of a stream and the codec used. Allcodec-related data is in the type specific part of this header.Many fields share the same meanings as the ones in PROP chunk, but in this case they are specific for one stream.There is one MDPR chunk for every stream in the file.A MDPR chunk has the following formatdword Chunk type ('MDPR')dword Chunk sizeword Chunk version (always 0, for every known file)word Stream numberdword Maximum bit ratedword Average bit ratedword Size of largest data packetdword Average size of data packetdword Stream start offset in msdword Preroll in ms (to be subtracted from timestamps?)dword Stream duration in msbyte Size of stream description stringbyte[] Stream description stringbyte Size of stream mime type stringbyte[] Mime type stringdword Size of type specific part of the headerbyte[] Type specific data, meaning and format depends on mime typeAudio (audio/)audio/x-pn-realaudio and audio/x-pn-multirate-realaudioThese mimetypes are used to specify streams with RealAudio codecs. There are 3 known versions of this datablock: ra3, ra4, ra5. ra3 is used only with the old 14_4 codec, ra4 and ra5 can be used with all the other codecs.The audio block has this formatbyte[4] Header signature ('.', 'r', 'a', 0xfd)word Version (3, 4 or 5)#if version == 3word Header size, not including first 8 bytesbyte[10] Unknowndword Data sizebyte Title string lengthbyte[] Title stringbyte Author string lengthbyte[] Author stringbyte Copyright string lengthbyte[] Copyright stringbyte Comment string lengthbyte[] Comment stringbyte Unknown *byte Fourcc string length (always 4) *byte[] Fourcc string (always "lpcJ") *#elseif version == 4 or version == 5word Unused (always 0)byte[4] ra signature (".ra4" or ".ra5", depending on version)dword Unknown (maybe data size)word Version2 (always equal to version)dword Header sizeword Codec flavordword Coded frame sizebyte[12] Unknownword Sub packet hword Frame sizeword Subpacket sizeword Unknown#if version == 5byte[6] Unknown#endifword Samplerateword Unknownword Sample sizeword Channels#if version == 4byte Interleaver ID string length (always 4)byte[] Interleaver ID stringbyte FourCC string length (always 4)byte[] FourCC string#endif#if version == 5dword Interleaver IDdword FourCC#endifbyte[3] Unknown#if version == 5byte Unknown#endifdword Codec extradata lengthbyte[] Codec extradata#endifaudio/X-MP3-draft-00This is used to store MP3 audio in rm container. When this mimetype is used the type-specific part of the MDPR header is not used, and its length is set to 0.The MP3 frames are stored in ADU format (see RFC 3119 for details) with no interleaving (at least this is true in the only known sample).audio/x-ralf-mpeg4This is used to store ralf lossless audio. This is the only known RealAudio codec that does not use the x-pn-realaudio mimetype.The format of this type-specific data is not known.Content description header (CONT)This chunk contains some text information (like title, author, ...) about the content of the file. This header has an informative purpose only and it's not needed to demux the file.A CONT chunk has the following formatdword Chunk type ('CONT')dword Chunk sizeword Chunk version (always 0, for every known file)word Title string lengthbyte[] Title stringword Author string lengthbyte[] Author stringword Copyright string lengthbyte[] Copyright stringword Comment string lengthbyte[] Comment stringData header (DATA)This chunk contains a group of data packets. Packets from each stream are interleaved, except for multirate files.A DATA chunk has the following formatdword Chunk type ('DATA')dword Chunk sizeword Chunk version (always 0, for every known file)dword Number of data packets in this chunkdword Offset of the next DATA chunk (form the start of the file) byte[] Data packetsEach data packet has this formatword Packet version (0 or 1 in available samples)word Packet sizeword Stream numberdword Timestamp (in ms)byte Unknownbyte Flags (bitfield, see below)#if version == 1byte Unknown#endifbyte[] Stream-specific dataFlags:∙bit 0: reliable packet (refers to network transmission method)∙bit 1: keyframeNote: The previous description of the data packet comes from working demuxer code, the description in official Real docs (somewhere on Helix site) is a bit different:word Packet versionword Packet sizeword Stream numberdword Timestamp#if version == 0byte Packet groupbyte Flags#endif#if version == 1word ASM rulebyte ASM flags#endifbyte[] Stream-specific datawhere packet group is "The packet group to which the packet belongs. If packet grouping is not used, set this field to 0 (zero)", asm rule is "The ASM rule assigned to this packet" and asm flags "Contains HX_ flags that dictate stream switching points".Index header (INDX)This chunk contains index entries. It comes after all the DATA chunks. An index chunk contains data for a single stream, A file can have more than one INDX chunk.A INDX chunk has the following formatdword Chunk type ('INDX')dword Chunk sizeword Chunk version (always 0, for every known file)dword Number of entries in this chunkword Stream numberdword Offset of the next INDX chunk (form the start of the file) byte[] Index entriesEach index entry has this formatword Entry version (always 0, for every known file)dword Timestamp (in ms)dword Packet offset in file (form the start of the file)dword Packet number。