Real Time Messaging Protocol
Encyclopedia
Real Time Messaging Protocol (RTMP) was initially a proprietary protocol
developed by Macromedia for streaming
audio, video and data over the Internet, between a Flash
player and a server. Macromedia is now owned by Adobe
, which has released the specification of the protocol for public use.
The RTMP protocol has multiple variations:
While the primary motivation for RTMP was to be a protocol for playing Flash video, it is also used in some other applications, such as the Adobe LiveCycle Data Services ES.
, and multiplexed over a single connection. With longer data chunks the protocol thus carries only a one-byte header per fragment, so incurring very little overhead. However, in practice 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 as to ensure that each channel meets its bandwidth, latency, and other quality-of-service requirements. Packets interleaved in this fashion are treated as indivisible, and are not interleaved on the fragment level.
The RTMP defines several channels on which packets may be sent/received, and which operate independently of each other. For example, there is a channel 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. During a typical RTMP session, several channels may be active simultaneously at any given time. When RTMP data is encoded, a packet header is generated. The packet header specifies, amongst other matters, the id of the channel on which it is to be sent, a timestamp of when it was generated (if necessary), and the size of the packet's payload. This header is then followed by the actual payload content of the packet, which is fragmented according to the currently agreed-upon fragment size before it is sent 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 (the media data) is subject to fragmentation.
At a higher level, the RTMP encapsulates MP3
or AAC
audio and FLV1 video multimedia streams, and can make remote procedure call
s (RPCs) using the Action Message Format
. Any RPC services required are made asynchronously, using a single client/server request/response model, such that real-time communication is not required.
It is generally understood that the SSL handshake at the beginning of a session is very computationally intensive. Adobe developed RTMPE as a lighter weight alternative, to make it more practical for high-traffic sites to serve encrypted content. Adobe advertises RTMPE as a method for secure content delivery, protecting against client impersonation but this claim is false. RTMPE only uses Anonymous Diffie-Hellman which provides no verification of either party's identity, and as such is vulnerable to trivial man-in-the-middle attack
s.
and exchanged via HTTP
, and messages from the client (the media player, in this case) are addressed to port 80 (the default for HTTP) on the server.
While the messages in RTMPT are larger than the equivalent non-tunneled RTMP messages due to HTTP headers, RTMPT may facilitate the use of RTMP in scenarios where the use of non-tunneled RTMP would otherwise not be possible, such as when the client is behind a firewall that blocks non-HTTP and non-HTTPS outbound traffic.
The protocol works by sending commands through the POST url and AMF messages through the POST body. An example is
for a connection to be opened
, which supports playback of audio and video streamed from RTMP servers (when installed as a web browser plug-in).
Client software with only partial support for RTMP includes the open source
media player XBMC, which has preliminary support for playing RTMP (but not RTMPE) streams.
The open-source command-line tool RTMPdump is designed to playback or save to disk the full RTMP stream including the RTMPE protocol Adobe uses for encryption. RTMPdump runs on Linux. Originally supporting all versions of 32-bit Windows including Windows 98, from version 2.2 the software will run only on Windows XP and above (although earlier versions remain fully functional).
A fork of RTMPdump, without the code which Adobe claims violates the DMCA in the USA, has been released as FLVstreamer. This was developed as a direct response to Adobe's attempt in 2008 to suppress RTMPdump. FLVstreamer will save to disk ("download") a stream of audio or video content from any RTMP server, provided RTMPE is not enabled on the stream. It runs on Windows XP and above, but not on earlier versions of Windows.
Development of RTMPdump was restarted in October 2009, outside the United States, at the MPlayer
site. The current version features greatly improved functionality, and has been rewritten to take advantage of the benefits of the C programming language
.
Gnash
, an open source replacement for the Macromedia Flash Player on the Linux platform, intends to support RTMP streaming for Linux.
Within the United States of America, software which contains measures for circumventing copy-protection code may be in breach of the U.S. Digital Millenium Copyright Act (DMCA). It is considered that only software which removes encryption from an RTMP stream (i.e. which unencrypts an RTMPE stream) is affected by that Act, and only if that software is used in, or hosted on a server within, the United States. In fact RTMPE is not a copy-protection mechanism, and as such the provisions of the DMCA are not applicable. Adobe is liable for initiating a false action under the Act, but thus far has not been prosecuted for their misuse of the DMCA.
The Adobe license to use this protocol requires that implementations of RTMP servers meet this specification.
Details missing from Adobe's published specification include:
The formal process is: the client software, such as rtmpdump, issues a request to the RTMP server for a connection, by sending a command including the requisite elements, thereby initiating the process of negotiating a connection. Such a command may be constructed using connection and authentication information obtained previously from the server by client software applications such as rtmpsrv.
A. For a Limelight server
The foregoing are typically the only elements (or "switches") that are essential to a connection, if neither Tunnelling nor Encryption are in use by the server. Although other elements may be encountered in practice, they are normally non-essential.
Hence the following elements are typically sent by the client software application, as a single command line -
The parts comprising the -a (or -—app) element must be incorporated in it in the order shown above, as the sequence in which its parts are received by the RTMP server is critical.
The authentication strings (et= and fmta-token=) contain session information, so will change on each fresh connection made to the server (which in practice typically means they will expire if a new session is begun, not literally on every attempt to resume a connection), but the other elements will not usually vary from session to session.
B. For an Akamai server
The command line is typically as above, except that the -a (or -—app) element contains the following parts instead -
Hence the following elements are typically sent by the client software application, as a single command line -
The parts comprising the -a (or -—app) element must be incorporated in it in the order shown above, as the sequence in which its parts are received by the RTMP server is critical.
The authentication string (auth=) contains session information, so will change on each fresh connection made to the server (typically, if a new session is begun, e.g. the computer is restarted, not literally on every attempt to resume a connection). The other parts will not usually vary from session to session.
Note - The above describes the simplified form, whereby the stream is first saved to the user's hard disk, to be played back thereafter in a media player capable of playing an FLV encoded file (H.263 or H.264 encoding), such as GOM Player. If it's desired, instead, to play the stream directly from the RTMP server, thus giving immediate playback, additional elements will be needed in the command line including -
-f : This specifies the version of the Flash plugin installed on the user's computer. For example, -f "WIN 9,0,260,0" would indicate the user has the Windows version of Flash Player 9, release 260
-W : The capital W command. This is the URL address of the SWF player used to play the stream, as indicated by the web page from which the stream is derived. For example, path/9player.swf?revision=18269_21576
A. For an Akamai server
The command line is typically as for an Akamai on-demand stream. But the -a (or -—app) element contains the following parts
Note - If the slist string contains two or more alternative streams (i.e. offers a choice of streams at alternative bitrates), the playpath element (--playpath or -y) specifies the one chosen by the user, as the identifier item.
Hence the following sequence is typically sent by the client software application, as a single command line -
All these items are mandatory, and must be included in the order shown above. The string following the ? (question mark) in both the -a and -—playpath elements will typically be identical. The identifier item will typically be a sub-set of the slist data (if the latter offers a choice), otherwise they too will be identical. The -o element can specify an output filename chosen by the user.
Specifying the complete playpath is unnecessary, as that element is constructed in memory by the client application. Typically, in memory it takes the following form -
-y xxxxx_x_@xxxx?auth=[62 characters]&aifp=v001&slist=xxxxx_x_@xxxx,xxxxx_x_@xxxx
data inside HTTP POST request and responses. The sequence for connection is as follows:
The first request has an /fcs/ident2 path and the correct reply is a 404 Not Found error. The client then sends an /open/1 request where the server must reply with a 200 ok appending the a random number that will be used as the session identifier for the said communication. In this example 1728724019 is returned in the response body.
From now on the /idle// is a polling request where the session id has been generated and returned from the server and the sequence is just a number that increments by one for every request. The appropriate response is a 200 OK with an 0x01 single byte returned. AMF
data is sent through /send//
This complete the handshake for an app named "sample". For most implementations of media servers this is just a folder on the root directory with the specified name, inside of which media data exist. After that polling requests are sent with an incremental sequence number and stream playing commands are sent through /send/... and an AMF body. Lastly, a stream is created and data starts being sent back from the server through:
Proprietary protocol
In telecommunications, a proprietary protocol is a communications protocol owned by a single organization or individual.-Enforcement:Proprietors may enforce restrictions through patents and by keeping the protocol specification a trade secret...
developed by Macromedia for streaming
Streaming media
Streaming media is multimedia that is constantly received by and presented to an end-user while being delivered by a streaming provider.The term "presented" is used in this article in a general sense that includes audio or video playback. The name refers to the delivery method of the medium rather...
audio, video and data over the Internet, between a Flash
Adobe Flash
Adobe Flash is a multimedia platform used to add animation, video, and interactivity to web pages. Flash is frequently used for advertisements, games and flash animations for broadcast...
player and a server. Macromedia is now owned by Adobe
Adobe Systems
Adobe Systems Incorporated is an American computer software company founded in 1982 and headquartered in San Jose, California, United States...
, which has released the specification of the protocol for public use.
The RTMP protocol has multiple variations:
- The "plain" protocol which works on top of TCPTransmission Control ProtocolThe Transmission Control Protocol is one of the core protocols of the Internet Protocol Suite. TCP is one of the two original components of the suite, complementing the Internet Protocol , and therefore the entire suite is commonly referred to as TCP/IP...
and uses port number 1935 by default. - RTMPS which is RTMP over a secure SSLTransport Layer SecurityTransport Layer Security and its predecessor, Secure Sockets Layer , are cryptographic protocols that provide communication security over the Internet...
connection using HTTPSHttpsHypertext Transfer Protocol Secure is a combination of the Hypertext Transfer Protocol with SSL/TLS protocol to provide encrypted communication and secure identification of a network web server...
. - RTMPE which is RTMP encrypted using Adobe's own security mechanism. While the details of the implementation are proprietary, the mechanism uses industry standard cryptography primitives. Unfortunately the design of RTMPE is fundamentally flawed and provides no actual security in itself.
- RTMPT which is encapsulatedEncapsulation (networking)In computer networking, encapsulation is a method of designing modular communication protocols in which logically separate functions in the network are abstracted from their underlying structures by inclusion or information hiding within higher level objects....
within HTTP requests to traverse firewalls. The encapsulated session may carry plain RTMP, RTMPS, or RTMPE packets within.
While the primary motivation for RTMP was to be a protocol for playing Flash video, it is also used in some other applications, such as the Adobe LiveCycle Data Services ES.
Operation
RTMP (except RTMFP) is a TCP-based protocol which maintains persistent connections and allows low-latency communication. To deliver streams smoothly and transmit as much information as possible, it splits streams into fragments and their size is negotiated dynamically between the client and server while sometimes it is kept unchanged: the default fragment sizes are 64-bytes for audio data, and 128 bytes for video data and most other data types. Fragments from different streams may then be interleavedInterleaving
In computer science and telecommunication, interleaving is a way to arrange data in a non-contiguous way to increase performance.It is typically used:* In error-correction coding, particularly within data transmission, disk storage, and computer memory....
, and multiplexed over a single connection. With longer data chunks the protocol thus carries only a one-byte header per fragment, so incurring very little overhead. However, in practice 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 as to ensure that each channel meets its bandwidth, latency, and other quality-of-service requirements. Packets interleaved in this fashion are treated as indivisible, and are not interleaved on the fragment level.
The RTMP defines several channels on which packets may be sent/received, and which operate independently of each other. For example, there is a channel 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. During a typical RTMP session, several channels may be active simultaneously at any given time. When RTMP data is encoded, a packet header is generated. The packet header specifies, amongst other matters, the id of the channel on which it is to be sent, a timestamp of when it was generated (if necessary), and the size of the packet's payload. This header is then followed by the actual payload content of the packet, which is fragmented according to the currently agreed-upon fragment size before it is sent 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 (the media data) is subject to fragmentation.
At a higher level, the RTMP encapsulates MP3
MP3
MPEG-1 or MPEG-2 Audio Layer III, more commonly referred to as MP3, is a patented digital audio encoding format using a form of lossy data compression...
or AAC
Advanced Audio Coding
Advanced Audio Coding is a standardized, lossy compression and encoding scheme for digital audio. Designed to be the successor of the MP3 format, AAC generally achieves better sound quality than MP3 at similar bit rates....
audio and FLV1 video multimedia streams, and can make remote procedure call
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
s (RPCs) using the Action Message Format
Action Message Format
Action Message Format is a binary format used to serialize objects graphs such ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives....
. Any RPC services required are made asynchronously, using a single client/server request/response model, such that real-time communication is not required.
Encryption
RTMP sessions may be encrypted using either of two methods:- Using industry standard SSL mechanisms. The underlying RTMP session is simply wrapped inside a normal SSL session.
- Using RTMPE, which wraps the RTMP session in a lighter-weight encryption layer.
It is generally understood that the SSL handshake at the beginning of a session is very computationally intensive. Adobe developed RTMPE as a lighter weight alternative, to make it more practical for high-traffic sites to serve encrypted content. Adobe advertises RTMPE as a method for secure content delivery, protecting against client impersonation but this claim is false. RTMPE only uses Anonymous Diffie-Hellman which provides no verification of either party's identity, and as such is vulnerable to trivial man-in-the-middle attack
Man-in-the-middle attack
In cryptography, the man-in-the-middle attack , bucket-brigade attack, or sometimes Janus attack, is a form of active eavesdropping in which the attacker makes independent connections with the victims and relays messages between them, making them believe that they are talking directly to each other...
s.
HTTP tunneling
In RTMP Tunneled (RTMPT), RTMP data is encapsulatedEncapsulation (networking)
In computer networking, encapsulation is a method of designing modular communication protocols in which logically separate functions in the network are abstracted from their underlying structures by inclusion or information hiding within higher level objects....
and exchanged via HTTP
Hypertext Transfer Protocol
The Hypertext Transfer Protocol is a networking protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web....
, and messages from the client (the media player, in this case) are addressed to port 80 (the default for HTTP) on the server.
While the messages in RTMPT are larger than the equivalent non-tunneled RTMP messages due to HTTP headers, RTMPT may facilitate the use of RTMP in scenarios where the use of non-tunneled RTMP would otherwise not be possible, such as when the client is behind a firewall that blocks non-HTTP and non-HTTPS outbound traffic.
The protocol works by sending commands through the POST url and AMF messages through the POST body. An example is
POST /open/1 HTTP/1.1
for a connection to be opened
Client software
The most widely adopted RTMP client is Adobe Flash PlayerAdobe Flash Player
The Adobe Flash Player is software for viewing multimedia, Rich Internet Applications and streaming video and audio, on a computer web browser or on supported mobile devices. Flash Player runs SWF files that can be created by the Adobe Flash authoring tool, by Adobe Flex or by a number of other...
, which supports playback of audio and video streamed from RTMP servers (when installed as a web browser plug-in).
Client software with only partial support for RTMP includes the open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
media player XBMC, which has preliminary support for playing RTMP (but not RTMPE) streams.
The open-source command-line tool RTMPdump is designed to playback or save to disk the full RTMP stream including the RTMPE protocol Adobe uses for encryption. RTMPdump runs on Linux. Originally supporting all versions of 32-bit Windows including Windows 98, from version 2.2 the software will run only on Windows XP and above (although earlier versions remain fully functional).
A fork of RTMPdump, without the code which Adobe claims violates the DMCA in the USA, has been released as FLVstreamer. This was developed as a direct response to Adobe's attempt in 2008 to suppress RTMPdump. FLVstreamer will save to disk ("download") a stream of audio or video content from any RTMP server, provided RTMPE is not enabled on the stream. It runs on Windows XP and above, but not on earlier versions of Windows.
Development of RTMPdump was restarted in October 2009, outside the United States, at the MPlayer
MPlayer
MPlayer is a free and open source media player. The program is available for all major operating systems, including Linux and other Unix-like systems, Microsoft Windows and Mac OS X. Versions for OS/2, Syllable, AmigaOS and MorphOS are also available. The Windows version works, with some minor...
site. The current version features greatly improved functionality, and has been rewritten to take advantage of the benefits of the C programming language
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
.
Gnash
Gnash
Gnash is a media player for playing SWF files. Gnash is available both as a standalone player for desktop computers and embedded device, as well as a plugin for several browsers. It is part of the GNU Project and is a Free and open-source alternative to Adobe Flash Player...
, an open source replacement for the Macromedia Flash Player on the Linux platform, intends to support RTMP streaming for Linux.
Within the United States of America, software which contains measures for circumventing copy-protection code may be in breach of the U.S. Digital Millenium Copyright Act (DMCA). It is considered that only software which removes encryption from an RTMP stream (i.e. which unencrypts an RTMPE stream) is affected by that Act, and only if that software is used in, or hosted on a server within, the United States. In fact RTMPE is not a copy-protection mechanism, and as such the provisions of the DMCA are not applicable. Adobe is liable for initiating a false action under the Act, but thus far has not been prosecuted for their misuse of the DMCA.
Server software
Some full implementation RTMP servers are:- Adobe Flash Media ServerAdobe Flash Media ServerFlash Media Server is a proprietary data and media server from Adobe Systems . This server works with the Flash Player runtime to create media driven, multiuser RIAs . The server uses ActionScript 1, an ECMAScript based scripting language, for server-side logic...
, - Adobe LiveCycle Data Services
- Amazon S3 & Amazon Cloudfront can stream using RTMP
- haXeVideo is a multithread FLV streaming server entirely written using the haXeHaXehaXe is a versatile open-source high-level multiplatform programming language described on its website as a "universal language".It can produce:* Flash applications and games* Multi-platform client-side web applications* Apache CGI web applications...
programming language. - RealNetworksRealNetworksRealNetworks, Inc. is a provider of Internet media delivery software and services based in Downtown Seattle, Washington, United States. The company is the creator of RealAudio, a compressed audio format; RealVideo, a compressed video format; RealPlayer, a media player; RealDownloader, a download...
' Helix Universal ServerHelix Universal ServerThe Helix Universal Streaming Server is developed by RealNetworks and originates from the very first streaming media server originally developed by Progressive Networks in 1994...
can support RTMP, RTMPT and RTMPS streaming for live and on-demand content - Onlinelib VCS Video Communication Server (including iPhone Support)
- Red5 Media Server is a JavaJava (programming language)Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
open sourceOpen sourceThe term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
project which delivers a powerful video streaming and multi-user solution to the ©Adobe ©Flash Player and other exciting client technologies. - Erlyvideo has wide functionality: not only file streaming, but restreaming of MPEG-TS or Shoutcast to flash clients using RTMP.
- Unreal Media Server supports live RTMP streaming, in real-time and buffered modes.
- Wowza Media ServerWowza Media ServerWowza Media Server is unified server software developed by Wowza Media Systems. The server is used for streaming of live and on-demand video, audio, and RIAs over public and private IP networks to desktop, laptop, and tablet computers, mobile devices, IPTV set-top boxes, internet-connected TV...
- WebORB Integration ServerWebORB Integration ServerWebORB is an integration server developed and maintained by Midnight Coders Incorporated. It is used in SOA/Rich Internet Application development projects to connect browser clients and mobile clients with backend services and databases...
(RTMP/RTMPT/RTMPS messaging and media streaming available for .NET and Java Enterprise, Community and Cloud editions) - OneTeam Media Server has been announced on ProcessOne.
- crtmpserver is a C++ implementation of rtmp server.
- FreeSWITCHFreeswitchFreeSWITCH is a free and open source communications software for the creation of voice and messaging products. It is licensed under the Mozilla Public License , a free software license...
RTMP media streaming available with mod_rtmp and allow interconnecting with other VoIP protocols (SIPSIP-Business and economics:* Sales Incentive Plan and Share Incentive Plan, employee motivation schemes* Systematic Investment Plan, investment strategy...
, H.323H.323H.323 is a recommendation from the ITU Telecommunication Standardization Sector that defines the protocols to provide audio-visual communication sessions on any packet network...
) etc - Netris iStream Video Server for services on demand from Netris
- FFmpegFFmpegFFmpeg is a free software project that produces libraries and programs for handling multimedia data. The most notable parts of FFmpeg are libavcodec, an audio/video codec library used by several other projects, libavformat, an audio/video container mux and demux library, and the ffmpeg command line...
Specification
Adobe released what it claimed was the RTMP specification on 15 June 2009. That specification, however, omits crucial details of the protocol's implementation. It would be impossible to write a program incorporating the RTMP protocol based on the released specification alone; many essential details are omitted, and only limited additional facts can be determined by studying other implementations that use the protocol (such as librtmp), and by carrying out test TCP/IP packet captures.The Adobe license to use this protocol requires that implementations of RTMP servers meet this specification.
Details missing from Adobe's published specification include:
- No word about the real RTMP handshake. If done incorrectly, a server implementation is unable to deliver H.264/AAC content. Flash player silently fails the H.264 content if the handshake is wrong. However, all client implementations will work because usually rtmp servers are more permissive in this regard (including FMS)
- Missing explanations about the format of an aggregate message.
- How each part of the aggregate message is encoded, omitting details of typeid (1 byte), length (big endian, 3 bytes), unknown (big endian, 3 bytes), unknown (big endian, 4 bytes), message (length bytes), and back pointer (big endian, 4 bytes).
- The fact that chunks are sent up to a maximum chunk size only; and that where a chunk exceeds that size it is still sent, with a header giving the total chunk size, but that after the maximum chunk size has been exceeded, a type 4 chunk header is then sent, starting the next part of the fragmented chunk.
- The fact that the message stream ID is encoded in little endian format, whilst almost every other integer value in the protocol is encoded in big endian.
- Explanations for some control messages for streams are missing (31 and 32). FMS sends them from time to time
The formal process is: the client software, such as rtmpdump, issues a request to the RTMP server for a connection, by sending a command including the requisite elements, thereby initiating the process of negotiating a connection. Such a command may be constructed using connection and authentication information obtained previously from the server by client software applications such as rtmpsrv.
On-demand Streams
In negotiating a connection, an RTMP client sends and receives a data stream containing multiple elements, as a single command line. An on-demand stream typically includes the following elements -A. For a Limelight server
- -r rtmp://
- -a : authentication elements (the alternative -—app may be used instead)
- Typically in the format -
{application}?as={data}&av={data}&te={data}&mp={data}&et={data}&fmta-token={data} - application: A path address. For example, a1414/e3
- as : For example, as=adobe-hmac-sha256
- av : For example, av=1
- te : For example, te=connect
- mp : Typically, two or more comma-separated URL addresses, for alternative bitrate streams (mpeg format, mp3 or mp4)
- et : Typically, a ten-character number (numerical)
- fmta-token : Typically, a 64-character authentication (auth) string [i.e. an authentication token] (alphanumeric)
- Typically in the format -
- -y : playpath (URL address of the desired bitstream, one of those specified in mp above)
- Typically, in the format mp3:{path}/{filename}.mp3 or mp4:{path}/{filename}.mp4
- -o : Output filename
The foregoing are typically the only elements (or "switches") that are essential to a connection, if neither Tunnelling nor Encryption are in use by the server. Although other elements may be encountered in practice, they are normally non-essential.
Hence the following elements are typically sent by the client software application, as a single command line -
program.exe -r rtmp://xxxxxxxx.fcod.llnwd.net
-a path?as=data&av=data&te=data&mp=data&et=data&fmta-token=data
-y mp4:URL/filename.mp4 -o file_mp4.flv
The parts comprising the -a (or -—app) element must be incorporated in it in the order shown above, as the sequence in which its parts are received by the RTMP server is critical.
The authentication strings (et= and fmta-token=) contain session information, so will change on each fresh connection made to the server (which in practice typically means they will expire if a new session is begun, not literally on every attempt to resume a connection), but the other elements will not usually vary from session to session.
B. For an Akamai server
The command line is typically as above, except that the -a (or -—app) element contains the following parts instead -
- auth : Typically, a 62-character authentication (auth) string [i.e. an authentication token] (alphanumeric)
- aifp : For example, aifp=v001
- slist : Typically, the URL address of the stream
Hence the following elements are typically sent by the client software application, as a single command line -
program.exe -r rtmp://xxxxxxx.edgefcs.net
-a ondemand?auth=data&aifp=data&slist=data
-y mp3:URL/filename -o file_mp3.flv
The parts comprising the -a (or -—app) element must be incorporated in it in the order shown above, as the sequence in which its parts are received by the RTMP server is critical.
The authentication string (auth=) contains session information, so will change on each fresh connection made to the server (typically, if a new session is begun, e.g. the computer is restarted, not literally on every attempt to resume a connection). The other parts will not usually vary from session to session.
Note - The above describes the simplified form, whereby the stream is first saved to the user's hard disk, to be played back thereafter in a media player capable of playing an FLV encoded file (H.263 or H.264 encoding), such as GOM Player. If it's desired, instead, to play the stream directly from the RTMP server, thus giving immediate playback, additional elements will be needed in the command line including -
-f : This specifies the version of the Flash plugin installed on the user's computer. For example, -f "WIN 9,0,260,0" would indicate the user has the Windows version of Flash Player 9, release 260
-W : The capital W command. This is the URL address of the SWF player used to play the stream, as indicated by the web page from which the stream is derived. For example, path/9player.swf?revision=18269_21576
Live Streams
The command line for a live stream typically includes the following elements -A. For an Akamai server
The command line is typically as for an Akamai on-demand stream. But the -a (or -—app) element contains the following parts
- auth : Typically, a 62-character authentication (auth) string [i.e. an authentication token] (alphanumeric)
- aifp : For example, aifp=v001
- slist : Typically, the URL address of the stream, in the format xxxxx_x_@xxxx (e.g. Radio_7_Int@6463); or more than one URL if more than one bitrate is available [see note]
Note - If the slist string contains two or more alternative streams (i.e. offers a choice of streams at alternative bitrates), the playpath element (--playpath or -y) specifies the one chosen by the user, as the identifier item.
Hence the following sequence is typically sent by the client software application, as a single command line -
rtmpdump.exe -—live -r rtmp://xxxxxxx.live.edgefcs.net
-a live?auth=data&aifp=data&slist=data
-—playpath {identifier}?auth=data&aifp=data&slist=data -o output.flv
All these items are mandatory, and must be included in the order shown above. The string following the ? (question mark) in both the -a and -—playpath elements will typically be identical. The identifier item will typically be a sub-set of the slist data (if the latter offers a choice), otherwise they too will be identical. The -o element can specify an output filename chosen by the user.
Specifying the complete playpath is unnecessary, as that element is constructed in memory by the client application. Typically, in memory it takes the following form -
-y xxxxx_x_@xxxx?auth=[62 characters]&aifp=v001&slist=xxxxx_x_@xxxx,xxxxx_x_@xxxx
RTMPT
This refers to the HTTP tunneled version of the protocol. It communicates over port 80 and passes the AMFAction Message Format
Action Message Format is a binary format used to serialize objects graphs such ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives....
data inside HTTP POST request and responses. The sequence for connection is as follows:
POST /fcs/ident2 HTTP/1.1
Content-Type: application/x-fcs\r\n
HTTP/1.0 404 Not Found
POST /open/1 HTTP/1.1
Content-Type: application/x-fcs\r\n
HTTP/1.1 200 OK
Content-Type: application/x-fcs\r\n
1728724019
The first request has an /fcs/ident2 path and the correct reply is a 404 Not Found error. The client then sends an /open/1 request where the server must reply with a 200 ok appending the a random number that will be used as the session identifier for the said communication. In this example 1728724019 is returned in the response body.
POST /idle/1728724019/0 HTTP/1.1
HTTP/1.1 200 OK
0x01
From now on the /idle/
Action Message Format
Action Message Format is a binary format used to serialize objects graphs such ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives....
data is sent through /send/
POST /send/1728724019/1 HTTP/1.1
Content-Type: application/x-fcs\r\n
Content-Length: 1537\r\n
0x03
[1536 random bytes]
HTTP/1.1 200 OK
Content-Type: application/x-fcs\r\n
Content-Length: 3074\r\n
[1537 random bytes]
POST /send/1728724019/2 HTTP/1.1
Content-Type: application/x-fcs\r\n
[AMF Data Decoded:]
(command) “connect”
(transaction ID) 1.0
(object) { app : “sample”, flashVer : “MAC 10,2,153,2”, swfUrl : null,
tcUrl : “rtmpt://127.0.0.1/sample “, fpad : false,
capabilities : 9947.75 , audioCodecs : 3191, videoCodecs : 252,
videoFunction : 1 (SUPPORT_VID_CLIENT_SEEK) , pageUrl : null, objectEncoding : 3.0 }
HTTP/1.1 200 OK
Content-Type: application/x-fcs\r\n
(Server BW)
(Client BW)
(Set Packet Size)
(command) “_result”
(transaction ID) 1.0
(object) { fmsVer : "FMS/3,5,5,2004", capabilities : 31.0, mode : 1.0 }
(object) { level : “status”, code : “NetConnection.Connect.Succeeded",
description : “Connection succeeded”,
data : (array) { version : “3,5,5,2004” },
clientId : 1728724019, objectEncoding : 3.0 }
POST /send/1728724019/3 HTTP/1.1
Content-Type: application/x-fcs\r\n
Content-Length: 16\r\n
[16 bytes]
HTTP/1.1 200 OK
Content-Type: application/x-fcs\r\n
Content-Length: 1\r\n
0x01
This complete the handshake for an app named "sample". For most implementations of media servers this is just a folder on the root directory with the specified name, inside of which media data exist. After that polling requests are sent with an incremental sequence number and stream playing commands are sent through /send/... and an AMF body. Lastly, a stream is created and data starts being sent back from the server through:
POST /send/1728724019/[seq#] HTTP/1.1
Content-Type: application/x-fcs\r\n
Content-Length: 56\r\n
(command) “createStream”
(transaction ID) 2
HTTP/1.1 200 OK
Content-Type: application/x-fcs\r\n
Content-Length: 43\r\n
(command) “_result”
(transaction ID) 2
POST /send/1728724019/[seq#] HTTP/1.1
Content-Type: application/x-fcs\r\n
Content-Length: 56\r\n
(command) “play”
(transaction ID) 0
(argument) “mp4:[file name].mp4”
HTTP/1.1 200 OK
Content-Type: application/x-fcs
(command) “onStatus”
(transaction id) 0
(null)
(object) { level : “status”,
code : “NetStream.Play.Reset”,
description : “Playing and resetting sample.mp4.”
clientid : 1584259571 }
RTMFP
- Researchers at crtmpserver are reverse engineering the rtmfp protocol. This is currently a work-in-progress.
- Blue5 - A project to create open source versions of RTMPE and RTMFP.
See also
- Orbit DownloaderOrbit Downloader-External links:* * at Download.com* at Softonic.com...
for Windows XP - Protected StreamingProtected StreamingProtected Streaming is a DRM technology by Adobe. The aim of the technology is to protect digital content from unauthorized use....
Info about RTMPS and RTMPE - Real Time Media Flow ProtocolReal Time Media Flow ProtocolReal Time Media Flow Protocol is a proprietary protocol developed by Adobe Systems. RTMFPenables low latency UDP streamings and direct peer-to-peer communication between multiple Adobe Flash Players...
(RTMFP), based on UDP