# Machine Learning Technique Predicting Video Streaming Views to Reduce Cost
of Cloud Services

Mahmoud Darwich
Department of Mathematics and Computer Science
University of Mount Union, Alliance, Ohio 44601
<EMAIL_ADDRESS>Mahmoud Darwich  Department of Mathematics and
Computer Science
University of Mount Union
Alliance, Ohio 44601, USA
<EMAIL_ADDRESS>
###### Abstract

Video streams tremendously occupied the highest portion of the online traffic.
Multiple versions of a video are created to fit the user’s device
specifications. In cloud storage, Keeping all versions of frequently accessed
video streams in the repository for the long term imposes a significant cost
paid by video streaming providers. Generally, the popularity of a video
changes each period time, which means the number of views received by a video
could be dropped, thus, the video must be deleted from the repository.
Therefore, in this paper, we develop a method that predicts the popularity of
each video stream in the repository in the next period. On the other hand, we
propose an algorithm that utilizes the predicted popularity of a video to
compute the storage cost, and then it decides whether the video will be kept
or deleted from the cloud repository. The experiment results show a cost
reduction of the cloud services by 15% compared to keeping all video streams.

###### Index Terms:

prediction, storage, popularity, video stream, machine learning, linear
regression

##  I Introduction

In the recent decade, the technology of filming any social events, places,
individuals, and objects is easily accessible by any holder of a smartphone or
other devices films. Moreover, the extensive spread out of social media
platforms increases the number of video streams over the internet
significantly. Additionally, every device plays the version of a video stream
that fits its characteristics, Therefore, a lot of versions of the same video
stream are made ready to be displayed on all different types of devices. Thus,
this increases the video streams incredibly across the internet platform.
Designing storage for all video streams becomes remarkably challenging.
Thankfully, the cloud was revealed as a technology to tackle the problem of
building physical database centers to fit all the huge data [1] [9].

Cloud was adopted strongly by tech companies to ease the operation of
processing and securing data. Therefore, cloud services are available for
small and enterprise businesses with affordable prices and high benefits.
Cloud offers virtual machines (VM) at different processors speed and
utilization in addition to the storage option, which is rated on an hourly and
monthly basis respectively [5].

Transcoding is an operation to convert a video stream into different versions.
However, transcoding is an extensive process that requires powerful virtual
machines. Accordingly, high costs are imposed by using VMs in the cloud.
Alternatively, storing servers are less expensive and used to store the pre-
made (i.e. pre-transcoded) versions of video streams e-transcoded video.
Generally, storing option in the cloud is applied for frequently accessed
video streams (FAVs).

Amazon Web Services (AWS) is one of the reputed cloud operators and we use
their standards to run the experiments. Our method could apply to any cloud
provider standards. AWS rates are displayed as follows:

  * •

S3 Standard: It is typical storage in the cloud for all contents.

  * •

Amazon Elastic Compute Cloud (Amazon EC2): presents the VMs that offer the
computational services and it comes under different types. .

We define the research problem in this paper to predict the views of the
currently stored video streams in the repository in the next period.
Estimating the views in the next time cycle could reduce the storage cost of
video streams in the cloud.

The rest of the paper is organized as follows: related works are presented in
section II. The proposed popularity prediction is discussed in Section III.
The experiments are implemented in section IV. Section V shows the results and
then section VI presents the conclusion.

##  II Related Work

Darwich et al.[8] developed approaches to reduce the cost of cloud services by
organizing the video streams in the repository. Particularly, they developed
an algorithm that computes the hotness of videos and they apply this criterion
to manage the videos. Their results show a reduction in cloud services costs.

On the other hand, Darwich et al.[3] presented a method that filters the
videos to be stored or deleted and then re-transcoded upon request. They
applied the cost ratio in their algorithm to decide on either storing or
transcoding. Their proposal shows a reduction in cloud costs.

Darwich et al.[4] designed a scheme that distributes the videos into different
types of cloud storage. Their design is based on video clustering. Their
experimental results show a reduction in cloud cost.

Jokhio et al.[6] presented an approach to reduce the cloud cost by measuring
the popularity of each video stream in the repository. they applied a weighted
graph to select either transcoding or storing.

