版权声明:转载自http://blog.csdn.net/fangshy/archive/2007/04/14/1564736.aspx

Appendix E: RealMedia File Format (RMFF)

Helix Architecture supports RealMedia File Format (RMFF), which enables Helix to deliver high- quality multimedia content over a variety of network bandwidths. Third-party developers can convert their media formats into RMFF, enabling Helix Universal Server to deliver the files to RealOne Player or other applications built with the Helix Client and Server Software Development Kit. Third-party developers can thereby use Helix 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;  }}

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 Properties Header 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).

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 average 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).

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 prebuffer 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).

flags: 16 bits

Flags indicating characteristics of the RealMedia file. The following flags are defined:

  • #define PN_SAVE_ENABLED 0x0001

    Allows clients to save a copy of the RealMedia file to disk.

  • #define PN_PERFECT_PLAY_ENABLED 0x0002

    Allows clients to use extra buffering to ensure Perfect Play.

  • #define PN_LIVE_BROADCAST 0x0004

    The RealMedia file is being generated by a live broadcast.

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;

  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).

avg_bit_rate: 32 bits

The average 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).

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 average 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 time stamp 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 time stamp 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 nonunique 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).

mime_type: variable length

A nonunique MIME style type/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).

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;  }}

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.

title_len: 16 bits

The length of the title data in bytes. Note that the title data is not null-terminated. 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 represents the title information for the RealMedia file. 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).

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).

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, including the media data packets.

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 pseudostructure 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.

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 typically used. This member is present on all Data Chunk Header objects with an object_version of 0 (zero).

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).

timeStamp: 32 bits

The time stamp 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:

#define PN_RELIABLE_FLAG 0x0001

If this flag is set, the packet is delivered reliably.

#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).

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.

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.

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 the index 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 enables RealMedia file format readers to find all the index chunks quickly. This member is present on all Index Chunk Header objects with an object_version of 0 (zero).

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 time stamp (in milliseconds) associated with this record. This member is present on all Index Record objects 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).

视频容器解析之RealMedia File Format相关推荐

  1. 3GP/MP4 视频文件格式解析及其播放原理(转)

    视频文件格式解析之 3GP/MP4 1. 概述 流行的文件格式背后都有大公司的支持.FLV得益于ADOBE公司推动的网络视频分享风潮,而AVI则是MICROSOFT首创的RIFF即视频和音频交 织在一 ...

  2. 视频文件格式解析之 3GP/MP4 .

    1. 概述 流行的文件格式背后都有大公司的支持.FLV得益于ADOBE公司推动的网络视频分享风潮,而AVI则是MICROSOFT首创的RIFF即视频和音频交 织在一起同步播放. 3GP/MP4是APP ...

  3. 阿甘的巧克力盒子: 手机视频文件格式解析之 3GP/MP4

    作者: k歌之王     2009-08-23 前言:做完了手机全能播放器的项目, 又要告别几个月来并肩作战,即将去北京发展的Manager zhu.准备把 做过的3GP/FLV/AVI格式整理一遍, ...

  4. 手机视频文件格式解析之 3GP/MP4

    转载自百度文库 作者: k歌之王      2009-08-23 前言:做完了手机全能播放器的项目, 又要告别几个月来并肩作战,即将去北京发展的Manager zhu.准备把 做过的3GP/FLV/A ...

  5. 视频文件格式解析之 3GP与MP4

    1. 概述 流行的文件格式背后都有大公司的支持.FLV得益于ADOBE公司推动的网络视频分享风潮,而AVI则是MICROSOFT首创的RIFF即视频和音频交 织在一起同步播放. 3GP/MP4是APP ...

  6. 视频文件格式解析之 3GP/MP4

    1. 概述 流行的文件格式背后都有大公司的支持.FLV得益于ADOBE公司推动的网络视频分享风潮,而AVI则是MICROSOFT首创的RIFF即视频和音频交 织在一起同步播放. 3GP/MP4是APP ...

  7. OpenCV读写视频文件解析(二)

    OpenCV读写视频文件解析(二) VideoCapture::set 设置视频捕获中的属性. C++: bool VideoCapture::set(int propId, double value ...

  8. 音视频方案,音视频扩展内容- 音视频数据解析,码流分析及质量评价(笔记)3

    -- 音视频编解码流程如下图: -- 关于音频各种参数: freq:音频数据的采样率.常用的有48000,44100等. format:音频数据的格式.举例几种格式: AUDIO_U16SYS:Uns ...

  9. Java使用FFmpeg(自定义cmd)系列之获取视频/音频时长(File文件方式)

    ffmpeg系列 Java使用FFmpeg(自定义cmd) Java使用FFmpeg(自定义cmd)系列之获取视频/音频时长 Java使用FFmpeg(自定义cmd)系列之官方API获取视频/音频信息 ...

最新文章

  1. Logstic与Softmax比较
  2. 开发手记之-在Winform中为ListBox的添加选项值,并增加双击事件
  3. Spring中的@ Component,@ Repository和@Service批注有什么区别?
  4. 使用生成器创建新的迭代模式
  5. Jelastic Java云端平台
  6. matlab粒子图像测速工具,程序 PIVlab - 时间分辨粒子图像测速(PIV)工具: 一 联合开发网 - pudn.com...
  7. SpringCloud Alibaba-Nacos 的使用
  8. python文件读取每一行操作
  9. (best!)JAVA中文字符编码问题详解
  10. 一位网友在某职业论坛上就发了一个相关的帖子
  11. 王者荣耀女性机器人面世;深圳中院受理金立破产案;Firefox 64 发布 | 极客头条...
  12. SAP Java Connector 错误 - JCO_ERROR_COMMUNICATION
  13. 单片机仿真软件Proteus安装时遇到的问题
  14. SDKD 2021 C3 7th Round
  15. Imagine中文文档
  16. Compilation error :org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
  17. 深度学习:loss损失不下降
  18. python之bt种子,dht网络共享热门资源
  19. Java.Net互操作技术介绍
  20. 【原创】关于联想Y400适配器和电池同时使用无法开机的问题

热门文章

  1. 计算机应用基础马成荣教案,2016江苏省职业学校计算机应用基础(马成荣主编)课程两课评比教案:我是小小导游员2.doc...
  2. 360浏览器人机交互
  3. 华为手机能隐藏蓝牙吗_一张图教你玩转华为手机图库 原来还隐藏了多重智慧...
  4. vue中style的scoped属性
  5. 万用表可以测量自身的电池电压吗?
  6. unique_lock与lock_guard区别
  7. 论文阅读笔记(4-1)---基于深度神经网络的动态心电图心律不齐检测与分类
  8. 【图片标注】推荐一款特别好用的图片分割标注工具EIseg
  9. 2022 年全球10大最佳自动化测试工具
  10. python nonlocal叠加_python nonlocal 的具体原理