What is Real-Time Messaging Protocol (RTMP)? (2024)

Definition

Real-Time Messaging Protocol (RTMP) is a protocol for streaming audio, video, and data over the Internet.

Overview

After Adobe acquired the company that created RTMP, Macromedia, they released a partial version for public use. Like a lot of source code released to the public, Real-Time Messaging Protocol has multiple variations:

  • RTMPS – Uses aSecure Sockets Layer(SSL) connection.
  • RTMPE – Encrypted with Adobe’s security mechanism.
  • RTMPT – Encapsulated within HTTP requests to travel through firewalls.
  • RTMFP – Uses UDP instead of TCP.

Each type of Real-Time Messaging Protocol is primarily used for three different processes:

How Real-Time Messaging Protocol Works

RTMP is aTCP-based protocoldesigned to maintain low-latency connections for audio and video streaming. To increase the amount of data that can be smoothly transmitted, streams are split into smaller fragments called packets. RTMP also defines several virtual channels that work independently of each other for packets to be delivered on. This means that video and audio are delivered on separate channels simultaneously.

The 3-step process

At a high level, Real-Time Messaging Protocol works as a three-step process.

Step 1: The handshake

Once RTMP establishes a TCP connection it performs a handshake by exchanging three packets between the client and the server. These packets are called chunks.

The process looks like this:

  • The client sends over a chunk to tell the server which protocol version it is using.
  • Without waiting for a response, the client sends another chunk with a timestamp.
  • The server responds with an echo of the chunks it receives, this time including a timestamp of the time it received them.
  • The client sends one final packet that is a copy of the timestamp packet and the server returns it.
  • Once the final packet exchange is complete, the handshake is considered complete.

Step 2: The connection

The client and server can now begin negotiating a connection throughAction Message Format(AMF) messages. For example, the client would send over a connect request that looks like this:

(Invoke) "connect"(Transaction ID) 1.0(Object1) { 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 , pageUrl: null, objectEncoding: 3.0 }

And the server will receive the request and respond with the appropriate message sequence:

(Invoke) "_result"(transaction ID) 1.0(Object1) { fmsVer: "FMS/3,5,5,2004", capabilities: 31.0, mode: 1.0 }(Object2) { level: "status", code: "NetConnection.Connect.Success", description: "Connection succeeded", data: (array) { version: "3,5,5,2004" }, clientId: 1728724019, objectEncoding: 3.0 }

Step 3: The stream

The client can now start a video or audio stream by sending three messages to the server: createStream, ping, and play.

Examples of Real-Time Messaging Protocol

You can create a Real-Time Messaging Protocol live stream by leveraging software such asSimple-RTMP-Server (SRS)on your own server or a provider such asManyCam. The standard method of setting up an RTMP live stream requires at least one server for your streaming software and a connection to a separatecontent delivery network.

The primary issue with this standard setup is the opportunity for increased latency as your stream travels from your server to your CDN before being distributed to your viewers. StackPath solves this problem with edge-compute.

Real-Time Messaging Protocol on the edge

As discussed, a media server is an absolute necessity if you want to leverage RTMP for livestreaming.Wowza Streaming Engine, for example, is a widely used streaming software for live and on-demand video that can be installed on any server—such as one ofStackPath’s virtual machines or containers.

Your streaming engine will ingest an RTMP live stream and then provide your CDN with cacheable chunks, usually around 10 seconds.

As traffic travels to your CDN and out to viewers, latency is created. With StackPath edge-compute, your media servers are already on the edge and can deliver content without the need for a content delivery network. By leveraging our virtual machines or containers on the edge you can reduce latency and costs.

Key Takeaways

  • Real-Time Messaging Protocol (RTMP) is an open source protocol owned by Adobe that’s designed to stream audio and video by maintaining low latency connections.
  • Clients use a handshake to form a connection with an RTMP server which then allows users to stream video and audio.
  • RTMP livestreaming generally requires a media server and a content delivery network, but by leveraging StackPath edge-compute you can remove the need for a CDN and drastically reduce latency and costs.

SHARE THIS PAGE

What is Real-Time Messaging Protocol (RTMP)? (2024)
Top Articles
Latest Posts
Article information

Author: Lidia Grady

Last Updated:

Views: 6456

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.