Gao et al.[10] proposed a method that split videos into segments and then
applies the view distribution to reduce the cost of cloud services.

Zhao et al.[7] proposed a scheme to build a relationship between the video
version and its views. They developed a strategy to form a relationship
between video versions. their results show a reduction in the cost of cloud
services.

##  III Proposed Popularity Prediction

###  III-A Popularity

The popularity $\rho_{i}$ of a video stream $i$ is measured as the number of
views received by the video in a period. In this research, We consider
counting the views of each video in the repository on an hourly basis for 30
days. The popularity plays a key role in the cost of cloud services for video
streams in the repository.

###  III-B Storage Cost

The Storage cost of a video stream $i$ in the cloud is dependent on the video
size and the storage price rated in $ gigabytes per hour. The storage cost is
calculated as shown in Equation 1

$C_{si}=\dfrac{P_{s}*\sigma_{i}}{2^{10}}$ (1)

Where $P_{s}$ is the cloud storage cost and $\sigma_{i}$ is the size of video
$i$ in megabytes

###  III-C Transcoding Cost

The transcoding cost of a video stream $i$ in the cloud is dependent on the
number of views received by the video and the price of a virtual machine in
the cloud, which is rated in $ per hour. Assuming video $i$ in the cloud
repository, every time the video is viewed, the video is transcoded to a
version to fit the viewer’s device specifications. the transcoding cost of the
video received views $\nu$ is computed as illustrated in the Equation 2

$C_{ti}=\dfrac{P_{t}*\nu_{i}}{3600}$ (2)

where $P_{t}$ is the price of VM rated on an hourly basis.

###  III-D Cost Ratio

The cost ratio $\psi_{i}$ of a video stream $i$ is computed as the storage
cost of the video stream in the repository divided by its transcoding cost
using the Equation 1 and 2.

$\psi_{i}=\dfrac{C_{si}}{C_{ti}}$ (3)

When the cost ratio is greater than or equal to 1, that means it is worth
storing the video version. When the cost ratio is less than 1, the video
version must be deleted and transcoded upon request. The following conditions
of $\psi_{i}$ are detailed as follows:

$\psi_{i}\colon\begin{cases}\text{if}\,\psi_{i}>1\rightarrow\text{transcode
video}\\\ \text{if}\,\psi_{i}<=1\rightarrow\text{store video}\end{cases}$ (4)

###  III-E Proposed Prediction Method

In section III-D, we calculated the cost ratio, if it is greater or equal to
1, the video version should be stored for a period of time. Since the fees of
cloud storage are charged monthly. Thus, we assume the period time of storing
any video version is one month only. Therefore, it is essential to figure out
if the stored video in the current month will be kept in the storage for the
next month. The clue, which determines whether the stored will be kept in the
repository or not during the next period of time, is the popularity (i.e.
number of views) of the video. Predicting the number of views of each stored
video in the next period cycle is the key to deciding if it will be kept or
not. In this paper, we apply a machine learning technique to predict the
popularity of each stored video in the repository. Particularly, we implement
the method of linear regression on the views of the current video streams in
the repository.

###  III-F Proposed algorithm

1

2

Input : Frequently accessed video $i$

Size of each frequently accessed video$\sigma_{i}$

Cloud Storages price: $P_{s}$

Transcoding price: $P_{t}$

Number of views of each : $\nu_{i}$

Output : Cost of streaming videos in cloud

3

4Apply Linear Regression on the views of the videos and predict the views:
$\nu_{i-predict}$

5 for  _each video $i$_ do

6 Storage Cost:$C_{si}\leftarrow\dfrac{P_{s}*\sigma_{i}}{2^{10}}$

7 Estimated Transcoding Cost: $C_{ti-
estimated}\leftarrow\dfrac{P_{t}*\nu_{i-predict}}{3600}$

8 Estimaed Cost Ratio: $\psi_{i-estimated}\leftarrow\dfrac{C_{si}}{C_{ti-
estimated}}$

9 if  _ $\psi_{i-estimated}>=1$ _ then

10 keep the video

11 else

12 delete video

13 end if

14

15 end for

16

17 Totat Cost:$\leftarrow\dfrac{\sum P_{s}*\sigma_{i}}{2^{10}}+\dfrac{\sum
C_{si}}{C_{ti-estimated}}$

