Skip to content

RTMP Streaming: What Devs Should Know About the Protocol

LinkRTMP streaming: everything developers should know about live streaming with RTMP

Real-Time Messaging Protocol (RTMP) is the OG video streaming technology. It’s used to transport live data across the internet to video platforms and social media sites — a.k.a. video contribution.

In this guide to all things RTMP, we discuss how the protocol works, the pros and cons of using it, how to set up a basic streaming workflow, and FAQs developers are asking. Keep reading for the details or check out our video overview below.

LinkWhat is RTMP?

RTMP is a streaming protocol used to transport live audio and video data over the internet. Macromedia first developed the standard for streaming to Flash Player, but today it’s more vital on the backends. In this way, RTMP-encoded video powers quick data transmission to streaming servers and online video platforms.

RTMP ensures high-performance, low-latency video transport across the internet — making its use a no-brainer for building interactive video applications. That’s why video platforms like YouTube, Twitch, and Crowdcast all rely on the protocol for ingesting user-generated content (UGC).

When using RTMP, media is broken up into chunks that can be quickly transported. RTMP is a protocol based on the Transmission Control Protocol (TCP), which gives it the advantage of being able to maintain a persistent connection between client and server, reducing delays. Data packets are reassembled once they reach the destination and are often repackaged into an HTTP-based format like Apple’s HTTP Live Streaming (HLS) protocol with the help of platforms like Mux.

Although RTMP was once a proprietary standard for streaming to Flash Players, it’s now an open specification. Here’s what Adobe has to say about it:

“The Real-Time Messaging Protocol (RTMP) was designed for high-performance transmission of audio, video, and data between Adobe Flash Platform technologies, including Adobe Flash Player and Adobe AIR. RTMP is now available as an open specification to create products and technology that enable delivery of video, audio, and data…”

LinkRTMP variations

You can use RTMP in a few different ways. Here’s a breakdown:

  • RTMPS: This secure version of RTMP uses an SSL connection to encrypt the data.
  • RTMPE: Another option for content protection is RTMPE, which uses Adobe’s proprietary encryption mechanism.
  • RTMPT: With RTMPT, streams are encapsulated within HTTP to bypass corporate firewalls.
  • RTMFP: RTMPF is based on the UDP protocol instead of TCP.

LinkAdvantages of RTMP

Even though it’s considered the grandfather of all streaming protocols, RTMP has remained relevant in the ever-changing video space. There are a few reasons for this:

  • Vast support across encoders and platforms: RTMP has been around forever. And that’s a good thing. As the most common format used for video contribution, you’d be hard-pressed to find an encoder that doesn’t support it. Most media servers can also receive it, and social media sites like Facebook require it. Alternative ingest formats like SRT and WebRTC simply can’t compete in this arena.
  • Low-latency transmission: Unlike HTTP-based protocols (we’re looking at you, HLS and MPEG-DASH), RTMP moves multimedia content at breakneck speed. Its glass-to-glass latency is between 2 and 5 seconds — and there are methods that further reduce this latency, if you can believe it.
  • Reliability: RTMP establishes a dedicated connection between the client and server to ensure reliable data delivery. When a stream reaches end users, this equates to smooth video experiences.

LinkDisadvantages of RTMP

Alongside its success, RTMP has also experienced some growing pains through the years. Here are some of the biggest complaints RTMP haters have voiced:

  • Not supported for playback: Flash Player’s discontinuation brought with it an end to RTMP playback. Although video-sharing platforms like YouTube still ingest RTMP, it’s rarely used for end-user delivery today. Therefore, developers looking to build live video capabilities into their applications need to use a video streaming API like Mux to prepare their content.
  • Legacy technology: The RTMP protocol has been around since 2002, which is why it’s so ubiquitous. That said, newer protocols like HLS are better suited for large-scale delivery and adaptive bitrate streaming.

LinkIs Flash dead? A history of RTMP

Given that Adobe killed Flash Player at the end of 2020, many assume that RTMP is also obsolete. But those of us entrenched in the world of streaming know that’s nowhere near the case.

On the contrary, RTMP is still the most common video contribution format. The only place it’s fallen out of favor is end-user delivery. But let’s back up a little — a look at the history of RTMP and Flash can illustrate the nuance of the reality of current RTMP use.

