Video is everywhere. With the availability of high speed cellular networks and powerful phones, people are consuming video at an incredible pace, and all indications point to it continuing to grow. In North America, 50.1% of all video views are on mobile, and the percentage is even higher in Europe and Asia.
But how does video streaming work? In this post, we’ll walk through a high-level discussion of how of how most video is streamed today, and I envision a series of posts where we delve into greater detail on the nuances of video streaming.
What is streaming?
Most of the content consumed on browsers or apps are downloaded over the internet from a server. For the majority of file types (html, images, fonts, scripts, etc.), the entire file is downloaded before it can be consumed on the device.* These files are generally pretty small, so the wait time for file download and display on the screen is generally low.
Video files are much larger (in bytes) than images or text files. An hour-long video could easily be 700MB – 1GB. As anyone who has downloaded a large file knows, a 1 GB file download can take a long time. Understandably, this is not a great option for quickly watching and consuming video content, and this is where streaming comes in to save the day.
Streaming “chops up” the big movie into smaller segments that can be played one after another. Imagine a 1 hour movie, chopped into smaller videos that can be played sequentially:
When we chop a 1 hour long, 700 MB video into 10-second-long segments, we’ll have 360 files to download, each at about 2 MB each. We number each segment because it is important to play the video back in the order it was recorded in. Different streaming protocols will use different segment sizes, but segment lengths of 10s, 8s, and 2s are very common. If you are streaming a live video, you will send the video out with a delay of at least the segment size (assuming no processing time), because you have to record the length of 1 segment before sending it our over the internet.
Streaming in Action
Let’s assume we are streaming a video on demand (a movie or tv show). The server will have all of the segments ready to stream (let’s say they are 10s long), and we will establish a connection to a player (in the browser or app) to play the files. Now, we just send the movie segments over the network:
When segment 1 is playing, we have less than 10 seconds to get segment 2 delivered to the device. If segment 1 finishes playing before segment 2 arrives, we will enter a stall situation. The player is ready to play video, but there is no video available to play.
During a stall, the customer gets a spinner, or a message that says something like “buffering…” That’s bad. Stalls break the continuity of the video experience, and lead to customer abandonment. So, we need to make sure that there is enough video to playback on the device. This is where video buffers come into play. If we establish a buffer on the phone to hold “ready to play” segments, we can hopefully avoid running out of video on the device:
Here we have 2 segments (or 20s) of video stored in the buffer as segment 4 is being delivered. As the buffer gains more segments, the probability of a stall is reduced. There is a balancing act to filling the buffer. If the video is abandoned during playback, all of the video in the buffer is wasted, so careful buffer management is important.
Examining Streaming With Video Optimizer
In this series of blog posts, we will walk through how video streaming works, but also look at ways to analyze videos to better understand them. When you collect a network packet trace with Video Optimizer, it will detect the video packets and perform an analysis of your video streams (some is automated, and some requires user interaction).
For example, in this screenshot below, Video Optimizer is providing data on the data throughput and packet transfer (first 3 rows), the amount of video in the buffer (in seconds and MB), and also displays the first frame of each segment as it is downloaded.
We can identify a stall situation when either the pink or blue line touches the bottom of the row – implying 0 seconds or MB in the buffer.
The detail on each segment can be further distilled on the video tab, where details about the timing, bitrate and length of each segment is displayed:
We’ve described (at a high level) how video streaming works. By breaking video into small segments, the video can be consumed while the video is still being downloaded. In subsequent posts, we’ll discuss streaming video more deeply and use Video Optimizer to help you improve your streaming service with varying bitrates and other parameters.
*Yes, I know about progressive images. I’m keeping this high level, remember?