api.video
SearchCtrl K

Features

Developers

api.video encoding times: 2H 2021 edition

September 29, 2021 - Doug Sillars

A year ago, we looked at how fast videos are encoded at api.video. Over the past year, we've made huge upgrades to how we store and deliver video, as well as completely revamped our encoding infrastructure.

In this post, we'll look at how quickly you can expect your video to be ready today, and we'll do some comparisons to our encoding speed 12 months ago.

TL;dr Our encoding pipeline is a LOT faster. The median video encoding time is 20-40% faster over last year. We see even more impressive results at the 95th percentile where we are 48-63% faster year over year. This means faster access to the videos uploaded for all of our customers and their users.

Encoding process

When your video is uploaded to api.video, we take the video and create several different versions of the video HLS adaptive bitrate streams and a mp4 version of the video.

The streams will have several different sizes: 240p, 360p, 480p, 720p, 1080p and 2160p. We'll create versions up to the size of the video uploaded but no larger (so a 720p uploaded video will not have a 1080p or 2160p video).

The mp4 will be the size of the uploaded video (unless the video is 4K, where a 1080p mp4 version will be created.)

Based on data from June - September, we can count each encoded HLS version and determine the size of the original video:

  • 80% of videos uploaded are 720p or better, and 50% of all videos are either 1080p or 4K.

Encoding time

As each version of the video is encoded, we measure the amount of time it took.

There are two features that determine the encoding time - the size (dimensions) and duration of the video.

video dimensions

A 240p video has 102,240 pixels in each frame (426x240). A 1080p video has 2,073,600 pixels in each frame (1920x1080). With fewer pixels, the 240p video will generally encode faster than a 1080p video of the same duration.

video duration

A video that is 1 minute long and encoded at 24 frames per second will have 1,440 frames to be encoded. A 5 minute long video will have 7,200 frames, and will take longer to encode.

To try to make sense of this, we'll break down the video encoding times by the video's size, and create buckets of lengths, so that when we compare video encoding times, we are looking at videos of similar duration.

Percentiles

Percentiles allow us to rank our data into even segments that add up to 100 - making comparison across different collections of data easier. The median value is the 50th percentile, or the value that falls exactly in the middle of the data set. In our charts, we'll show 25%, 50%, 75% (quartile data) for the encoding times. We also will show the 90 and 95th percentiles, as these can give you an idea of the longer times a video might take to encode.

Short video encoding (under 5 minutes)

Let's take a look at short videos - those that are under 5 minutes long. we can calculate the tie it will take for each version to be created:

encoding times for videos 0-5 minutes

The black line shows the 50th percentile - or when 50% of videos will have been encoded. 50% of videos will have a 240p version of the video ready in 7.8 seconds, a 720p version in 15.3 seconds, and a 4K in 35s.

95% of videos under 5 minutes will have the 720p video in 85s or less. Larger sized videos take longer, and the 95th percentile for the 4K videos is 384s.

You can compare these numbers to the data from 2020, and they are very similar - within a few seconds of the data from a year ago. We have a few tricks up our sleeve to make the next data set faster for these shorter videos.

Longer video encoding

In order to compare against the data from a year ago, let's look at the encode times for videos 45-75 minutes long. Note that the 2020 data omits the 4K data, as there were not enough 4k files at this duration to make a good analysis. Here is the data at the 50th percentile:

50th percentile encode data
50th percentile table

The encoding for the median video is 21-38% faster, depending on the size of the video. A really nice improvement!

When reporting performance of our service, we want to monitor the 95th percentile - because we want EVERY video encoding to be fast. In the chart below, we can see that difference between 2020 and 2021 is even larger at the 95% percentile than it is at the 50th:

95th percentile encoding data 2020-2021

2020 encoding data 45-75 minutes long

95th percentile data YoY

At the 95th percentile, we see that all versions are ~50%-60% faster! Longer videos that are uploaded to api.video are ready for playback significantly faster than a year ago. The changes to our encoding system is making a big difference in making videos available faster!

Time as a continuum

We see that video encoding is faster, and we've looked at two data points - short and longer videos. What can we learn about video encoding times over different periods of time?

Let's look at the 720p data. 720p is often a 'good enough' quality for playback - it may not be as good as 1080p or 4K, but you can start the playback, and most users will be satisfied with the video (and the 1080p and 4K videos will be ready right afterwards, if available).

720p encode times for different duration videos

720p encoding time at 50th and 95th percentiles for various durations

This graph gives a good idea on how long you might have to wait after uploading a video before the 720p VOD file will be ready (assuming you know the duration). For a very quick estimate - if you take the duration of your video in seconds, and divide by 2, over 95% of videos will be encoded by that time.

Why wait?

api.video's encoding is continuing to improve, and we expect to see more jumps in encoding time in the near future. Over the last year, we have improved the "waiting game" by introducing webhooks which will push to your server when each version of your video is encoded.

Conclusion

Over the last year, we have made significant jumps in our encoding times - meaning that the videos your customers upload to api.video are ready for streaming playback faster than ever before. We're not resting idly with this improvement - we expect our infrastructure and encoding pipelines to have further improvements as we continue to improve our service in the coming months!

If you haven't seen our lightning fast encoding yet, what are you waiting for - try it yourself by signing up today!

Doug Sillars

Head of Developer Relations

Connect your users with videos

Create a free account today