18

Algorithm 1 GOPs storing cost

The algorithm’s goal is to predict the views of each video in the next period
and recalculates the transcoding cost and ratio cost. if the ratio comes to
less than 1, that means the cost of storing is less than the cost of
transcoding and vice versa. The inputs to the algorithm are, video size and
its views, storage and transcoding cost. The algorithm output is to predict
the views for each video and recalculates the cost of cloud services. In step
1, we apply the machine learning technique by implementing the linear
regression method on the video stream views during the current period which we
consider as 30 days. The views for each video are predicted for the next
period of time. In step 2, we compute the storage cost for each video. In step
3, we recalculate the transcoding cost for each video using the predicted
views. In step 4, we measure the cost ratio, if it is less or equal to one,
then we keep the video. If the cost ratio is greater than one we delete the
video and re-transcode upon request as shown in steps 5 and 6 respectively. In
the last step, the algorithm recalculates the total cost of cloud services.

##  IV Experiment Setup

###  IV-A Videos Synthesis

As it is difficult to gain an access to video stream repositories of the
providers. Therefore, we came up with a way to synthesize the video streams by
implementing the techniques in [3]. Particularly, we synthesized the useful
information of videos like the video size and its transcoding time which are
used in the experiments.

###  IV-B Amazon Storage Rates

Table I displays the AWS rates in US dollars

TABLE I: AWS S3 Standard storage and EC2 rates in USD  S3 Standard Storage | EC2
---|---
$0.05 GB/hour | $0.023 GB/month

###  IV-C Approaches for Comparison

We evaluate our proposed method by implementing related methods and comparing
them.

  * •

_Partial storing_ method in [3] , it stores a part of video stream which
receives frequent accesses in the cloud standard storage S3 Standard.

  * •

_Clustering video streams_ method in [4]. It clusters the frequently accessed
video stream and stores them in different storages in the cloud

  * •

_Clustering GOPs Clustering_ method in [4]. It clusters the frequently
accessed GOPs from different videos and stores them in different storages in
the cloud

##  V  Simulation Results

$5\%$$10\%$$15\%$$20\%$$25\%$$30\%$$400$$500$$600$$700$Percentage of
frequently accessed videos in the repositoryTotal cost ($)Partially storing
approach [3]Video Clustering approach [4]GOPs Clustering approach [12]Proposed
Popularity Prediction

Figure 1: Cost comparison of the four approaches Partially storing approach
[3], Video Clustering approach [4], GOPs Clustering approach[12], Proposed
Popularity Prediction when the number of frequently accessed videos varies

$0$$100$$200$$300$$400$$500$$600$$700$$0$$200$$400$$600$$800$$1{,}000$Hour
($h$)Number of Views ($v$)DataLinear regression: $v=-1.12\cdot 10^{-2}\cdot
h+508.9$

Figure 2:  Linear Regression technique on the hourly views of video streams. the horizontal x axis represents the hours of one month (24*30)=720. The vertical y-axis represents the number of views in each hour during the 30 days  TABLE II:  Cost comparison in USD when the percentage of frequently accessed video changes  FAVs % | Fully Transconding | Full Storing | Partial Storing [3] | Videos Clustering [4] | GOPs Clustering [12] | Proposed Popularity Prediction
---|---|---|---|---|---|---
5% | 1598 | 839 | 694 | 650 | 600 | 590
10 % | 1598 | 842 | 662 | 620 | 590 | 580
15 % | 1598 | 863 | 643 | 600 | 560 | 550
20 % | 1598 | 947 | 613 | 560 | 520 | 500
25 % | 1598 | 1424 | 566 | 530 | 470 | 440
30 % | 1598 | 3137 | 533 | 480 | 390 | 370

