## 2 Literature Review  
Multimedia is considered one of the major application areas for 5G and B5G services [14]. As an example, video streaming and video-on-demand applications are considered as one of the pillars for smart city services [15]. To this aim, some papers developedspecific solutions for including videos in different smart city applications. As an example, in [16], the authors proposed a smart city framework for video surveillance, where multiple cameras disseminated within a city are exploited. This proposed framework, named UTOPIA, allows to perform a video analysis exploiting MapReduce. The authors propose to use the developed solution for video surveillance applications. The idea of using videos for implementing an intelligent transportation system is instead proposed in [17]. The authors propose to use road-side cameras jointly with road traffic monitoring servers. The visual IoT idea is instead introduced in [18]. Trying to merge multimedia content and IoT, the authors envisaged modelling the cameras as sensors for implementing smart city services. The authors first performed an analysis of the requirements of the proposed visual IoT approach, and then an architecture enabling the visual IoT concept to operate was introduced. Additionally, in [19], smart surveillance applications based on IoT sensors are considered. In this context, a heterogeneous network scenario is considered to implement a multi-purpose real-time video surveillance application to be applied to both smart cities and border control. The proposed solution considers three main aspects, which are the QoS requirements of the real-time video application, the cost-benefit of the spectrum allocation and the time constraints involved in vertical handover operations. On the other side, MEC solutions in 5G scenarios have been considered in several papers also enabling multimedia services [20]. As an example, in [21], the authors explored the possibility of using an edge computing facility for content distribution in a smart city environment. Through the MEC, the system is capable of offering data storage and processing capabilities closer to data sources and data consumers. The authors explored how MEC can be used when user mobility and resource allocation should be managed. The possibility of using DASH in the cloud architecture has been examined in [22]. The authors proposed to use three different cloud computing companies operating in nine different data centres for streaming a video. The conclusion was that deploying DASH in the cloud is useful and that the performance of DASH is enhanced when using the cloud; this is even more true when the data centre is near the users. Another paper investigated the use of the cloud for the transcoding function [23]. The paper proposed a scheduling algorithm that optimizes the video transcoding time (VTT), i.e., the time needed to transcode the video, which in turn influences the video transcoding mode (VTM), i.e., the process that overlooks the transcoding requests. It is demonstrated that the algorithm allows a faster transcoding process, better management of tasks and a continuous stream. The authors in [24] propose a partial transcoding method for content management where each content is encoded into different bitrates and split into segments. They aimed at minimizing the cost, which includes storage and computing costs. In [25], the analytic hierarchy process (AHP) method was proposed. In this paper, a multi-tier fog architecture iwas used and several metrics such as bandwidth, latency and financial costs are taken into consideration. Based on all the collected data and the AHP output, the most suitable fog nodes are used for the stream. This has shown to be an advantage from the QoE side as well on the delay side since it is reduced remarkably. Additionally, it is shown that the bandwidth is increased and the cost is minimized. A similar paper has looked into optimizing the number of fog nodes needed to reduce the delay [26]. This paper uses the distance between the fog nodes and the gateways.