You are on page 1of 4

How RTMP and related protocol works

Adnan Akbar, Asfand Malik, Syed Ikram Ali

Abstract— RTMP (Real Time Messaging Protocol) is a system


for delivering on-demand and live media to Adobe Flash II. RTMP OPERATION
applications. Adobe uses this technology to diver videos, RTMP allows real-communication by maintaining a
music and song on the internet to flash clients. RTMP single persistent connection between server and client.
support videos on different formats and offer several The protocol has the ability to transmit large amount of
advantages over regular HTTP video download. People can
chunks into multiple smaller fragments .To guaranty
watch the video while it is being recorded. Videos delivered
over RTMP are more secure than regular HTTP. The report
smooth delivery of data it can divide the chunks into
contains a detailed description how the RTMP protocol multiple fragments. For example it can split video and
works and the basic difference between HTTP and RTMP. audio into multiple fragments. The size of the fragment
is negotiated between server and client at run
I. INTRODUCTION time: the default fragment sizes are 64-bytes for audio
data, and 128 bytes for video data and most other data
RTMP is a protocol used by the Flash Player to types. The RTMP fragments can be multiplexed and
deliver real time video and audio to clients using a then de multiplexed at the receiving side. RTMP packets
binary TCP connection or polling HTTP tunnel. To send across several different active channels being
video or audio using webcam, camera or microphone to interleaved in such a way as to ensure that each
an RTMP server you must use RTMP. RTMP supports channel meets its bandwidth, latency, and other
video in FLV and H.264 formats and audio in MP3 and quality-of-service requirements. RTMP packets can be
AAC formats. RTMP offers several advantages over sent on several channels and each channel is
regular HTTP video download: independent of each other. For example there will be
separate channel for audio data stream and video data
stream. During a RTMP session, several channels may
Flash Server Flash Player
be active simultaneously at any given time [3]
RTMP III. RTMP CLASSIFICATION
As many LAN networks and home firewalls block
connections via ports and protocols, RTMP solve the
problem by providing different variants of the protocol
that can be used successfully in environments where
security measures would block RTMP. The RTMP
variants are listed below. [2]

Fig: 1 RTMP protocol is used between Flash Media server and Flash
 RTMP (default) - This plain protocol work on the
client for streaming media top of TCP.The Adobe Flash Player uses the
RTMP protocol over port 80.
The RTMP is like a translator making sure server and
 RTMP (Tunnel) - It encapsulates the RTMP data
clients understand each other and work together. RTMP
as valid HTTP, and by default communicates is
servers communicate with RTMP clients such as the
done on port 80. While RTMPT requires higher
Flash player, giving complete support for streaming
bandwidths due to the addition of HTTP
media over the Internet. It works on a variety of levels.
headers, the protocol can be used in
It’s the backbone of Flash-based streaming video and
environments where security measures would
an essential part of streaming media. [4]
block RTMP.
 RTMP (secure) – This protocol uses a secure SSL The handshake can be divided into four stages. Initially
connection using HTTPs both server and client are initialized and the protocol
 RTMP (Encrypted) - RTMP with encryption is a version is sent during this stage. After the uninitialized
new encrypted protocol for securing the stream state both server and client sent the version of RTMP to
data between server and client. It is lightweight each other and are now in the version state. After the
then SSL. version state both client and server send
 RTMP (Tunnel encrypted) –It is an enhance acknowledgment to each other and thus handshake has
version which encrypt the communication been done and can exchange messages.
channel over HTTP. The key benefits over SSL
B. Chunking
(RTMPS) are performance, ease of
implementation, and limited impact on server Chunking allows large messages to be broken into
capacity. multiple small messages. In addition it also allows small
 RTMP (Real-time media flow control) – this is messages to be sent over less overhead. Each chunk
based on the user datagram protocol. It supports carries message of one type of one stream. While
sending data from one flash player to another transmitting each chunk must be sent in full before the
directly without sending it to the server; however next at the receiving end chunks are assembled into
a server side connection will always be required message based on the chunk id. The figure below
to establish a connection between end user. shows RTMP chunk format.

IV. FORMAT OF MESSAGE


RTMP message format is divided into multiple chunks. Basic Header Chunk header Time stamp Chunk Data
These chunks are useful for multiplexing and de
multiplexing at the receiving side. The message format
contains the following fields.
Each chunk consists of a header and data the header
 Time stamp
itself is broken down into three parts.
 Length
 Type ID V. TYPES OF MESSAGES
 Stream ID Different types of messages are exchanged between
A. Handshake client and server to communicate with each other on
the network. These messages can be of any type video
An RTMP handshake is unlike the rest of the
messages, audio messages, shared objects or command
protocols. The connection begins with three static size
messages.
chunks rather than a variable size chunks. The client
that initiate the connection and the server send the A. Command messages
same type of chunks to each other in order to initiate Command messages carry the encoded commands
the connection. between server and client. These messages consist of
command name, transection id and command objects
Flash Server Flash Player that contains parameters about the command type.

