RTMP是什么

 

Real Time Messaging Protocol (RTMP) is a proprietary protocol developed by Adobe Systems for streaming audio, video and data over the Internet, between a Flash player and a server.

实时消息协议(RTMP)是Adobe公司开发的专利协议,是为了flash播放器和服务器之间通过因特网交换流化的音频,视频及其他数据的交换。

The RTMP protocol has three variations: 此协议有三种不同的版本变种

  1. The "plain" protocol which works on top of TCP and uses port number 1935

TCP协议之上的“平板”协议,默认端口是1935。

  1. RTMPT which is encapsulated within HTTP requests to traverse firewalls

包装在HTTP请求里的RTMPT协议,可以穿透防火墙。

  1. RTMPS which works just like RTMPT, but over a secure HTTPS connection.

和RTMPT效果类似的RTMPS协议,但是在安全的HTTPS连接上用。

While the primary motivation for RTMP was a persistent protocol for Flash, it is also used in some other applications, such as the Adobe LiveCycle Data Services ES.

虽然开发RTMP的原始动机是flash的长连接协议,但是他也有其他的一些应用,如Adobe LiveCycle Data Services ES

 

 

The raw TCP-based RTMP protocol maintains a single persistent connection and allows real-time communication.

基于TCP的原始RTMP协议维护了一个唯一的长连接,允许实时通信。

To guarantee smooth delivery of video and audio streams, while still maintaining the ability to transmit bigger chunks of information, the protocol may split video and data into fragments.

为了保证视频和音频流的平滑传送,在传送大数据量时也维持这种能力,协议可能把视频和数据分成碎片进行传输。

The size of the fragments used can be negotiated dynamically between the client and server, and even disabled completely if desired, although the default fragment sizes are 128 bytes for video and most other data types, and 64-bytes for audio data.

碎片的大小可以在客户端和服务器端之间进行动态的商定;尽管对于视频和大多数其他类型的数据默认的碎片大小是128字节,对于音频数据默认是碎片大小是64字节,如果需要也可以完全不使用。

Fragments from different streams may then be interleaved and multiplexed over a single connection.

来自不同流的碎片数据可以通过同一链接“交错”“多路”的进行传输。

With longer data chunks, the protocol would then only carry a one-byte header per fragment, thus incurring very little overhead.

对于较长数据束,协议会安置一个字节的碎片头,因而数据量要增加一些。

In practice however, individual fragments are not typically interleaved.

实际上,单独的碎片不常交错。

Instead, the interleaving and multiplexing is done at the packet level, with RTMP packets across several different active channels being interleaved in such a way to ensure that each channel meets its bandwidth, latency, and other quality of service requirements.

实际上,交错和多路是在包级别上完成的RTMP包跨越多个不同的交错通道,这中情况确保每个通道满足他的带宽,延时等其他的服务质量要求。

Packets interleaved in this fashion are treated as indivisible, and are not interleaved on the fragment level.

这中方式交错的包统一处理,并不是在碎片的级别上交错

 

The RTMP protocol defines several channels on which packets may be sent/received, and which operate independently of each other.

RTMP协议定义了收/发包的多个通道,每个通道彼此独立。

For example, there is a channel dedicated for handling RPC requests and responses, a channel for video stream data, a channel for audio stream data, a channel for out-of-band control messages (fragment size negotiation, etc.), and so on.

例如,一个通道专门用来处理RPC(远程方法调用)的请求和响应,一个通道用来处理视频流,一个通道用来处理音频流数据,一个通道负责带宽控制信息(碎片大小的协商等)等等。

During a typical RTMP session, several channels may be active simultaneously at any given time.

在一个典型的RTMP会话,多个通道可能在任何给定的时间同时激活。

When RTMP data is packetized, a packet header is generated.

当RTMP数据打了包,包头也就产生了。

The packet header specifies, among other things, the id of the channel that it is to be sent on, the timestamp at which is was generated (if necessary), and the size of the packet payload.

除了其他的事情,包头指定了通道的id,id是要被发送的,(有必要)包的产生时间和包有效负荷的大小。

This is then followed by the packet payload, which is fragmented according to the currently agreed-upon fragment size before it is serialized over the connection.

跟着包的有效负载的数据,他是根据当前协商的碎片的大小的碎片数据。数据碎片化是在他所在的链接上序列化之前进行的。

The packet header itself is never fragmented, and its size does not count towards the data in the packet's first fragment.

包头自身并不会碎片化,他的大小不计于包的第一个碎片的数据中。

In other words, only the actual packet payload data is subject to fragmentation.

换一句话说,对碎片而言,实际的包的负载数据是目标。

 

At a higher level, the RTMP protocol encapsulates MP3 and Flash Video multimedia streams, and can make remote procedure calls (RPCs) using the Action Message Format.

更高的级别上,使用AMF,RTMP协议封装了MP3和FlashVideo多媒体流,并且可以远程方法调用(RPCs)。

 

Other RPC services are made asynchronously with a single client/server request/response model, so real-time communication is not necessary.[clarify][1]

单一的客户/服务,请求/响应模式,也有其他的异步RPC服务,如果实时通信没有必要。

 

 

HTTP tunneling

Many corporate network firewalls block connections via unrecognised ports and protocols;

很多公司网络的防火墙,因为无法识别的端口和协议会阻止连接。

for this reason, a variant called RTMPT (RTMP Tunneled) was developed.

因为这个原因,开发了变种RTMPT(RTMPTunneled)。

This protocol encapsulates the RTMP data in valid HTTP requests, and by default communicates on port 80.

此协议把RTMP数据封装在有效的HTTP请求中,默认的通信端口是80。

While RTMPT requires slightly higher bandwidth due to the addition of HTTP headers, the protocol can be used successfully in environments where security measures would block RTMP.

 

This approach also works on secured HTTPS connections, in which case it is called RTMPS (RTMP Secure).

 

 

RTMP客户端软件

The most well-know RTMP client is Adobe's Flash player which can stream video and audio from RTMP servers. Recently, the open source media player XBMC has acquired preliminary support for playing RTMP streams in its SVN version (see the patch).

 

RTMP服务端软件

Currently, the only full implementation RTMP servers are the Adobe Flash Media Server, Wowza Media Server and WebORB Integration Server (free and available for .NET, Java and ColdFusion) both commercial and closed source implementations.

目前,完全实现RTMP的服务器有Adobe Flash Media Server,Wowza Media Server和WebORB Integration Server (free and available for .NET, Java and ColdFusion)。

There is a reverse engineeredopen source project called Red5 which aims to produce a feature-complete implementation written in Java.

有一个逆向工程的开源工程,叫Red5,他的目标是用java编写完全实现RTMP。

As of October 2007, the majority of the functionality is implemented, although the project is still in the beta stage. There are some other RTMP-servers with basic functionality available over at Google Code

 

See also

Real Time Media Flow Protocol (RTMFP) based on User Datagram Protocol (UDP)

 

总结,RTMP协议好像是传输层的协议。是基于TCP的协议,创建的连接是长连接。结合AMF,可以封装多媒体流,进行RPC。AMF可以看成是表示层上的协议。像使用Red5和Flash做开发,前后台的商定就是应用层的协议了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值