Real Time Messaging Protocol

Real Time Messaging Protocol (RTMP) is a system for delivering on-demand and live media to Adobe Flash applications such as audio and video streaming in addition to real-time communications platforms. It was developed by Adobe Systems for this purpose, and is an example of a traditional streaming protocol, though there are many versions of these used on the web.  Adobe Systems published the RTMP specification in June of 2009, making it possible for Content Delivery Networks and other enterprises using Flash technology to author their own implementation.  RTMP supports video in MP4 and FLV and audio in AAC and MP3, and offers several advantages over regular HTTP video downloads.  These include that RTMP is capable of live streaming (thus allowing people to watch a video as it’s being recorded), that it can do dynamic streaming (where the video quality adjusts automatically to bandwidth changes), that players can seek to later parts in a video (useful for longer videos), and that the player maintains a marginal buffer (rather than downloading a video during playback – thus using less bandwidth).  However, there are several drawbacks to RTMP as well, namely that it uses different protocols and ports than HTTP (making it vulnerable to being blocked by firewalls – preventable by streaming in RTMPT, but that drags down server performance), that the connection bandwidth needs to be larger than the data-rate for videos (since RTMP is streamed to the player), and that RTMP works only in Flash but not HTML5.  The last disadvantage will eventually cause RTMP to be replaced by other streaming protocols with wider support, like Apple’s HLS.

There are various forms of client software (both freeware and paid) which use RTMP, including Adobe Flash Player, VLC Media Player, XBMC media player, Gnash, Stream Transport, GuguRadio, StreamS HiFi Radio, Internet Radio Player (for Android), and Open Broadcaster Software.  These are all audio or video players, highlighting the areas in which RTMP is most successfully utilized to its full advantage.


RTMP itself is a TCP-based protocol which maintains persistent connections and allows low-latency communication.  By splitting streams into fragments and negotiating their size, it can deliver streams smoothly while transmitting as much information as possible.  Since the RTMP protocol will only carry a single byte header with longer data streams, it incurs little in terms of overhead costs. RTMP’s streaming capabilities offer the advantage of being able to skip forward to anywhere in a video at any point in time, rather than the case with HTTP, where you can only view what’s already in your browser cache.  So you can skip forward to what you want to see, without any unnecessary waiting.  But if you’re using RTMP as a protocol, your host or CDN will need to have a dedicated server installed for RTMP.

After a TCP connection is established, RTMP first performs a handshake via exchanging three packets from each side.  The packets exchanged have their own structure, and include client sent packets and packets from the server end – not to be confused with RTMP packets themselves, which can only be exchanged after the completion of the handshake.  The client initializes the connection by sending a certain packet, followed immediately by another without waiting for the first to be received.  After there is a response, the handshake is completed.  After this is completed, the client and server negotiate a connection by exchanging AMF encoded messages, including key value pairs related to the variables needed to establish a connection.  Since RTMP is defined as a stateful protocol, it means that from the first time a client connects, the server will keep track of the client’s actions until the time that it disconnects.

Related Posts