• Product
  • Demo
  • Developers
MPS Logo
Tencent MPS Blog
Tencent MPS Blog
Learn

RTMP vs WebRTC, Which is better?

Tencent MPS - Dev Team

The past and present of WebRTC

In 2020, Adobe announced the discontinuation of support for the Flash Player. After many years, Flash finally came to an end. While it was expected, its exit had a significant impact on an important technology that existed in many streaming workflows - the Real-Time Messaging Protocol (RTMP). RTMP was initially designed for transmitting audio, video, and other data to Adobe Flash players. During its heyday, RTMP was the primary technology for video transmission over the internet. It could be used end-to-end and ensured fast real-time delivery. However, compared to the past, more and more devices and browsers no longer support RTMP.

While RTMP remains a reliable video transmission protocol for transferring videos between encoders and servers, it is not the case for RTMP-based playback. Adobe also stated: "Encourage live streaming vendors to migrate existing Flash content to new open formats."

In an issue of Streaming Media magazine in 2020, Robert Reinhard, a streaming media video consultant, warned: "If you're using Flash for low-latency real-time streaming, you have about a year (or less) to migrate to WebRTC. What does this mean? It means any code you're using on Flash-based media servers needs to be migrated to WebRTC (not RTMP)."

However, many content distributors are still striving to replace RTMP with real-time formats for video playback. Why? Because although HLS and MPEG-DASH support high-quality streaming for different devices, they introduce a delay of over 30 seconds due to their HTTP-based nature. While there are low-latency extensions for these protocols (LL-HLS and LL-CMAF for DASH), they still cannot achieve the sub-second transmission speed that many companies are aiming for. Additionally, support for LL-HLS and LL-CMAF (for DASH) in players, CDNs, and various devices is still in the early stages.

What is WebRTC?

WebRTC is an open-source project that empowers real-time communication directly within web browsers. It eliminates the need for additional plugins or downloads, providing a seamless experience for users. The project offers a set of APIs and protocols that create direct peer-to-peer(P2P) communication to allow secure audio and video communication and data sharing between browsers.

We can break it down into 3 points:

  • It's a technology that offers low-latency, high-quality real-time audio and video communication.
  • It's a comprehensive client-side multimedia framework with audio and video processing capabilities, designed for cross-platform compatibility.
  • It's a standardized set of APIs (part of the W3C recommendation), allowing web developers to create diverse real-time audio and video applications.

WebRTC enjoys support from all major web browsers (Google Chrome, Mozilla Firefox, Safari), making it a universal solution for real-time communication.latency

For real-time video transmission, WebRTC is your only choice, and that's why it has gained significant attention in recent years. This HTML5-based technology provides the fastest method for real-time video transmission over the internet. Importantly, similar to RTMP in its prime, WebRTC can also be used end-to-end.

However, WebRTC has its limitations. It is designed for browser-based encoding and small-scale streaming, which makes it unsuitable for certain live streaming scenarios.

Is WebRTC the best solution to replace RTMP? Among developers, this statement has become a popular phrase. As I will explain in the following text, it depends on the technology you are using, the deployment support, and the goals you want to achieve.

RTMP vs WebRTC

Compared to RTMP, WebRTC has several advantages. Firstly, it is a new open-source technology standardized by the IETF and W3C. All major browsers support WebRTC without the need for plugins, eliminating interoperability challenges posed by proprietary streaming technologies. Additionally, the continuous contributions from the software developer community have greatly benefited the development of WebRTC.

Secondly, WebRTC has the lowest latency among protocols when the transmission speed is below 500 milliseconds. This makes it the preferred solution for creating interactive video experiences, ranging from real-time auctions to live shopping. It is also an attractive choice for sports streaming providers aiming to surpass their competitors.

In terms of video production, WebRTC allows for simple live streaming using just a web browser. However, for live streaming providers who prefer to control encoding settings using hardware or software solutions, browser-based encoding may not be ideal. Similarly, when it comes to features like timed metadata for subtitles and ad markers, RTMP has an advantage over WebRTC.

Use WebRTC instead of RTMP for pushing streams

RTMP remains the standard for the first mile video contribution, and there are several reasons for this. Firstly, RTMP has gained widespread support from live encoding software and hardware, and many social media platforms also use it. While encoding vendors have started adding support for open-source protocols like SRT, WebRTC has been limited to browser-based content delivery. WebRTC is very useful for anyone who wants to livestream directly from their web camera and microphone in the browser. However, for content distributors who want to use professional encoders for real-time streaming, WebRTC cannot be used for pushing streams.

Therefore, Millicast's technical team has designed WHIP (WebRTC HTTP Ingest Protocol) to address this challenge. When communicating with media servers, WHIP provides encoding software and hardware with standard signaling protocols, enabling cross-vendor WebRTC pushing. While implementing WebRTC pushing, WHIP retains the low latency advantage of WebRTC (compared to RTMP) and removes the connection barriers between encoders and media servers.

When used for pushing streams, WebRTC ensures low latency, enforced encryption, and support for advanced codecs like Opus and VP9. With the introduction of WHIP, WebRTC is also becoming a format that can be used for hardware and software encoding. The live streaming workflow has more control requirements for encoding settings, including bitrate, codecs, and codec parameters, and the emergence of WHIP allows WebRTC to directly compete with RTMP.

Use WebRTC instead of RTMP for pulling streams

Browsers no longer support RTMP, making it unusable for playback. Nowadays, most live streaming providers use HLS for the "last mile" delivery, but HLS has a latency of over 30 seconds.

What streaming formats are you currently using for video transmission?

protocol

When it comes to low-latency protocols, WebRTC is the fastest among many protocols. Therefore, if you need true interactivity (such as for emergency response and remote monitoring scenarios) with sub-second video transmission, WebRTC is your best choice. LL-HLS and LL-CMAF for DASH are also good options, but they cannot achieve real-time transmission like WebRTC.

In other words, WebRTC was not initially designed for large-scale live streaming scenarios. In the past, we encouraged content distributors to use modified HLS or LL-HLS for interactive content when streaming to a large audience. However, we have made improvements to address this issue.

Specifically, we have developed a new feature that allows deploying WebRTC on a custom CDN, enabling near-infinite scalability. This solution enables sub-second video transmission for globally large-scale audiences.

How to use WebRTC on Tencent MPS?

Tencent MPS supports WebRTC protocol for live streaming, and customer feedback indicates that compared to traditional RTMP, WebRTC significantly reduces live streaming latency and improves resistance to poor network conditions during live streaming.

You can experience it in the following ways:

1. Using Live Event Broadcasting (LEB). For detailed operations, please refer to Getting Started.

2.You can experience the ultimate performance of WebRTC by visiting our Demo.

webrtc-demo

If you have any questions about our services, don't hesitate to Contact Us.

Stream