LinkEarly 2000s: RTMP did it all

Back in the early 2000s, 98% of browsers had Flash installed. RTMP made it all possible — powering video streaming — from encoding through playback. At this time, RTMP was the backbone of all internet-based video.

So what changed? Well, developers started pushing for a more native experience for viewing content online. The dream was to move away from third-party plugins and support video playback within the browser itself.

Link2010s: Open standards like HTML5 enter the picture

This first draft of HTML5 achieved this goal by adding browser-based multimedia support. This paved the way for a more open internet that moved away from proprietary tech.

Steve Jobs chimed into the conversation by publishing a 2010 letter titled Thoughts on Flash, which signaled the end of RTMP playback. In the letter, he wrote:

“[We] strongly believe that all standards pertaining to the web

should be open. Rather than use Flash, Apple has adopted HTML5, CSS and JavaScript — all open standards. … HTML5, the new web standard that has been adopted by Apple, Google and many others, lets web developers create advanced graphics, typography, animations and transitions without relying on third-party browser plug-ins (like Flash). HTML5 is completely open and controlled by a standards committee, of which Apple is a member.”

Once HTML5 became standard in 2014, Netflix, YouTube, and countless other video platforms said good-bye to Flash. Google put another nail in the coffin by disabling Adobe Flash by default.

Link2020s: Flash is deprecated

By 2020, even Adobe gave up. They announced Flash’s end of life and recommended that “all users immediately uninstall Flash Player to help protect their systems.”

As a result, Apple’s HTTP Live Streaming (HLS) protocol became the new standard for end-user delivery. But not a lot changed on the video contribution side of things. Content distributors were free to keep using their existing RTMP encoders, so long as they repackaged the streams using a platform like Mux.

LinkHow does RTMP streaming work?

So why is RTMP still in favor today? Let’s take a closer look.

LinkRTMP encoding

RTMP streaming uses two capabilities to ensure smooth streaming: multiplexing and packetization. These dictate how the content is encoded, which in turn influences how the media travels across the internet.

  • Multiplexing: Multiplexing (or muxing) is a fancy word for combining separate data streams into a single container. This allows video data, audio data, and additional metadata to travel together over a single connection. Bundling all of this data into a unified bundle streamlines the transmission for live streaming.
  • Packetization: At the same time, RTMP breaks up large continuous data files into multiple packets for efficient delivery. These packets are then strung back together when they reach their destination.

LinkRTMP connection and handshake

RTMP is an application-layer protocol that sits on top of the TCP. As such, it requires a three-step handshake before the stream can begin:

  1. The client (often an encoding software or hardware) sends the first packet to the server to communicate which version of RTMP it’s using (RTMPE, RTMPS, etc.)
  2. The client also sends a second packet with a timestamp. The server then echoes back the two packets it’s received with the timestamps of when it received them.
  3. Once two-way communication has been established between the client and server, the client sends a copy of the timestamp, which the server returns. This concludes the handshake.

The client and server then negotiate a connection and pin down details like the connection URL, audio codec, and video codec. RTMP maintains a constant connection from there, conducting the rapid data transfer from point A to B.

LinkConvert RTMP to HLS with a video API

Once the connection is established, most content distributors choose to convert their streams into adaptive bitrate HLS. This ensures scalable delivery across web servers, browsers, and various smart devices. For this, you’ll need a video API like Mux that offers instant encoding and smart adaptive bitrate ladder creation.

Whether you’re giving users a stream key to go live on your application or connecting your own encoders with our platform to broadcast at scale, we make it easy to push RTMP content to Mux.

When Mux ingests the live content, the platform quickly decodes it, re-encodes it into another format, and creates multiple renditions to ensure smooth playback for all viewers. This is called transcoding, which is summarized in the video below.

LinkHow to set up an RTMP streaming workflow

