RTMP vs WebRTC — Choose The Right Video Streaming Tech

Kai Yang
4 min readMay 22, 2020

Live video streaming has been a popular technology for decades, with the outbreak of coronavirus pandemic, more and more businesses start to seek live streaming solutions to help their employees working remotely. While lots of people choose to use off-the-shelf solutions such as Zoom, many decide to build their own streaming app. In this article, we will compare some of the most popular video streaming protocols available, and to help people choose the right technology for building video streaming application.

RTMP vs WebRTC

Video Streaming Protocol

There are a lot of elements that form the video streaming technology ground, those include data encryption stack, audio/video codecs, transmission protocols, etc. Among them, the streaming protocol is responsible for the delivery of audio/video data from its source to the end-user across the internet. While media data can be transmitted via normal HTTP web protocol, for faster and more reliable data streaming, protocols such as RTMP or WebRTC are created.

RTMP (Real-Time Messaging Protocol)

RTMP was developed by Macromedia (now part of Adobe) back in the 90s, and was initially used to transmit audio and video data between Flash player client and the streaming server that hosts the media file. With more than 20 years in age, this technology has been widely adopted and used by lots of popular softwares (e.g. OBS) and websites (such as YouTube). There are a few variants of the original RTMP, this include the more secure standards RTMPS/RTMPE that use encryption, and the RTMPT/RTMFP standards that uses HTTP or UDP network protocol.

WebRTC

WebRTC on the other hand, is an emerging technology that starts to gain popularity in recent years. Unlike RTMP, WebRTC is more than a protocol. The technology covers transmission protocols, as well as the Application Programming Interfaces (APIs) that are used for Real-Time Communication (RTC) between web browsers and mobile applications. Since WebRTC is a W3C standard, it is widely supported by modern browsers, and allows audio and video data to be transmitted directly among web pages.

Other Protocols

There are lots of other video streaming protocols developed over the years, this include the HLS protocol by Apple, MPEG-DASH, HDS by Adobe. Since most of those protocols are either vendor specific, or not widely used on the Internet, in this article we will focus on the following two protocols: RTMP and WebRTC.

RTMP vs WebRTC

Choosing between RTMP and WebRTC is not a simple yes-or-no question, as both technology has their own strengths and limitations.

Latency

RTMP is based on Transmission Control Protocol (TCP), and it allows data transmission in given sequence and order with delivery guarantee. Even it uses more reliable network connection, latency is often 0.5 seconds or more dependent on network settings. On the other hand, WebRTC is based on UCP, and it offers near real-time latency with less than 0.1s. Hence WebRTC is arguably better for two-way conferencing or real-time device control.

Scalability

In terms of scalability, RTMP can be scaled to provide live streaming to thousands or even millions of audiences. In contrast, WebRTC is often used to provide live streaming to smaller number of audiences, normally within thousand limit. However, this is debatable, as some people argue that the Peer-to-Peer nature of WebRTC will not cause scalability issues if implemented properly. But when it comes to scaling, RTMP is definitely taking the lead. For use cases that require live streaming to thousands of viewers, RTMP is the better choice.

Encoder/Player and Browser Support

Due to the wide adoption of RTMP, it is supported by most encoder software and video players. However, due to the end of live of the Flash player, it starts to lose support by modern browsers. On the other hand, WebRTC has better support by modern browsers with built-in API support in HTML5, and can be played within most modern browsers without installing any software or plugins. In terms of encoder or video player support, lots of software vendors start to recognise the popularity of WebRTC, and start to add WebRTC into their support list.

Cloud Support

Most cloud providers such as AWS or Alibaba Cloud have video streaming services that can be directly integrated with RTMP. For example Alibaba Cloud has a service called ApsaraVideo Live that is compatible with RTMP. In contrast, to run video streaming using WebRTC, we will need to install on-promise streaming servers such as Jitsi Meet on to the cloud.

API Support

When it comes to development, API support is a key factor for choosing your technology. WebRTC is taking the lead for API support, as most modern browsers have native API integrated with WebRTC, can be called directly using Javascript. On the other hand, to work with RTMP, we will need to leverage open source library, or use pre-existing software solutions such as OBS.

Conclusion

In summary, both RTMP and WebRTC are popular technologies that can be used to build our own video streaming solutions. RTMP has better support in terms of video player and cloud vendor integration. On the other hand, WebRTC offers faster streaming experience with near real-time latency, and with its native support by most modern browsers, it is easier to work on for people with web development skills such as Javascript. Since each technology has it own strengths and limitations, they can be selected interchangeably based on the use case, dev efforts/timeline, and people’s skills.

--

--

Kai Yang

Ph.D in Semantic Web, Multi-Cloud Technical Leadship, WeChat Development Veteran, Polyglot Coder with Love