Uninitailzed B. Data messages


sent Client and server send these messages in order to
Version sent exchange metadata with peers. These messages include
details about the data like creation time, duration and
Ack sent so on.
C. Shared Object messages
Handshake done
These types of messages are shared across multiple
clients and instances. Each flash shared object can
contains multiple events.
Fig: 2 RTMP handshakes divided into multiple stages
D. video messages
These messages contains actual video data .The Fig: 2 RTMP message flow in the connect command
client and the server send these messages to send
The client send the connect command to the server to
video data to peers.t
request connection to a server application. The server
These messages are big in size and it can delay the
responds back with a window acknowledgment size
other messages so it has been assigned the lowest
message which contains the information about window
priority.
buffer size, bandwidth and user control.
E. Audio messages These two objects are used for a higher level
The client and server send these messages for representation of connection and the channel over
sending audio data to the peers. To avoid the delay for which audio, video and other data are sent.
other messages these messages has assigned the B. CreateStreams
lowest priority as these messages are bigger in size.
The Flash client sends this command to the server to
F. aggregate messages create a logical connection for communication. For
An aggregate message is a single message that can example to publish audio or video data on the net
contains a list of sub messages. The message type value CreateStream command is used
of 22 is reserved for aggregate messages. C. NetStreams
G. User control messages This command defines the channel through which audio
This client and the server send these messages to and video messages can be sent. This object can
inform the peers about the user control messages. support multiple streams. The following commands can
Some of the user control event types. be sent over channel.
 Play, play2
VI. TYPES OF COMMANDS  deleteStream ,closeStream
The client and the server send command messages  receiveAudio ,receiveVideo
that consist of command name and transection ID. For
example the sender send the connect command and VII. CLIENT SOFTWARE
the receiver response back with same transection ID. The most commonly RTMP client is a web browser
The following commands are mostly used for various plugin Adobe Flash player which support audio and
commands. video playback. Gnash is an open source replacement
for the Macromedia Flash Player on the Linux platform,
A. NetConnection command intends to support RTMP streaming for Linux. In
This command provides a two way connection addition to that RTMP client software can also support
between server and client. In addition it also provides partial open source media player XMBC. RTMP dump is
synchronization between server and client. an open source command line tool designed to
playback the video or to save the video to a disk.

Flash Server Flash Player VIII. SERVER SOFTWARE


Handshake done
There are many RTMP implemented servers which
Connect can be used for real-time or on demand video
streaming. The most commonly used RTMP servers are:
Window Ack size  Adobe Flash Media Server
 Adobe LiveCycle Data services
Set bandwith
 Amazon S3 and Cloud Front
 Red5 open source media server
User control
 Wowza Media Server
Result connect
IX. HTTP VS. RTMP
HTTP (hypertext transfer protocol) refers to the References
protocol used to deliver web pages and images across
the Internet worldwide. HTTP is an open standard [1] RTMP streaming
protocol. HTTP is a “stateless” protocol; think of it as an http://www.longtailvideo.com/support/jw-
airline ticket to anywhere. HTTP can be delivered by a player/jw-player-for-flash-v5/12535/video-
variety of web servers, both commercial and open delivery-rtmp-streaming .
source. Some of the basic difference between RTMP [2] RTMP Documentation
and Http has shown in the table below. http://dev.rtmpy.org/wiki/RTMP#RTMPS
[3] RTMP introduction Wikipedia
HTTP RTMP http://en.wikipedia.org/wiki/Real_Time_Messagin
Server component Open Specialized g_Protocol
Security Basic Enhanced [4] RTMP streaming
Cashing Native Specialized http://www.eyepartner.com/streaming-
Multicast support NA supported software/rtmp-streaming/: http://www.ieee.org/
Firewall (port) No restriction Some restriction [5] HTTP vs. RTMP http://www.gpl-
Player interactivity Basic Extensive uk.co.uk/files/inlet_streaming_httpvsrtmp.pdf

RTMP refers to the proprietary protocol developed by


Adobe Systems for streaming audio, video and data
over the Internet, between a Flash player and a Flash
Media Server. RTMP is defined as a stateful protocol,
which means that from the first time a client connects
until the time it disconnects, the streaming server keeps
track of the client’s actions. [5]

X. CONCLUSION
In this report we introduced in details how the RTMP
protocol works, what are its different classifications,
how its message format look like and what are the
functions of some of its important command messages.
In addition to that we also described some of the basic
difference between RTMP and HTTP. Our analyses show
that RTMP is currently the most efficient protocol for
delivering videos on the internet among competing
technologies of media delivery. In addition to that
RTMP offers several advantages over regular HTTP
video download. RTMP can do live streaming - people
can watch your video while it is being recorded, RTMP
provide much more enhance functionality for streaming
and on demand media, furthermore video delivered
over RTMP are much more secure than videos delivered
over regular HTTP.

You might also like