Back to Dashboard

Project 2 Adaptive Bitrate Streaming-Model Predictive Control

Author: Zhen Tong 120090694

Preface

This is a computer network course second project in CUHKSZ. We are asked to reproduce one algorithm for the Adaptive Bitrate problem. And this document is write for MPC(2015 SIGCOMM) reproduction.

Problem Definition

Video Streaming Model

The model is transmit by means of chunks V{1,2,...,K}. And each chunk contains L seconds of video. The chunk in the chunks sequence can be in different bitrates. We denote R as the bitrate level. The end-point video player can choose to download chunk k with bitrate Rk. Let dk(Rk) be the data size of chunk k at bitrate Rk. In this project, we focus on the constant bitrate case which is dk(Rk)=L×Rk.

With a higher bitrate Rk, the user can perceive better video quality q(Rk). The video content is downloaded into a playback buffer, which contains downloaded but unviewed video Denote B(t)[0,Bmax] be the buffer occupancy at time t.

We can write the download process in the buffer formally:

tk+1=tk+dk(Rk)Ck+Δtk

In this function, Ck is the average download speed during the the downloading time of chunk k, and Δt is the time unrelated to the downloading (e.g. the parsing time, algorithm run time to choose bitrate, and overhead)

Ck=tktk+1ΔtkCtdttk+1tkΔtk

Ct is the infinitesimal of network throughput at time t. Totally, we can model the buffer increase and decrease by this formula:

Bk+1=((Bkdk(Rk)Ck)+LΔtk)+

After the one chunk k downloaded, the buffer occupancy increase by L time because the chunk of data can play for L time, and the buffer decreases by dk(Rk)Ck because it use such long time to download, while the video is also playing by the user, which consume the buffer occupancy. The notation of (x)+=max{x,0}, ensures the buffer will never be negative.

video_model

 

QoE Maximization Problem

Another goal is improve the QoE of users. This project provides a flexible QoE.

Average Video Quality = 1Kk=1Kq(Rk)Average Quality Variations=1K1k=1K1|q(Rk+1)q(Rk)|Rebuffering=k=1Kmax{dk(Rk)CkBk,0}Ts<<Bmax

Every user have different preference therefore, the QoE is a weighted sum of the four measurement.

QoE1K=k=1Kq(Rk)λk=1K1|q(Rk+1)q(Rk)|μk=1Kmax{dk(Rk)CkBk,0}μsTs

In the paper, researchers use 3 sets of weights:

MPC Algorithm

Our goal is to design a good function f() to predict the bitrate Rk according to the previous information:

Rk=f(Bk,{C^t,t>tk},{Ri,i<k})

Obviously, using the rate-based function f({C^t,t>tk},{Ri,i<k}), and buffer-based function f(Bk,{Ri,i<k}) are all just sub-optimal in this context of question.

RBBB

The intuition here is that network conditions are reasonably stable on short timescales and usually do not change drastically during a short horizon (tens of seconds). Based on this insight, we can run a QoE optimization using the prediction in this horizon. Focusing the horizon between [tk,tk+N], we predict the bitrate, and then move the horizon one step further to [tk+1,tt+N+1]

2-alg1

Because this paper is not focus on the predictor function, they refer to the previous work(click to see paper), and use the harmonic mean of the observed throughput of the last 5 chunks because it is robust to outliers in per-chunk estimates

The core optimization in this algorithm is:

2-optimal

Change into dynamic programming

QoEiK=k=iKq(Rk)λk=iK1|q(Rk+1)q(Rk)|μk=iKmax{dk(Rk)CkBk,0}=q(Ri)+k=i+1Kq(Rk)λ|q(Ri+1)q(Ri)|λk=i+1K1|q(Rk+1)q(Rk)|μmax{di(Ri)CiBi,0}μk=i+1Kmax{dk(Rk)CkBk,0}=q(Ri)λ|q(Ri+1)q(Ri)|μmax{di(Ri)CiBi,0}+QoEi+1K

Although this problem can be solved as a integer programming, it can be also solved directly using dynamic programming. Further, the quality of the bitrate is not explicitly write out in the paper, which is understandable because the user experience varies. However, to write the code, I simply take log for q(Rk)

Performance

Because this algorithm has the benefit over simply buffer-based approach or simply rate-based approach, in the performance part, we test the average bitrate, buffer time, and switch stability between MPC and buffer-based (BB) algorithm. Apparently, when the trace is ALT, the MPC is better than BB.

image-20231102222805052image-20231102222805052

2-rebuffer2-switch

As for the rebuffer time, because the most of the time, MPC will offer a better bitrate, which means it will take more time to download the video. As for the HD and PQ trace, the rebuffering time is pretty the same. Because the MPC has one target to make the quality of video stable, from the switch times graph, we can see the MPC has less switch times than the BB algorithm

How to Run

There are a batch of simulation files list in the run_simulation.sh waiting for you to run. Only uncomment one line to test one case, don't test all! This is because the simulation need to communicate with the BBComm.py or mpComm.py

Then first run the scripts/run_BB.sh or scripts/run_MPC.sh in one terminal, and run the scripts/run_simulation.sh in another terminal. You can also run the code without bash. But I recommend you do that because it can show you the detail performance in the log.txt.

2-run

Reference