How video hosting works: explaining how content is segmented and encrypted

People are watching more and more videos: worldwide, the average daily video consumption is already 84 minutes, and

in 2020, more than 3 billion internet users watched streaming or downloaded video at least once a month.

How did the video come about?

We absorb what we see better than what we read orheard. An important event in the development of visual communications was the appearance of photography in the 1920s. As you know, further events developed more rapidly: in 1895, the Lumiere brothers introduced the world to the cinematograph - a device for recording and playing silent films. It didn’t take long for sound films to appear, as early as 1927 the first successful sound film, The Jazz Singer, was presented, although sound recording technology in films appeared as early as 1919.

The next stage in the development of the video format wasthe advent of television, when video migrated from cinemas to the daily broadcast format directly into apartments. In fact, television appeared in the late 30s of the 20th century, but gained real popularity in the 50s. Around the same time, picture tubes, a type of cathode ray tube used in television broadcasting, became relevant. They owe their creation to the Russian engineer Vladimir Zvorykin, who emigrated to the USA at the beginning of the 20th century. 

With the development of television broadcasting, televisioncontent became more and more complex, expensive, labor-intensive and "not free" - all programs were clearly regulated and depended on TV ratings. The Internet has completely changed the world of video. In 1993, the band Severe Tire Damage held the first live online concert. This made an impression on the whole world: a year later there was even a separate program in which the presenters tried to comprehend the concept of the World Wide Web. The launch of ActiveMovie in 1995 allowed users to stream video content, and the Napster P2P file-sharing network launched in 1999 made it easy to share video and music. The boom in video popularity was ahead, although users were already actively sharing viral videos - through message boards or email chains.

April 23, 2005 on the then unknownYouTube video hosting has a video with the unpretentious name Me at the Zoo ("I'm at the zoo"). YouTube has allowed a huge number of users to start sharing personal videos, often with meaningless content and without professional training. Free access and lack of rules have brought hosting wildly popular, which continues to this day.

Thanks to a shift in consumption paradigmvideo content and the development of the Internet itself (the emergence of new protocols, the abandonment of outdated technologies), users were able to show video in high resolution.  The ability to record high-quality video on a phone was also a breakthrough. The technological breakthrough led to the emergence of streaming and increased the level of popularity of the already recognizable YouTube platform, as well as the emergence of alternative video hosting sites.

Online video has become part of everyday life:online meetings at work in Zoom or Teams with the camera turned on, time management education courses, video ads for a new burger joint or gym in the neighborhood – these are all new video formats.

What are the video types?

Now the video has ceased to be exclusively entertaining. There are a large number of criteria for its classification, consider the main ones.

First of all, video can be the main activity or application.

Secondly, the operating models of video servicesdiffer in target audiences: C2C, B2C, B2B and even B2D - Business to Developers - services that make it easier for developers to complete tasks in the field of online video. 

Since the video generates income for its creatorsworldwide, it is divided by type of monetization as follows: free, shareware, paid (transactional) or subscription model, monetization by advertising model, mixed. 

Obviously, the video is divided by varietycontent: entertainment (ivi, Hulu, Netflix), UGC content in social networks (YouTube and RuTube), as well as video for business - this type involves the use of a system of tools to build products from the other two categories.

How does a modern online video service work?

An online video service is not just a player, but a software and hardware platform with a complex architecture. In a simplified version, it looks like this:

Loading → Processing → Storage → Delivery and Playback

Loading— a set of protocols and tools forsupport for downloading or streaming on the device, including capturing video from the device camera and screen capture. We used to call screen sharing what we used to call screen capture. The methods for delivering media content to the service are varied: these include incoming streams from surveillance cameras and incoming streams during broadcasts. In this case, the signal can come from different sources, for example, from a satellite or as a DVB signal.

Video preparationconsists of two stages - conversion(transcoding) and media segmentation. When transcoding, the format is adapted to the player so that the viewer can choose the viewing quality - 240, 1080 or 4K. When working with transcoding content into different qualities, modern video cards, processors with support for video graphics processing and modern codecs are used; this requires a deep understanding of content types and optimizations, which are only possible with a large sample. At the end of the process, a set of qualities (mezzanine files) are obtained from the source file, which are optimized in size and other parameters. 

media segmentation— cutting the video into small pieces of approximately1 to 10 seconds (for example, Apple recommends a duration of 6 seconds for modern formats), which are transmitted to the player by streaming using various protocols. The two most famous are HLS from Apple and MPEG DASH, which is actively used by Google, including for YouTube. Next, the player puts the video together like a puzzle, and if the network is working well, we don’t see these “seams.”

