What is live streaming?
Streaming is a method of delivering data over the Internet without making end users fully download the data. Live streaming is a type of streaming in which the stream is sent over the Internet in real time, without first being recorded and stored.
Video game streaming, social media streams like Periscope and Facebook Live, and professional sports broadcasts over the Internet are all examples of live streaming. Although both audio and video can be live streamed, this article will focus on live video streaming.
What is video encoding?
Video encoding is the process of compressing video data so it can be efficiently sent to another location. The device on the receiving end of a stream – say, a tablet on which a user is watching their favorite TV show – decodes the encoded data. Video encoding follows publicly known standards so that a variety of devices can interpret the encoded stream.
Video encoding is necessary for two main reasons:
- Uncompressed video files take far too long to send over the Internet for streaming to be practical.
- Video has to be in a format that any user device – smartphones, laptops, PCs, etc. – can interpret.
In a video live stream, a device takes audiovisual inputs, encodes them, and sends them out to the audience all at the same time. The encoding part of this process is essential for allowing a variety of user devices to receive and play the video.
How does live stream encoding work?
A live stream from a source that captures video – e.g., a webcam – is sent to a server, where a streaming protocol such as HLS or MPEG-DASH will break the video feed into smaller segments, each a few seconds in length.
The video content is then encoded using an encoding standard. The encoding standard in wide use today is called H.264, but standards like VP9, AV1, and HEVC are also growing in use. This encoding process compresses the video by removing redundant visual information. For example, in a stream of someone talking against the background of a blue sky, the blue sky does not need to be rendered again for every second of video, since it does not change a lot. Therefore, the blue sky can be stripped out from most frames of the video.
The compressed, segmented video data is then distributed using a content delivery network (CDN). Without a CDN, very few viewers will actually be able to load the live stream – the final section of this article explains why.
Most mobile devices have a built-in encoder, making it easy for regular users to live stream on social media platforms and via messaging apps. Brands and companies that want a higher quality stream use their own encoding software, hardware, or both.
How are newer technologies making live streaming faster?
With many live streams, viewers still experience 20 to 30 seconds of latency – in other words, the content they view is 20 to 30 seconds behind real time. This is partially because each segment of video has to fully load before it can play, and each segment of video can take several seconds to load.
One solution to this delay is a process called chunked encoding. This process works by "chunking,” that is, breaking up the video segments into even smaller pieces. Then those smaller pieces are encoded, and the devices receiving the stream can play these smaller chunks before the entire segment loads.
How are CDNs getting better at accelerating live streaming?
CDNs are essential for live streaming because they make it possible to distribute the stream to users in vastly different locations. Also, CDNs have much more bandwidth for distributing the stream than a single origin server. Without a CDN, the live stream can easily run into bandwidth issues.
However, most CDNs still have to load a full segment of video before they can serve the segment to multiple users at once. This reintroduces the latency problem that chunked encoding is supposed to solve.
To speed up live streaming, Cloudflare offers a feature called concurrent streaming acceleration. The Cloudflare CDN can deliver a segment of video to multiple end users at once while it is still loading, eliminating the wait time while the entire segment loads. The Cloudflare global network spans 200 cities in more than 100 countries, enabling users around the world to tune into a high-quality, real-time live stream.