Product updates · 6 min read

Free video encoding: Let's talk numbers

Understand the how and what behind our recent pricing upgrade: free video encoding.

Jean-Baptiste  - Video LeadArushi - Content Manager

Jean-Baptiste,

Arushi Gupta

September 27, 2023

api.video recently announced that it now offers free encoding for all its users—a bold move perfectly aligned with our mission to democratize videos.

 

As a next step and to make things more transparent, we decided to take the help of some numbers and explain it to you.

 

The natural thought behind video encoding is that it is expensive. That is mainly because encoding workloads demand substantial CPU resources, and CPUs can be quite costly. Consequently, encoding has traditionally incurred high costs and the higher the video resolution, the greater the CPU requirements, directly impacting encoding expenses. It seems logical that pricing should correlate with these factors, which is what experts typically anticipate.

 

But that is not always the case. Read on to learn how we, at api.video, are making it possible to scrap video encoding costs for you all.

We build our own infrastructure

There are two common routes you can take for video encoding - Central Processing Units (CPUs) or Graphic Processing Units (GPUs). But let us accept that they are both not very affordable. Moreover, datacenter GPUs aren't primarily designed for video encoding but are rather now targeting AI tasks. And considering the popularity of AI, cloud providers are unlikely to reduce GPU prices because they can command higher rates from AI customers. That’s when a new alternative comes in: Application-Specific Integrated Circuits (ASICs). These are specialized chips (Video Processing Units) designed for specific workloads and have been recently in news due to Google developing its own VPU for YouTube called Argos.

 

At api.video, we build our own infrastructure that has the most advanced VPUs. With these VPUs, we are able to save power consumption costs since the power consumption cost of VPUs is one order of magnitude lower than CPUs and GPUs. It is also easily possible to pack a lot of them in a single server. This increases their density and therefore, reduces the number of servers.

 

In a nutshell, VPUs help you to encode videos at scale without costing you too much, and that is exactly why we at api.video, made the move to use VPUs for video encoding.

Understanding encoding costs on VPUs

api.video uses VPUs built by Netint Technologies. Let's understand the costs with a 1080p30 video. To simplify the case, I will assume the source video codec is h.264. The output videos after transcoding will be five h.264 renditions for ABR: 1080p30, 720p30, 480p30, 360p30, 240p30.

 

For a real time transcoding, let's try to sum up the number of MP/s (Megapixel per second) it represents. For the above output, it represents 62 MP/s + 28 MP/s + 12MP/s + 7MP/s + 3MP/s respectively for 1080p30, 720p30, 480p30, 360p30, 240p30 renditions. We need an encoding capacity of 112 MP/s for real time transcoding. Let us assume that the transcoding cost on VPUs is proportional to the number of pixel per frame (whatever the frame resolution) for the sake of simplicity and one VPU of Netint is able to encode 2000 MP/s in h.264. In reality it is a bit more complex but let’s take these as the numbers for a rough idea.

 

Now, as per the above assumptions, we can encode 2000/112 = 17 minutes of videos (all rendition included) per minute. Below is a table summarizing the minute cost for a server with 4 VPUs. The cost of the server is $10k and the amortization for such a server is 3 years. The electricity cost will be approx. $1000 per year (420w at $0.30 / kWh) at full consumption. Let us see what is the cost of 1 minute of a 1080p30 video transcoded to 5 renditions.

 

(The cost is split taking into consideration the average usage of the server per day)

 

Avg. usage of the server in percentageMinutes encoded over the amortization periodCost per minute transcoded (minutes / cost of server + electricity) in $
0,50%5361120,020
5%53611200,002
25%268056000,0004
50%536112000,0002
90%965001600,0001

 

If we use the server at only 0.5% per day (i.e ~7 min per day fully loaded) the cost per minute would be at $0,020.

 

If on an average, this server is loaded at 25% (6 hours a day) the cost per minute would be 1/150 of our previous price.

What about video quality?

Hardware encoded is always associated with quality losses in the head of many video engineers. But that was probably the case decades ago.

 

Not anymore.

 

Let’s see how VPUs compete with CPUs in terms of quality by taking a video under Creative Commons license: Caminandes 2.

 

We have uploaded its 1080p30 version via our API and will compare the quality output with a CPU encoded video with this option -b:v 4400k -preset medium These parameters generate a rather good quality.

 

ffmpeg -r 30 -y -i input.mp4 -c:v libx264 -force_key_frames 'expr:gte(t,n_forced*4)' -b:v 4400k -preset medium -c:a copy output.mp4

 

Here are the quality metrics (higher is better):

VMAF (avg)PSNR (avg)SSIM (avg)
api.video (VPUs)95.9248,070.9888
ffmpeg (CPUs)95.3348.690.990

The quality metrics are very closed and report a high score. The VMAF is slightly better through VPU encoding.

 

In conclusion, this pricing update reflects our commitment to enhance the video streaming experience for everyone - be it individuals or organizations looking to build their video solutions. We firmly believe that by making video streaming more accessible, we empower creators, businesses, and enthusiasts alike to embark on their video streaming journeys with ease.

 

To know any other details, talk to our team and we are here to help you out.

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.