RTMP Streaming: The Real-Time Messaging Protocol Explained (Update)
In the early days of streaming, the Real-Time Messaging Protocol (RTMP) was the de facto standard for transporting video over the internet (or in laymen’s terms, streaming). RTMP is a TCP-based protocol designed to maintain persistent, low-latency connections — and by extension, smooth streaming experiences.
The protocol started out as the secret sauce behind live and on-demand streaming with Adobe Flash Player. Because this popular Flash plugin powered 98% of internet browsers in its heyday, RTMP was used ubiquitously.
The majority of encoders today can transmit RTMP, and most media servers can receive it. Even big social media players like Facebook, YouTube, and Twitch accept it. However, RTMP streams run into compatibility issues when it comes to playback on popular browsers and devices.
In this article, we’ll look at the RTMP specification, the history behind RTMP streaming, how to start streaming with an RTMP encoder, and alternative protocols to consider.
Table of Contents
- What Is RTMP
- How Does RTMP Streaming Work?
- History of RTMP Streaming
- So, Is RTMP Dead?
- Typical RTMP Live Stream Workflow
- How to Set Up an RTMP Stream
- Considerations When Replacing RTMP
- RTMP Alternatives for Ingest
- RTMP Alternatives for Egress
- Conclusion
What Is RTMP?
The Real-Time Messaging Protocol (RTMP) is a data transmission technology that supports live online video streaming. RTMP was initially designed to transport audio and video data between a dedicated streaming server and the Adobe Flash Player. Today, however, the protocol is most often used to deliver encoded content to social media platforms, streaming platforms, and media servers. While once proprietary, RTMP is now an open specification.
“Adobe’s Real Time Messaging Protocol (RTMP) provides a bidirectional message multiplex service over a reliable stream transport, such as TCP [RFC0793], intended to carry parallel streams of video, audio, and data messages, with associated timing information, between a pair of communicating peers.”
RTMP Streaming: A Snapshot
- Audio Codecs: AAC, AAC-LC, HE-AAC+ v1 & v2, MP3, Speex
- Video Codecs: H.264, VP8, VP6, Sorenson Spark®, Screen Video v1 & v2
- Playback Compatibility: Not widely supported
- Limited to Flash Player (which has been discontinued by Adobe), Adobe AIR, RTMP-compatible players
- No longer accepted by iOS, Android, most browsers, and most embeddable players
- Benefits: Low latency and minimal buffering
- Drawbacks: No longer being updated or supported
- Latency: 5 seconds
- Variant Formats: RTMPT (tunneled through HTTP), RTMPE (encrypted), RTMPTE (tunneled and encrypted), RTMPS (encrypted over SSL), RTMFP (layered over UDP instead of TCP)
How Does RTMP Streaming Work?
Macromedia (which is today Adobe Systems) developed the RTMP specification for high-performance transmission of audio and video data. RTMP maintains a constant connection between the player client and server, allowing the protocol to act as a pipe and rapidly move video data through to the viewer.
Because RTMP sits on top of the Transmission Control Protocol (TCP), it uses a three-way handshake when transporting data. The initiator (client) asks the accepter (server) to start a connection; the accepter responds; then the initiator acknowledges the response and maintains a session between either end. For this reason, RTMP is quite reliable.
The Three-Step Process of RTMP:
- Handshake: The client, often taking the form of encoding software or hardware, initiates a connection with the server it wishes to stream to by exchanging three packets of data.
- The first packet sent by the client tells the server which version of RTMP is being streamed.
- The second packet, which the client sends immediately without waiting for any response, includes a timestamp. At this point, the server responds with echoes or copies of the two packets it’s just received, as well as a timestamp of when it received them.
- Having established two-way communication, the client sends one final packet, which is a copy of the timestamp. The server then returns it. When the final (third) packet has been returned by the server, the handshake is complete.
- Connection: The client and server then negotiate a connection using Action Message Format (AMF) encoded messages. AN RTMP encoder uses AMF to send the connection request to the server and indicate details like the connection URL, audio codec, and video codec. Once the server responds with a go-ahead, the stream can begin.
- Stream: Having completed the handshake and connection steps, the streaming data can now be delivered. User commands such as createStream, play, seek, and pause allow the data transmission to proceed as directed.
RTMP Variations
It’s also worth noting that RTMP has multiple variations based on security considerations and the application protocol it sits on. These different flavors of RTMP include:
- RTMP proper
- RTMPS: A secure version of RTMP that travels over a Secure Sockets Layer / Transport Layer Security (SSL/TLS) connection.
- RTMPE: A version of RTMP that is encrypted using Adobe’s proprietary security mechanisms.
- RTMPT: This variation is tunneled and encapsulated over HTTP to better traverse firewalls.
- RTMPFP: Unlike RTMP proper on TCP, RTMPFP uses UDP as its transport protocol to ensure speedier delivery.
History of RTMP Streaming
Flash Player and RTMP were the dominant delivery mechanisms for live streaming up until the early 2010s. When used together, these technologies support lightning-fast video delivery with around five seconds of latency. But HTML5 video streaming, open standards, and adaptive bitrate delivery eventually edged RTMP streaming out when it came to last-mile delivery.
Why? Although RTMP works well, it historically encountered issues getting past firewalls. And as a stateful protocol, RTMP also requires a dedicated streaming server, making it resource-heavy. The writing on the wall came when Adobe announced the death of Flash — which occurred on December of 2020.
The industry now favors HTTP-based (Hypertext Transfer Protocol) protocols that use plain-old web servers. Using these technologies improves scalability and viewing experience by allowing local servers to cache streaming content. With this move, adaptive bitrate streaming has become more common, allowing broadcasters to optimize content for viewers’ devices and connectivity.
Fewer devices support Flash (and by extension RTMP) than ever before. In Adobe’s own words, content distributors are encouraged “to migrate any existing Flash content to… new open formats.”
Check out our blog on The History of Streaming Media for a more detailed look.
So, Is RTMP Dead?
Flash’s end-of-life date was overdue. But the same cannot be said for RTMP. RTMP encoders are still a go-to for many content producers, and a whopping 76.6% of respondents to our 2021 Video Streaming Latency Report currently use it for ingest.
Which streaming formats are you currently using for ingest?
As long as encoders and video sharing platforms like YouTube continue to offer support, the RTMP protocol will remain in use. Many broadcasters overcome limited playback support by initially encoding their live streams with RTMP and then transcoding the content for delivery to a range of players and devices using a streaming server or service.
In other words, RTMP streaming is alive and well for content contribution — just not last-mile delivery.
Subscribe and stay up to date
Learn about codecs and protocols, the latest live streaming trends, and much more.
SubscribeTypical RTMP Live Stream Workflow
Content distributors aren’t limited to one streaming protocol from capture to playback. In fact, repackaging a live stream into as many protocols as possible helps ensure broad distribution.
Because today’s HTML5 players require HTTP-based protocols like HLS, a media server or streaming service can be used to ingest an RTMP stream and transcode it into a more playback-friendly alternative. Whether the RTMP stream is coming from an IP camera, mobile app, or broadcast-grade encoder, Wowza’s live streaming platform makes the conversion and delivery process seamless.
Robert Gibb at StackPath writes:
“A media server is an absolute necessity if you want to leverage RTMP for live streaming. Wowza Streaming Engine, for example, is a widely used streaming software for live and on-demand video that can be installed on any server.”
The most common live streaming workflow out there is RTMP to HLS. Using a combination of RTMP and HLS helps maximize compatibility without pushing latency too high. This architecture also allows broadcasters to use well-supported protocols on either end of the live video delivery chain. Almost all software and hardware encoders support RTMP, and the same can be said for HLS on the playback side.
How to Set Up an RTMP Stream
To deliver an RTMP stream across the internet, you’ll need to start with an RTMP-compatible camera or encoder. You may be using an IP camera, software encoder, or hardware encoder.
Encoder Support
RTMP continues to play a role in so many video streaming workflows because of its vast support across professional encoders. RTMP encoders take the form of both hardware and software options, some paid and some free. We recommend the free OBS software for anyone getting started, or the URayCoder Wired 1080P H.264 HDMI Video Encoder for higher production value.
Software Encoders:
- OBS Studio: The free and open-source OBS is an essential tool for any video engineer, and Wowza offers a custom OBS integration for Real-Time Streaming at Scale.
- Wirecast: Wirecast is a paid software for more advanced broadcasters with an RTMP present that allows you to stream in seconds, as well as limitless customization.
- vMix: vMix is a great option for video producers using windows, providing a cost gradient based on features that spans from $60 to $1,200.
Hardware Encoders:
- URayCoder: As mentioned above, the URayCoder Wired 1080P H.264 HDMI Video Encoder allows you to broadcast to up to four services simultaneously, while also displaying the live video on a HDMI monitor for added confidence.
- Datavideo NVS-35: The DataVideo NVS-35 allows simultaneous live streaming and recording in the H.264 format, thus making it a shoo-in for RTMP encoding.
- Teradek: Teradek is also a good option if you’re looking for a hardware encoder, offering a huge variety of options — ranging from portable to 4K HDR systems. RTMP support is standard across Teradek’s products.
Select Your Transcoder
Once you’ve chosen the source encoder for your RTMP stream, you’ll want to select a solution for video transcoding and delivery. We offer the Wowza Video platform as an out-of-box solution or the Wowza Streaming Engine software for anyone requiring to house their video infrastructure on premises. To learn how to connect an RTMP encoder to Wowza’s video platform, check out these resources:
Setting Up an RTMP Server for HLS Delivery
After connecting your RTMP encoder to the Wowza platform, you’ll just have to decide which format(s) you’d like to use for delivery. The most common protocol for delivery is HLS. For a rundown on how this works, we offer a video tutorial on setting up an RTMP server for HLS delivery using Wowza Streaming Engine.
Testing Your RTMP Workflow
To try out your workflow, we offer a Test Player with support for MPEG-DASH and HLS on Safari. You’ll notice that the ‘Adobe RTMP’ tab requires the installation of Adobe Flash Player. That’s because native in-browser support is no longer common, and Flash itself is unsupported.
Other options include commercial platforms like Flowplayer or the free VLC Player. You’ll find that regardless of which HTML5 player you go with, RTMP playback support no longer exists. In other words, transcoding is essential for an RTMP stream. And by streaming with Wowza, you’re able to select the best formats for multi-device delivery.
Considerations When Replacing RTMP
The best protocol for your workflow will depend on your use case. You can check out the pros and cons of each protocol in this blog. But to start, we’d recommend comparing your options based on the considerations below:
- Scalability
- Latency
- Quality of experience (adaptive bitrate enabled, etc.)
- Use (first-mile contribution vs. last-mile delivery)
- Playback support
- Proprietary vs. open source
- Codec requirements
Transcoding RTMP live streams into adaptive HLS and DASH formats remains a common practice — and might be the best place to start. That said, WebRTC will be better suited for anyone requiring sub-500ms latency, and it can be used for both ingest and egress.
Get the Low-Latency Streaming Guide
Understand the critical capabilities required to provide interactive video experiences.
Download PDFRTMP Alternatives for Ingest
While RTMP is still commonplace for first-mile contribution, that’s beginning to change. Industry leaders predict that open-source protocols like Secure Reliable Transport (SRT) and Web Real-Time Communications (WebRTC) could become standard.
SRT
SRT is an open-source technology designed for reliable and low-latency streaming over unpredictable public networks. It competes directly with RTMP and RTSP as a first-mile solution but is still being adopted as encoders, decoders, and players add support.
“Legacy protocols such as real-time messaging protocol (RTMP), developed over a decade ago to encode video and move it across networks to clients, will likely be displaced by newer solutions such as Secure Reliable Transport (SRT), designed to further decrease latency and meet the demands of live and on-demand streaming.”
WebRTC
WebRTC is a popular ingest protocol in workflows that require sub-second streaming or simple, browser-based publishing. By swapping out an RTMP encoder for a WebRTC-based video source, you’re able to eliminate the need for additional equipment. This makes it easy to seamlessly broadcast a live stream using just a web browser.
Streaming vendors are also working to add WebRTC support to encoding software and hardware through the creation of the WebRTC HTTP Ingest Protocol (WHIP). At Wowza, WebRTC is the underlying technology powering our Real-Time Streaming at Scale feature, and we’re building WHIP support into our future OBS implementation for the feature.
Check out our blog, WebRTC vs. RTMP, to learn more.
RTMP Alternatives for Egress
For last-mile delivery, Apple’s HTTP Live Streaming (HLS) and MPEG-DASH lead the pack, followed by WebRTC.
HLS and DASH
HLS is the most common protocol in use for live streaming today, employed by more than 70% of participants in our 2021 Video Streaming Latency Report.
Which streaming formats are you currently using for delivery?
MPEG-DASH is the open-source alternative to HLS and a standard in the industry.
While HTTP-based protocols have gotten heat in the past for injecting far more latency that RTMP, that’s expected to change. Low-latency CMAF for DASH and Low-Latency HLS promise to support low-latency streaming at scale — and thus delivering the best of both worlds.
WebRTC
The only real-time alternative to RTMP is WebRTC. The WebRTC framework allows users to communicate directly through their browsers with sub-500ms latency.
Large-scale broadcasting used to be an obstacle when using WebRTC, but Real-Time Streaming at Scale now ensures sub-second delivery to up to a million viewers. The feature can be used with WebRTC and RTMP ingest, as shown in the workflow below.
Workflow: Real-Time Streaming at Scale With Wowza
Conclusion
No matter what type of streaming architecture you’re trying to build, Wowza makes it happen. Our full-service platform can power any workflow with reliability to boot. We offer protocol flexibility on the ingest side as well as on the delivery side — meaning you’re able to design the best streaming solution for your use case rather than sticking with one prescriptive workflow.