Optimizing LL-HLS: 4 Recommendations For The Best Low-Latency Streaming
by Negar Hajihoseini on September 22, 2021
In the previous blog, we’ve covered the 4 key factors affecting the quality of low latency streaming experience when utilising Apple's LL-HLS protocol. Additionally, we have also discussed the importance of GOP size and its impacts on the overall viewing experience. In this blog, we will provide 4 recommendations that you can implement to ensure the best QoE.
THIS IS A SNIPPET FROM OUR “OPTIMIZING LL-HLS FOR LOW LATENCY STREAMING” GUIDE WHICH YOU CAN DOWNLOAD HERE.
Depending on the use case and the desired priorities (e.g. latency, bandwidth, consumption, video quality and network resiliency), encoding and packaging parameters, as well as buffer size, could be configured differently. Here we go through the most important parameters:
1. GOP: Set your keyframe interval to 2-3 seconds
Based on the explanation in our previous blog, small GOP sizes seem extremely attractive. However, if you have a lot of keyframes, it increases inefficiency in compression, which means you will use more bandwidth and streaming quality will go down for the same bitrate. This effect becomes large when GOP sizes fall below 2s. In case you are interested in lower bandwidth consumption and reasonable start-up time, the recommendation from THEO’s side would be to set your keyframe interval to 2 to 3 seconds. On the other hand, if your priority is to have small start-up delays and low latency, the GOP size should be smaller and should be set in a way that all parts start with a keyframe.
2. Part Size: Use 400msec Part Size in for the lowest end-to-end latency
As discussed previously, in an ideal world, the part size and the GOP size should be equal to have the least zapping time because in that case we have all parts marked as “independent” and the player can start the playback at any part boundaries. But having a smaller part size will lead to a lower minimum buffer size and so lower latency. However, too small a part size will cause overhead because of too many HTTP requests that should be handled. If you can guarantee the perfect network condition and your main focus is to have the lowest end-to-end latency, we recommend using 400 msec part size. If instead the network condition is variable and you need to have a smooth playback during network ups and downs and also benefit from extra-low zapping time, we recommend setting your keyframe interval and part size to 1 second as it strikes a balance between latency and viewer experience at start-up.
3. Segment Size: Set it equal to or larger than your GOP size
As in the first article, we've established that the segment size should be equal to or larger than your GOP size. It cannot be too small due to consequent poor video quality and it cannot be too large because of the LL-HLS limitations mentioned above. Apple’s recommendation for segment size is 6 seconds for LL-HLS which is a good balance between video quality and overhead in the network. In HESP you won’t have such limitations for large GOP size and long segments which leads to better video quality and lower bandwidth consumption.
4. Buffer Size, Network Tolerate & ABR: Find the best middle ground
For Low latency / fast startup streaming with LL-HLS, it is important to have a clear understanding of the impact of each parameter on the final result. End-to-end latency depends directly on the part size. On the other hand, the zapping time depends directly on the GOP size and it can not go lower than that even with smaller part size.
So the lowest latency you get from the smallest part size, but that does not bring the shortest zapping time necessarily (for example when the part is shorter than the GOP and it is not one of its divisors e.g. 1/2 or 1/3 or ... of the GOP). Small part sizes (smaller than GOP) are not really helpful during the quality switch for ABR as the quality switch can happen only at independent parts which correspond to the GOP boundaries.
Therefore, the ideal situation to have the lowest zapping time and latency is to have the part and GOP size equal and as small as possible. A GOP size lower than 1 sec does not really make sense because of the poor video quality and high bandwidth needs, therefore a good value would be 1 second in order to achieve the lowest zapping time, latency and smooth ABR switches with 2 seconds buffer (2 parts). However, the GOP size of 1 second could be demanding for the bandwidth consumption. THEO's recommendation would be a GOP size of 2 seconds with the part size of 1 second and buffer size of 3 seconds which is a good combination for reasonable video quality, bandwidth consumption, latency and zapping time.
In the last blog of this Optimizing LL-HLS series, we will compare how LL-HLS fare against THEO's very own HESP. You can download the complete version of this topic in our “HOW TO OPTIMIZE LL-HLS FOR LOW LATENCY STREAMING” guide here.