The Challenges of Adaptive Streaming
There are few things that are universally hated (always a fun start to a blog post) but I would be willing to bet that the experience of trying to watch internet videos on a temperamental network connection is one of them. I wonder how many hours I've wasted watching that little spinning buffer wheel go round and round and round…
Well, the good news is that the Connected TV team at BBC R&D is working towards making those ‘insufficient bandwidth’ messages a thing of the past. One technology that is helping us get there is adaptive streaming.
Adaptive streaming works by encoding the same media file at a number of different bit-rates, which produces multiple ‘representations’ of the content, each at different qualities. As the quality of the internet connection varies, the streaming client can switch between the different representations to provide a smooth viewing experience. When the connection is good, a high bit-rate representation will be requested, resulting in a good quality picture. If the connection worsens, the client will request a lower bit-rate, resulting in a slight decrease in picture quality but a better overall experience since it avoids freezing and rebuffering.
Adaptive bit-rate streaming. Source: Wikipedia user Daseddon
The BBC is already using adaptive streaming (e.g. for Wimbledon and the Olympics), however there is still work to be done to understand how the technology can be optimised for different network environments. This is where I come in - for my second trainee project I am investigating the characteristics of residential broadband networks, and looking into how we can produce and test different algorithms that decide which representation to request based on the network environment. It might sound trivial – surely you just check the download speed and request the maximum quality representation the connection can cope with at that time?!
Alas, if it were only that simple. As it turns out, both determining the download speed and deciding which quality to request are more complicated than you might imagine…
Networks can suffer from short-term fluctuations; in particular Wi-Fi is notorious for brief losses of connection (blame the microwave!). Although the connection will quickly recover, if the measurement happens to take place during the fluctuation it can give an inaccurately low value for the available bandwidth, and, if the algorithm doesn’t account for this, an unnecessary shift to a lower bit-rate.
The behaviour difference between wired and wireless networks also causes more fundamental problems. TCP, the protocol responsible for reliable data transmission over the internet, was designed with wired networks in mind. In wired networks, packet loss usually indicates congestion on the network, so TCP sensibly decreases the amount it is sending in order to reduce the network traffic. Unfortunately, TCP behaves exactly the same on wireless networks, where packet loss is far more likely to be just a random occurrence and no traffic reduction is necessary.
Bearing all this in mind – the streaming client needs to decide which representation to choose. Should it aim to maximise quality or minimise bit-rate changes? If the level of quality keeps jumping around all over the place it might be more irritating than watching something at a slightly lower but more consistent quality.
The size of the buffer may influence the choice. It might be a good idea to download some video ahead of time and store it in a buffer. If there is a lot of data in the buffer, you can risk waiting out short drops in bandwidth and maintaining a higher quality as video in the buffer will see you through. However, larger buffers mean slow start up times and slow reaction to controls like skipping, as you have to wait for the buffer to fill. You don’t want to be flicking through the channels and have to wait four seconds or so for anything to appear each time you change! Another disadvantage is that the more you buffer the further you are behind the ‘live’ stream – and you really don’t want to be in the frustrating situation of hearing your neighbours cheer for a goal you then know you’ll see in a few seconds time!
Then of course we have the problem of competing users. If there are multiple people watching adaptive video, currently the streaming clients get all confused. Either the quality oscillates wildly as they alternate bandwidth allocation, or one client ends up hogging all the bandwidth leaving the other with very poor quality. Ideally, we would like them to even out fairly and consistently.
So how can we make sense of all this to try and produce a more effective algorithm? I'm working on creating models of typical residential broadband networks over which we can test different adaptive algorithms. This involves using network simulation software to create topologies based on typical residential network characteristics. We can then simulate running different algorithms over these network topologies and output a range of metrics to allow us to assess their performance. This is likely to involve both statistical data (such as the likelihood of freezing/rebuffering, number of bit-rate shifts and the average quality) and graphical data (comparing how available bandwidth and requested bit-rate vary over time, to see how closely the two match).
This framework will allow us to assess existing algorithms and use the results to inform the development of improved algorithms which can then be refined in a similar way.
You might be wondering why any of this really matters to an organisation whose primary delivery method is through conventional broadcasting. Although currently IPTV is used mainly for accessing on-demand content, its advantages can’t be ignored, and there is an emerging trend that could see delivery over IP applied to a much wider range of services. As well as on-demand viewing, IP delivery enables viewers to watch content on the go on mobile devices, and allows access to a potentially much larger selection of content than can currently be broadcast through conventional means. With over 106 million requests for online BBC Olympic video content, it's clear that the public is embracing IP streaming.
As more and more TVs and set-top boxes come with internet connectivity, it is likely that what you watch from your sofa will be increasingly delivered over IP. And, just like an effective adaptive algorithm, we hope to make the transition as smooth as possible.