This was the name of the secret project that would soon revolutionize the internet. The year is 2002. A team of engineers at Macromedia, later acquired by Adobe, are hard at work on a new streaming protocol. RTMP, or Real-Time Messaging Protocol, is what they call it. And, it is soon going to be an integral part of the digital video ecosystem.
For the uninitiated, Adobe's Macromedia Flash Player was once a must-have to watch videos online. If you didn't have it, you couldn't watch over 90% of the digital videos. It was that simple! This was because RTMP was a proprietary technology exclusively used in the flash player.
But this hegemony was only until HTML5 came along and started making the flash player obsolete. RTMP, however, persisted.
In a nutshell, RTMP is a protocol that allows for high-quality, low-latency streaming of audio and video data over the internet. It was designed specifically for Flash Player to stream online videos.
- RTMP is a TCP-based protocol, which means it uses a constant connection between the client and server. This allows for real-time streaming of data with no interruptions.
- RTMP also supports multiplexing, so multiple streams can be sent over a single connection. This is useful for scenarios like live events where there are several cameras or microphones in use.
- RTMP is a very versatile protocol and can be used for a variety of applications beyond just streaming video. For example, it can also be used for audio conferencing and file transfer.
History of RTMP: How RTMP became popular?
RTMP was developed to solve a perennial problem the internet was struggling with during its early days. It was the delivery of high-quality, low-latency video streams.
Back then, there were a few platforms like Newgrounds that distributed video content online. But very little video streaming existed digitally. And, it meant waiting for 24 to 48 hours to download a 1-minute video file and then watching it on your PC.
The challenges of streaming video and audio were formidable, especially with low bandwidth and poor latency. Even Netflix was distributing DVDs physically.
In case you're unfamiliar, a video is a set of "moving pictures". The video, as we know it, is this set of moving pictures coupled with a soundtrack (audio file). During the early internet days, transmitting a single image was challenging due to multiple reasons. Sending a playable video and audio stream together was a different ballgame altogether.
That's where RTMP came in. It delivered a smooth, high-quality video and audio stream with minimal latency. For the first time, people could actually watch VHS-level video quality on the internet. Nevertheless, RTMP was still a proprietary protocol used in Adobe Flash Player. That’s how the player became the de-facto standard for watching online videos. However, its days were numbered.
Concerns started getting raised about Flash Player’s security, reliability, and performance by the late-2000. In 2010, Steve Jobs famously wrote an open letter called "Thoughts on Flash". It mentioned how Flash Player was not suitable for smartphones. A debate raged soon after, which marked the beginning of the end of Flash Player.
In 2011, Adobe made RTMP open source while still keeping its encrypted version proprietary. HTML5 launched in 2014 and eliminated the need for Flash plugins. By 2016, major browsers, including Google Chrome, blocked Flash by default and gave preference to HTML5 instead.
Ultimately, in 2017, Adobe announced it would stop maintaining Flash Player. This effectively pulled the plug on the player and, with it, on RTMP... well, almost!
So, Is RTMP dead?
No, it isn’t. Even though Flash Player has now been phased out by Adobe and RTMP is mostly deprecated for general use, the protocol continues to live on.
RTMP has been adopted as a standard by many popular streaming platforms like YouTube Live, Facebook Live, etc. Even though the Flash Player is now gone, platforms also need RTMP due to legacy reasons or to tap some of the protocol’s wide-ranging advantages.
But why are leading industry names using a deprecated protocol? Doesn’t it go against the general logic?
The answer is "no" again. This is because they either don’t use RTMP or use it for first-mile delivery (more on this in the next section). For instance, streaming platforms like YouTube Live and Facebook Live use RTMP for ingestion (or receiving a video stream). Platforms may also be using a variant of the protocol called RTMPS, an encrypted RTMP that uses TLS/SSL for security. The 'S' in RTMPS stands for 'Secure'.
Alternatives to RTMP
RTMPS isn't the only streaming protocol worth mentioning. There are several other strong contenders given the use cases.
But before we begin, we must note that people tend to compare first-mile (ingest) protocols (such as RTMP and SRT) with last-mile (delivery) protocols (such as HLS or DASH). This isn’t the right comparison to make. It’s like comparing a fuel tank of a vehicle to its tailpipe. Both have different purposes. Both do what they’re designed to do. And, you need both to get the job done.
We should compare first-mile protocols like RTMP with other first-mile protocols such as SRT, WebRTC, or even proprietary protocols, and last-mile protocols with other last-mile protocols.
That being said, here are some first-mile alternatives to RTMP streaming:
1. Secure Reliable Transport (SRT)
Secure Reliable Transport is an open source protocol developed by Haivision that aims to deliver low-latency video over the internet. We can use SRT for both live and on-demand content. It offers several features such as encryption, error correction, and adaptive bitrate streaming. The main advantage of SRT is its low latency (around 1 second) which makes it ideal for live events where every second counts. However, SRT is relatively new and doesn’t have adequate encoder and media server support as of now.
2. Web Real-Time Communications (WebRTC)
Web Real-Time Communication is a browser-based protocol that allows for real-time audio and video communication with no plugins or extra software. WebRTC is supported by most modern browsers including Chrome, Firefox, Safari, and Edge. The main advantage of using WebRTC is that it’s built into the browser so there’s no need to install anything else. Another benefit is that since it’s peer-to-peer, there’s usually no need for a server in the middle which reduces costs. However, it doesn’t offer some of the same features as RTMP such as security and access control (DRM). It also brings up challenges in terms of scalability.
3. Reliable Internet Stream Transport (RIST)
Reliable Internet Stream Transport is a new open source protocol developed by the Video Services Forum. It’s designed to provide low latency streaming with added features such as security and error correction. RIST is still in development so it’s not widely used yet. But once it’s finalized, it could be a strong contender for RTMP replacement given its feature set and open source nature. Right now, it is not fair to compare RIST with RTMP. It is more comparable with SRT.
4. Real-Time Streaming Protocol (RTSP)
Real-Time Streaming Protocol is a network control protocol that’s been around for quite some time. It’s most commonly used for IP cameras but can also be used for streaming video from a media server. It’s also an ingest-only protocol. RTSP offers several features such as authentication, encryption, and access control. The main advantage of using RTSP is that it’s well supported by most IP camera manufacturers. However, it doesn’t have wide adoption outside the surveillance market so finding encoders and media servers that support RTSP can be difficult.
Now, coming back to RTMP, it's safe to say that the protocol isn’t dead and is far from being so in the near future. While it might not be as widely used as it once was, RTMP continues to power some of the most popular live-streaming platforms and applications today.
Let’s understand why.
Advantages of RTMP
1. Involves Lower Overheads
RTMP leverages chunking, which breaks large messages into smaller ones at the higher-level protocol. These small messages have a compressed representation of information in their chunk headers, which reduces the overhead significantly.
2. Offers Low Latency
Since RTMP uses a constant connection between the client and server, it's able to offer low latency streaming with minimal interruptions. The latency of RTMP is below 5 seconds.
3. Is Widespread and Adequately Supported
RTMP has been around for a long time and is one of the most widely used streaming protocols. This has resulted in wider support from encoders, media servers, and other streaming-related software and hardware.
4. Allows for Multiplexing
RTMP allows multiple streams to be sent over a single connection. This is useful in cases where there are multiple cameras or microphones in use (like live events). The protocol can send different formats of audio (MP3, AAC, etc.), video (FLV, MP4, etc), and text into one cohesive package.
RTMP is a very versatile protocol. It can be used for live streaming, video on demand (VOD), real-time messaging, and more. The protocol further allows the user to skip or rewind sections or join a live stream midway.
6. Access Control
RTMP also supports access control, which allows you to restrict who can view your live stream. This is useful if you only want certain people to have access to your stream. You can also use RTMP to create simple DRM solutions.
RTMP is a very scalable protocol. This aspect becomes important if you’re planning on streaming to a large number of viewers.
Disadvantages of RTMP
1. HTTP Incompatibility
RTMP is incompatible with HTTP. You will need to build an RTMP Server or use a CDN for an RTMP stream.
2. Is Not Supported by All Browsers
Hardly any browser supports proper RTMP. In such cases, they run into playback and compatibility issues. This can limit its usefulness for streaming purposes.
3. Bandwidth Issues
RTMP streaming can also get crippled by bandwidth-related challenges. This leads to a sub-optimal user experience. It also has some low-bandwidth vulnerabilities.
4. Legacy Protocol
RTMP is now considered outdated and is maintained because of legacy purposes. This support may dwindle with time.
These were some disadvantages of RTMP. Although the protocol may phase out later, it isn’t happening soon. Even so, RTMP might continue to exist in some form or the other.
So, where is the middle ground?
While innovative protocols such as HLS and DASH solve the major challenges in streaming high-quality and secure videos, they’re not the best way forward for encoding. HLS- and DASH-compatible encoders have high latency (up to 45 seconds) for live streams. So, the middle ground, as it turns out to be, comes across as RTMP ingestion.
RTMP ingest is a process that's used for encoding videos using the RTMP technology and then delivering it to an online video platform like Teyuto. Here, by creating an RTMP Server, the online video platform takes in the RTMP video feed and transmuxes it into the HLS format for optimum playback and streaming experience. This is the best approach and gives you the best of both worlds.
To sum it up...
RTMP is a legacy protocol that's used for streaming audio and video data over the internet. Even though it's been deprecated for general use, the protocol continues to live on owing to its many advantages including lower overheads and sub-5-second latency.
RTMP has its unique advantages and disadvantages. If you have to decide to go with RTMP or not, give preference to protocols like HLS and DASH instead. They’re popular and internet standard for a reason. But, at the end of the day, the choice is yours to make. Choose wisely!