The COVID-19 pandemic has fueled a surge in live streaming across many industries, particularly entertainment, e-commerce, online education, and gaming. With the increasing maturity of AI, cloud computing, advanced audio and video technologies, live streaming now has the power to expand viewership from hundreds to millions and reach global audiences at an unprecedented scale. With so many live streaming services to choose from, viewers have almost complete control over their viewing decisions, and no longer have to settle for subpar broadcasts and live streams.
Beyond viewer annoyance, latency in live streaming is an inhibitor that should be solved using ultra-low latency solutions for making online video streaming a more engaging and immersive experience and keeping customer satisfaction levels high.
Traditional broadcasts can no longer meet the needs of today’s streaming audience. The following example shows why. In this figure:
- Anchors push the stream through RTMP or FLV.
- The stream is delivered by a Content Distribution Network (CDN)
- End users pull the stream for viewing using protocols such as RTMP, FLV, and HLS.
In the live streaming infrastructure above, RTMP or FLV generates a 3-to-5-second delay due to the RTMP/FLV live streaming protocol. After caching, transcoding, and distributing the content through the CDN, the latency may exceed 10 seconds. For HLS, it would be even higher. It soon becomes obvious that traditional live streaming architecture is simply unable to meet the low-latency requirements of today’s streaming users.
What is WebRTC and how does it work?
The advent of Web Real-Time Communication (WebRTC) technology has made live broadcasts with lower latency a reality.
WebRTC was first released by Google in May 2011 as an open-source project for browser-based real-time communication. It has been adopted as a standard by the World Wide Web Consortium (W3C) and Internet Engineering Task Force (IETF). Unlike RTMP or FLV, WebRTC is not a protocol. It is an open-source framework that provides standard, protocol, multiple streaming components and web API. With WebRTC, developers can easily build their own multimedia applications without installing any plug-ins or being concerned about media processing – simple JavaScript programs will work.
The key to low latency for WebRTC is the User Datagram Protocol (UDP), a connectionless protocol in the Internet protocol suite. During data transmission through UDP, the source and endpoint do not establish a connection (also known as a TCP handshake). Instead, the endpoint fetches data from the source, and then directs it to the network as fast as possible, without splitting or splicing the content. This makes the data transmission of WebRTC more efficient than other TCP-based protocols such as RTMP or FLV. WebRTC also has mechanisms for handling packet loss, garbled order, and delayed arrival — all of which enable the transmission to work even in poor network environments.
Limitations of WebRTC streaming
Until now, this paper described WebRTC and its benefits. Among its benefits, low latency is at the top of the list. But there are inherent limitations of scale and quality when deploying WebRTC. For example, the audio and video coding formats and data transmission efficiency supported by WebRTC cannot meet the needs of live streaming. For example:
Standard WebRTC places a limit on audio and video coding format.
WebRTC supports only the Opus audio-encoding format and the video-encoding formats VP8/VP9 and H264 without B frame. It does not support AAC for audio or H.265 for video, which further limits WebRTC applications when it comes to ultra-low latency live streaming.
Stream of standard WebRTC is encrypted.
Such encryption can further increase handshake times and transmission bandwidth. CDNetworks provides a series of security measures that include anti-hotlinking, back-to-origin authentication and anti-hijacking to ensure the security of your live streams. Based on these security features, CDNetworks enhances the data encryption of standard WebRTC to reduce initial pickup times and lower bandwidth costs.
Standard WebRTC regulates only basic real-time communication rules.
Besides basic rules, when searching for a complete live streaming business solution, it is also vital to choose transcoding, recording, and other capabilities that are compatible with WebRTC.
CDNetworks’ Optimization over WebRTC
CDNetworks is an early adopter of WebRTC for low-latency live streaming environments. To address the challenges mentioned above, CDNetworks optimizes standard WebRTC and upgrades traditional CDN network architecture, reducing the latency of live streaming to less than 500 milliseconds.
See what we have optimized for standard WebRTC:
Support for various stream pushing methods
WebRTC
Pushing live streams through WebRTC can avoid cost increases and delays caused by transcoding when the streams are pulled. But WebRTC supports only Opus for audio encoding and H.264 without B frame for video encoding when pulling streams. If you push streams through any other protocol (for example RTMP, which uses AAC format of audio, or normal H.264 with B frame), you need to transcode RTMP into standard WebRTC for stream pulling, which increases latency and costs due to transcoding. Here are some common methods to push a stream through WebRTC:
1) WebRTC pushing plug-in for OBS:
OBS is the most popular encoder for PC. CDNetworks provides a plug-in for OBS, enabling you to use OBS directly for WebRTC pushing.
2) WebRTC pushing SDK for H5:
Currently, WebRTC is a popular choice for pushing streams onto browsers. CDNetworks provides a set of SDKs that empowers you to integrate WebRTC features in short time.
RTMP/SRT
You can also push streams through RTMP or SRT, and then pull the stream through WebRTC. This approach migrates streams to our Low Latency Streaming Product without requiring modifications, which reduces costs and avoids other difficulties.
Optimizations over the transmission
CDNetworks optimizes standard WebRTC to enable superior stream delivery:
- Supports AAC and H.265 to reduce latency caused by video/audio transcoding
- Supports B frame for smooth playback
- Removes DTLS encryption from standard WebRTC, and provides proprietary security strategies that has a lower transmission consumption and latency.
CDNetworks’ WebRTC infrastructure also supports traditional live streaming features including transcoding, recording, and watermarking.
Multi-platform SDK support for stream pulling
CDNetworks provides SDKs for Android, IOS andH5 to meet the needs for a wide variety of end users. If you already have your own player or integrate any third-party players, CDNetworks has a proxy version SDK that you can quickly integrate to produce low-latency live streaming without any modifications to the player you are already using.
Read More:
CDNetworks reduces the latency to milliseconds
High latency in live sports streams can be disastrous for fans, and can result in game spoilers, misplaced bets, and wrong moves in fantasy sports. Most live events, such as League of Legends, Premier League, the World Cup, and the Olympic Games, use RTMP as their live stream delivery protocol over the Internet. RTMP imposes a delay of from 3 to 5 seconds. Imagine your neighbor cheering at a live goal being scored in a football game on TV while you wait to see the very same goal on the live broadcast. Viewing experiences are greatly compromised on live broadcast platforms when those platforms are unable to match the real-time nature of TV. China’s leading live event platform reduces latency to 465 milliseconds by using CDNetworks’ WebRTC Low Latency Streaming solution, which delivers immersive live sports viewing experiences to users.
CDNetworks has been dedicated to addressing low latency live streaming for several years. Our Low Latency Streaming solution has been widely adopted in scenarios such as e-commerce, sports, remote IOT, online education, and virtual reality. For example, in live e-commerce, CDNetworks’ Low Latency Streaming ensures a time-synchronized experience for buyers and sellers alike. And with concerns over the transmission of COVID-19 forcing schools to close and preventing millions of students from physically attending school, CDNetworks’ Low Latency Streaming makes virtual learning a reality, delivering interactive experiences similar to the real classroom for both teachers and students.
Going forward, CDNetworks will continue to explore low latency live streaming technologies to offer interactive live streaming with even less latency and greater stability.