Most RTMP streaming workflows include five key steps:

  1. Live capture: A professional camera, smartphone, webcam, drone, or IP camera is used to capture a live stream. This is referred to as your video source.
  2. Encoding: A software or hardware encoder compresses the video data for speedy transmission to a streaming server.
  3. Transcoding and packaging: A third-party service or on-premises server transcodes and processes the data for high-quality delivery.
  4. Delivery: One or more content delivery networks (CDNs) are used to quickly distribute the content across the globe.
  5. Playback: End users everywhere and on any device can watch the live content as it unfolds — enjoying smooth playback in the highest resolution possible.


Let’s take a look at the specific hardware and software components that may come into play across these steps.

LinkWhat is an RTMP encoder and which kind should I use?

An RTMP encoder is used to compress RAW video data into the RTMP format for speedy dispatch across the internet. Almost all live streaming encoders support RTMP, and many can output additional ingest protocols like Real-Time Streaming Protocol (RTSP) and SRT.

There are a few different types of RTMP encoders : hardware, software, and even those built into capture devices. Here’s a look at the many encoding solutions available — and a few examples that can help you decide which one to go with one over the other.

  1. RTMP software encoders

Live streaming software like OBS Studio, Wirecast, and vMix provide everything you need to run a streaming studio on your laptop. These cost-effective and developer-friendly tools are best for simple live broadcasts and UGC. Many even pre-integrate with popular social media sites.

Many software encoders also support live switching, video mixing, screen recording, and more. In doing so, they eliminate the need for extra equipment and thus streamline video production. Just know that power is dependent on your computing resources, and slower encoding times can result.

Of the three options listed above, OBS is free, whereas both Wirecast and vMix offer free trials. Software encoders are a great place to start when your budget is limited or you’re looking to create a proof of concept.

  1. RTMP hardware encoders

Hardware encoders offer the dedicated power to encode high-quality streams in a jiffy. As such, they support more advanced live streaming workflows and free up computing resources for other tasks.

Hardware will always be the more expensive route — but that’s not to say there aren’t affordable options. They also run the gamut in terms of feature sets, integrations, portability, and power.

We recommend looking into the following hardware options to start:

  1. Mobile encoding SDKs and apps

If you’re looking to build a mobile app that lets users publish live UGC streams, you’ll need to use a third-party app that captures and encodes RTMP streams natively on iOS and Android devices.

Some options for this include:

Read our guide to RTMP live streaming apps for iOS here.

  1. RTMP cameras with built-in encoders

Finally, some cameras have built-in encoding functionality, making it easy to stream directly from the capture device without additional software or hardware. The cameras used for this purpose are often IP cameras, which are used for surveillance, but there are also other types of handheld cameras and even drones that support RTMP streaming.

LinkWhat is an RTMP URL?

Also called an ingest endpoint or server URL, an RTMP URL is the custom web address used to connect your video source or encoder with a streaming platform. Some platforms use a specific RTMP URL based on your location or the level of security you’re prioritizing.

Mux’s RTMP entry points, for instance, change based on the version of RTMP that a content distributor is using (RTMP vs. RTMPS).

RTMP Server URL

Description

Common Applications

rtmp://global-live.mux.com:5222/app

Mux's standard RTMP entry point. Compatible with the majority of streaming applications and services.

Open source RTMP SDKs, most App Store streaming applications.

rtmps://global-live.mux.com:443/app

Mux's secure RTMPS entry point. Compatible with fewer streaming applications but offers a higher level of security.

OBS, Wirecast, Streamaxia RTMP SDKs

These can usually be found in the settings of the streaming platform.

LinkWhat is an RTMP server?

An RTMP server is the location you’re streaming to. This is often a third-party service, although large-scale video distributors may choose to build their video infrastructure in house.

Some different categories of RTMP servers include:

  • Social media platforms like YouTube
  • Video platforms like Vimeo
  • Enterprise platforms like Microsoft Stream
  • Video APIs like Mux
  • CDNs like Cloudflare
  • Cloud services like AWS Elemental
  • On-premises servers like Blackmagic

LinkWhat platforms accept RTMP?

One of the reasons RTMP has remained a well-known protocol among both devs and content creators is its prominence across social media platforms like YouTube, Twitch, Vimeo, TikTok, and Instagram.

While it’s true that RTMP must be repackaged into HLS or MPEG-DASH for delivery to end users, popular social media platforms take care of the repackaging for you. Video platforms like YouTube and Facebook Live have transcoding technology built into their infrastructure, making the live-streaming process appear seamless to end users.

