How to stream better quality video: Part 2 - Adaptive streaming
4 Sep 2014
You want to stream a video clip to several customers. One customer has a high bandwidth leased line connection, while another is trying to view your clip on a mobile device using a poor-quality 3G signal. How do you make sure they each get the best possible video quality? Adaptive streaming may be the answer.
Video streaming sends your video (source) to play back on a computer or mobile device (client), using an internet connection to transport the video. Streaming video is a complex process involving many different components. In this series of articles, we help you understand the basics of streaming video and the various factors that can make a big difference to the quality of your video clip.
In our first article, we looked at the basics of streaming video and discussed good and bad practice. In this article, we look at how to stream video effectively over networks with varying connection speeds.
1. Adaptive streaming: the basics
The general concept of adaptive streaming is shown in Figure 1.
a. Multiple versions:
Starting with a high quality video source such as a High Definition video clip, a video encoder produces versions at multiple qualities and bitrates, for example:
- An HD version at 2Mbps
- A Standard Definition (SD) version at 1Mbps
- A very low resolution version at 50kbps.
Each of these versions is split into small chunks, typically each a few seconds long, and stored on a web server ready for streaming.
b. Index file:
The server maintains an index or playlist file which lists all the media chunks, including the bitrate of each stream and the starting position of each chunk.
c. Streaming to the client:
When the client (the user's software application) requests playback of the video stream, the server returns the index file to the client.
The client requests chunks at the most suitable bitrate, based on considerations such as the available connection bandwidth, playback delay and device capabilities. The server sends each requested chunk in order.
The result: video and audio playback that adapts to suit the network conditions.
The client is initially connected to the internet via a good quality WiFi connection. Streaming starts at 2Mbps and the user sees good quality, HD video with low delay.
The WiFi signal is lost and the client switches to a 3G mobile connection. Streaming switches to 1Mbps, then to 50kbps. The user sees continuous video playback. The video quality steps down to SD then to lower resolution because of the drop in network bandwidth.
The client is configured to start playback as quickly as possible. It automatically requests the lowest quality stream and steps up if the bandwidth is good enough. The user sees basic quality playback very soon after pressing "play". After a few seconds, the video quality improves progressively without any delays or breaks in playback.
3. Practical considerations
Adaptive streaming format. There are a number of choices of adaptive streaming methods, including:
- HTTP Live Streaming (HLS): Originally specific to Apple devices, now available on other platforms.
- Microsoft Smooth Streaming: Developed for Silverlight and Windows Phone.
- Adobe HTTP Dynamic Streaming (HDS): Suitable for streaming to devices compatible with Adobe Flash or Air.
- MPEG Dynamic Adaptive Streaming (DASH): An open standard for adaptive streaming developed by the MPEG standards committee.
Each of these methods has pros and cons. When selecting an adaptive streaming technology, it is important to consider:
- Availability and cost of encoding software tools
- Compatibility with your target clients.
Stream count. How many streams should be created for each video file? More streams will give the client more flexibility to choose the best stream based on the available bitrate and display capabilities. However, each stream needs to be converted (transcoded) from the original and stored on a server. This may increase computing and storage costs.
Chunks and key frames. How many seconds per chunk? Each chunk starts with a key frame, i.e. a video frame encoded without any prediction from other frames. Key frames require significantly more bit rate to transmit than predicted ("inter") frames. Smaller chunks make it possible for the client to switch streams more frequently, leading to faster startup and smoother adaptation. However, smaller chunks require more frequent key frames, leading to poorer transmission efficiency. A good compromise may be to use smaller chunks early in the video stream, increasing the size later on.
4. Going further Part 3 in this series will compare the latest video codecs in depth.
Copyright (c) Vcodex Limited / Onecodec Limited, 2014
---- Professor Iain Richardson is the author of four books on video compression. He leads Vcodex, providers of expert advice on video compression and multimedia communications. http://vcodex.com