📜 ⬆️ ⬇️

Cloud video processing in CDN

image Hello, Habralyudi!

We have already told several times on Habré about the services of content delivery networks, or CDN (Content Delivery Network), for example, here . Let me remind you that CDNs are needed for geographically distributed online broadcasts of Internet video, streaming videos and distributing static content via HTTP. But today I want to talk not about the main, but about additional services of the CDN networks, many of which are related to video processing in the cloud. Such services include mounting video in the cloud, transcoding for adaptive broadcasting, cutting screenshots from video streams, etc.


')
So, let's begin. First of all, I want to talk about the adaptive video broadcasting service. Suppose you show the video on your site in good quality, but you receive complaints that many users have video buffered because there is not enough bandwidth to download it. You decide to reduce the video bitrate - there are fewer complaints from users, but now you don’t like the quality of the video on your site, and you worry that your advertisers will stop advertising with you. You decide to show the video in several bitrates at once - but you are not at all sure that all site visitors understand what bitrate is and why it should be changed.

So, adaptive broadcasting allows you to automatically reduce the bitrate and, accordingly, the quality of Internet video to those users who sit on bad Internet channels and, conversely, improve the quality to those users who use good channels. And this happens without the participation of the user himself: the Flash player (or iOS player) itself calculates in which bitrate it will optimally show the video to this user, so that he does not have video buffering, but at the same time it is given in the best possible quality. Switching between bitrates can occur continuously with both lowering and increasing bitrate if the available bandwidth increases or decreases.

In principle, adaptive broadcasting supports the standard for Flash protocol RTMP. But in our experience, to consistently show video in Flash, you need to use the Adobe HTTP Dynamic Streaming (HDS) protocol. This protocol is supported in the OSMF (Open Source Media Framework) specification, on the basis of which many modern Flash players are built. There are no problems with apple devices - the HTTP Live Streaming (HLS) protocol works quite well.

An interesting addition to the adaptive video broadcasting service is video recoding service on the fly . In general, before publishing the videos that you want to broadcast in adaptive mode to the site, you must first encode them in several bitrates. But when using the service of adaptive broadcasting, you can not do this - it will be enough to download one copy of the video in good quality, and the videos will be encoded into different bitrates as they receive requests from users. Thus, it is possible to reduce to a minimum the time for displaying video on the site, so it is not necessary to spend time on its transcoding. If we talk about our CDN network - we have implemented it so far only for the option of video distribution via HDS, now we are working on HLS support. I, frankly, have not met with other CDN implementations of this service.

Another interesting service is cutting screenshots from streams . Suppose your site is streaming video in real time. How to link to this video? It is most logical to do this, showing one of the last frames of this video, so that the user will understand what they are going to show him. So, this very last frame can be requested from the CDN using a simple API request (if, of course, the CDN you use supports this functionality).

Well, now actually about cloud video processing . The easiest thing to do with video in the cloud is to mount it. For this, the actual video is not necessarily something to do - just play it is not entirely, but only some of its parts. To tell which parts of the video to play, some CDNs (at least ours) have a corresponding API. For example, in this API, you can ask a CDN to play a video from the 5th to the 70th second, then from the 100th to the 106th, etc. Again, as in the case of transcoding on the fly, this service significantly reduces the time it takes to display a video on the site. For example, a correspondent may upload a video from the scene to the cloud, and the editor can mount it and upload it directly to the news site (instead of downloading the video, editing it on your computer and uploading it back to the server).

I told far not about the full range of CDN services. In CDN, CDNs also have “virtual TV channels” (creating streaming video from video clips), text overlaying on video, and recording TV channels on the air, and landing TV channels from a satellite for broadcasting via CDN, and switching the video stream to a previously recorded backup video - just can not list. By the way, if you have any wishes for new services - share them, we will be grateful for the ideas and will be happy to implement them (competing with competitors who also read this article for sure - by the way, hello :))

Source: https://habr.com/ru/post/146670/


All Articles