Figure 1 compares the four approaches. The horizontal x-axis represents
repositories of video streams with different percentages of frequently
accessed videos. The vertical y-axis represents the total cost of cloud
services including the sum of both transcoding and storing costs. As we notice
from the figure generally the cost of the four approaches is high. The reason
behind that is the repository contains a small percentage of frequently
accessed videos, which means more transcoding operations are implemented. Thus
the total cost comes high. As the number percentage of frequently accessed
videos increases, the cost of all approaches decreases because fewer
transcoding operations are executed. When 30% of the repository is for
frequently accessed videos, the proposed approach outperforms all other
approaches because there are videos that were considered highly accessed
during the current period. While in the next period, these videos are no
longer highly accessed and thus they are deleted from the repository.
Therefore, the total cost is decreased remarkably. The proposed approach
reduces the cost by %15 compared to the GOPs clustering approach.

Table II displays the cost numbers for two approaches( fully storing and fully
transcoding) which we didn’t include in Figure 1 and the four approaches. We
eliminated the first two approaches as they cost highly.

Figure 2 represents the implementation of the linear regression on vies of
video streams during a period to predict the views in the next period. The
data shows the views of each video on an hourly basis. That means in 30 days,
there are 720 hours. The horizontal x-axis represents the 720 hours and the
vertical y-axis represents the views of each video the linear equation is
displayed in the figure.

##  VI Conclusion

In this research, we proposed an approach to predict the number of views and
it recalculates the cost of cloud services for the next period. Our approach
shows an efficient way to reduce the cost by implementing machine learning on
the video stream views. Moreover, the proposed approach shows a significant
reduction when the repository contains a high percentage of frequently
accessed video streams.

## References

  * [1] Li, X., Darwich, M., Salehi, M. A., Bayoumi, M. (2021). A survey on cloud-based video streaming services. In Advances in Computers (Vol. 123, pp. 193-244). Elsevier.
  * [2] http://techblog.netflix.com/2012/12/videos-of-netflix-talks-at-aws-reinvent.html
  * [3] Darwich, M., Beyazit, E., Salehi, M. A., & Bayoumi, M. (2017, April). Cost efficient repository management for cloud-based on-demand video streaming. In 2017 5th IEEE International Conference on Mobile Cloud Computing, Services, and Engineering (MobileCloud) (pp. 39-44). IEEE.
  * [4] Darwich, M., Ismail, Y., Darwich, T., & Bayoumi, M. (2020, June). Cost-efficient storage for on-demand video streaming on cloud. In 2020 IEEE 6th World Forum on Internet of Things (WF-IoT) (pp. 1-4). IEEE.
  * [5] https://aws.amazon.com/s3/pricing/. Accessed December 2020.
  * [6] Jokhio, F., Ashraf, A., Lafond, S., & Lilius, J. (2013, September). A computation and storage trade-off strategy for cost-efficient video transcoding in the cloud. In 2013 39th Euromicro Conference on Software Engineering and Advanced Applications (pp. 365-372). IEEE.
  * [7] Zhao, H., Zheng, Q., Zhang, W., Du, B., & Chen, Y. (2015, July). A version-aware computation and storage trade-off strategy for multi-version VoD systems in the cloud. In 2015 IEEE symposium on computers and communication (ISCC) (pp. 943-948). IEEE.
  * [8] Darwich, M., Salehi, M. A., Beyazit, E., & Bayoumi, M. (2019). Cost-efficient cloud-based video streaming through measuring hotness. The Computer Journal, 62(5), 641-656.
  * [9] Darwich, M., Ismail, Y., Darwich, T., & Bayoumi, M. (2022). Cost Minimization of Cloud Services for On-Demand Video Streaming. SN Computer Science, 3(3), 1-11.
  * [10] Gao, G., Zhang, W., Wen, Y., Wang, Z., & Zhu, W. (2015). Towards cost-efficient video transcoding in media cloud: Insights learned from user viewing patterns. IEEE Transactions on Multimedia, 17(8), 1286-1296.
  * [11] Jokhio, F., Deneke, T., Lafond, S., & Lilius, J. (2011, December). Analysis of video segmentation for spatial resolution reduction video transcoding. In 2011 International Symposium on Intelligent Signal Processing and Communications Systems (ISPACS) (pp. 1-6). IEEE.
  * [12] Darwich, M., Ismail, Y., Darwich, T., & Bayoumi, M. (2021, June). Improving Hierarchy Storage for Video Streaming in Cloud. In 2021 IEEE 7th World Forum on Internet of Things (WF-IoT) (pp. 201-204). IEEE.