The player can play in the browser or inapplication a video file, simply by receiving a link to it, but modern services most often play a kind of playlist of small pieces of video. This playlist is calledmanifesto. The use of the manifest is necessary in order toreduce latency and eliminate buffering (video loading), as well as provide the ability to switch audio tracks and other functionality in real time.

If the manifest contains all the usualviewing quality for the player, this provides on-the-fly quality switching based on network conditions. Viewers most often do not think about it, but very often the picture at the beginning of video playback is far from ideal, but after 1-2 seconds we get the desired quality. This is due to the fact that the quick start video player gets the worst quality, because it is the lightest. Then, if a stable Internet connection is found, the player starts downloading larger and better quality segments.

Another need for a modern video service is protecting premium content from unauthorized access, for example, when the browser and player exchange data. For this purpose it is usedencryption.

Playeris also an important component of the video service,a modular product that should work on all screens. Accordingly, on mobile devices the player is written in the language in which the application is written for better performance. The player is now not just some piece of code, but a separate large software product, which includes developed libraries for mobile environments, many modules to support different streaming protocols, encryption, analytics, support for playlists, and so on. The player has its own API for developers and requires regular cross-platform testing. Modern companies that pay attention to the quality of video services even have a special stand equipped with 15-20 different physical devices - mobile phones, tablets of different versions, generations and vendors, as well as a virtual stand. With the release of each new version of the player, it is tested for compatibility.

The video service also includesstoragedownloaded content and quality formatsviewing. Storage must be fault-tolerant, so several copies of the video are made and, most often, very large file storage, several tens of petabytes, distributed among different data centers is used. We, for example, store more than 5 PB of data in this type of storage.

There are two more important components in the structure of a video service: CDN and analytics.CDN— a network of distributed servers for delivering video content along the path closest to the user. Bandwidth is very important here, because video content is very heavy.

There is also a separate blockanalysts: consumption analytics (how and when viewers watch the video) and quality of service analytics that evaluate buffering events and download speed, help improve the service, and so on.

This is the general architecture of a modern video service.In reality, it is much more complex, as it involves interaction between all these elements through protocols, fault tolerance testing, scaling and maintenance, API support, monitoring, regular testing, and so on. 

Difficulties in developing a video service

We spent a lot of time studying andsystem configuration testing. We started with one architecture, but then, when we reached certain volumes, we realized that the architecture needed to be completely redone. This is the main challenge of working with video streaming - at the initial stage everything can be easy and hassle-free, but after a while it turns out that there are serious difficulties in managing a large number of objects. Working with video is an unconditional highload. In cataloging, in delivery, in transcoding - everywhere there are pitfalls that you encounter only against the background of real loads. The whole process of refactoring the Kinescope platform took a very long time: two years for refactoring the software part and five years for the hardware part.

As a result, we have changed the approach to processingcontent: if five years ago we used only CPU encoding, now 90% of the process falls on graphics accelerators, which have greatly progressed in recent years. By the way, a very big evolution in video services occurred due to the development of hardware: network cards, availability of disk space.

At Kinescope, we have been preparing the foundation for quite some time.for their platform, because they were independently involved in infrastructure, developing their own network, and building service solutions. If we had used some cloud provider that provides rental computing power, like Yandex Cloud or AWS, then we would have started faster. However, businesses must understand that this means losing the control and speed that helps them compete in today's marketplace. All businesses are now trying to cut costs, and even relatively small expenses on video place a heavy burden on the budget of any, even large company. 

What's next for video services?

Important drivers for the development of video services now are:

  • Content on social networks.UGC video content has become inextricably linked with social networks - Instagram, Facebook, Snapchat and others. (*Meta, including its Facebook and Instagram products, has been designated an extremist organization in Russia.)
  • educational content.The first TED Talks appeared in 2006, and since then they have gained immense popularity - the speeches of the speakers have gained more than a billion views, and this is only a small part of the educational market.
  • Entertaining content. Market giants - Netflix, Hulu, ivi - provide comfortable access to more series or movies.
  • Streaming. Now live broadcasts generate an increasing share of traffic, and the opportunities to conduct them in an unprofessional manner accelerate growth.

In the near future, video will continue to be associated with the mobile format of content consumption in 4/5G networks, while by 2023 70% of the world's population will have access to mobile communications.

New interactivetools, and not just for the entertainment industry. The video format is increasingly being used for business purposes, so in parallel with the development of video, methods of online sales in streams, creating commercial stories and videos for the tape are also developing. Back in 2018, Hubspot wrote that 54% of consumers want to see more video content from a brand or company.

Video can tell a story in a way that text cannot. It will always be a bright fragment in the endless information flow: dynamic picture, sound and various effects. 

Read more:

An unknown species of winged insect "hidden" in amber for more than 35 million years

Gas leak from Nord Stream was shown from space

See how Jupiter and the Moon approached in the night sky