If you’re looking to stream directly to these sites, an RTMP server may not be necessary. That said, when streaming to multiple social media platforms at once, you’ll benefit from a video API like Mux that lets you publish a single stream to multiple platforms at the same time. This is called simulcasting, and you can learn more about it here.

LinkHow does RTMP compare to other protocols?

If you’re trying to determine which streaming protocol is best for your application, here’s a few comparisons that might help.

LinkRTMP vs. RTSP

There’s only one reason you’d use the RTSP instead of RTMP: to build a real-time surveillance or closed-circuit television system. That’s because RTSP is the protocol of choice for IP cameras and has a latency close to 2 seconds.

Otherwise, RTMP and RTSP are quite similar. Both are legacy technologies used only for ingest today.

LinkRTMP vs. WebRTC

Web Real-Time Communications (WebRTC) is the speediest streaming technology out there with the ability to initiate subsecond streaming from capture to playback. The open-source project enables browser-based encoding without any plugins. This makes it great for chat-based applications, interactive video environments, and video contribution from the browser.

Although WebRTC can be used for both first-mile contribution and last-mile delivery, it wasn’t designed to support more than 50 concurrent viewers. So to broadcast WebRTC at scale, you’d need a custom CDN or a transcoding service.

WebRTC also lacks encoding support outside of the browser. This makes it ill-suited for more traditional broadcast workflows that use a hardware encoder.

LinkRTMP vs. HLS

If you’ve been paying attention, you already know that RTMP and HLS are often used in conjunction, with RTMP input and HLS output. The former ensures low-latency and reliability while the latter achieves large-scale delivery and compatibility.

Thus, the question isn’t “RTMP or HLS?” Rather, it’s “how can I quickly convert RTMP to HLS without having to build in-house video infrastructure?”

And for that, you need Mux.

LinkHow to stream with RTMP using Mux

Streaming RTMP with Mux is a six-step process:

  1. Generate an API Access Token in your Mux Dashboard.
  2. Configure a unique live stream so your encoder can connect to Mux.
  3. Start pushing RTMP streams from your encoder to Mux’s RTMP server.
  4. Play the live stream in your application using HLS.
  5. Stop broadcasting and disconnect from the Mux server.
  6. Manage your live stream using the Mux Video API.

Check out our complete guide for code snippets and additional resources.

LinkFAQs

  • What are the benefits of using RTMP for live streaming? The benefits of RTMP streaming include low-latency data transmission and broad support across both encoders and video APIs.
  • How do you set up an RTMP server? How you do this depends on your unique tech stack. In the section above, we detail the steps required when streaming with Mux.
  • How does RTMP differ from HLS for streaming? The primary ways that RTMP differs from HLS include latency (RTMP comes with less lag than HLS) and scalability (HLS is more easily scaled across HTTP servers and browser-based players).
  • What is an RTMP stream key? An RTMP stream key is the code used to authenticate live streams by allowing the client and server to communicate. The long string of letters and numbers is unique to each stream or channel and serves as a security measure.
  • What is the latency of RTMP? RTMP latency clocks in between 2 and 5 seconds, making it a great option for building interactive video experiences.
  • What is an RTMP player? Adobe Flash Player was the original RTMP player, and many other plugins like QuickTime once supported RTMP playback. This is no longer the case, which is why you’ll want to repackage RTMP streams into an HTTP-based format like HLS.
  • What video codecs does RTMP use? RTMP supports H.264, VP8, VP6, Sorenson Spark®, and Screen Video v1 and v2.
  • What audio codecs does RTMP use? At this time, RTMP can stream AAC, AAC-LC, HE-AAC+ v1 & v2, MP3, and Speex.

Get started today

RTMP is here to stay, but to use it effectively, you’ll need to transcode your RTMP streams before distributing them to end users. Mux provides video infrastructure for this and more — giving developers a single API for live and on-demand video.

Get started for free today or request a live demo.

Written By

Traci Ruether

Traci Ruether – Guest Author

Connect with Traci at https://linkedin.com/in/traci-ruether

Try Mux with a risk free trial and $20 in credit.