Everything you need to know about video encoding
Mar 06,2024 Haiwei
Everything you need to know about video encoding
Video encoding is a process for making video files smaller using compression. The majority of video encoding services today are used for video consumption via the web.
What’s the difference between encoding and transcoding?
You may see the term “transcoding” used interchangeably with “encoding.” Transcoding is the process of decoding (decompressing) from one codec then encoding (compressing) it into another. Encoding on its own really only happens when the video is first captured, from light into something digital. Otherwise, you're usually transcoding from one format to another. So even though most people call it just encoding, they’re referring to the latter part of transcoding.
Why encode a video?
We mentioned a few use cases above but mainly, encoding makes viewing video over the internet possible. Uncompressed video files are so large that they could never fit on a DVD, Blu Ray disk, or be streamed over your home internet connection. For example, uncompressed video can have a data rate between 3,000 and 12,000 Mbps. For comparison, the average home internet connection in the USA is only 18Mbps, yet, because of encoding, you can still stream a great looking HD movie over that connection.
However, it's a little more complicated than simply encoding one input file and one output file. To deliver a great user experience across a variety of internet connections, you actually need to encode the input file to many different output files at different resolutions and compression rates. This approach is referred to as encoding for adaptive bitrate, or ABR.
Deliver the best video performance given a variety of variables.
Reach the largest audience & devices possible.
How does video encoding work?
Encoding works similarly to a zip file. It uses math to find patterns within the video and replaces all the repetitive pieces with references which reduces the size of the file.There’s one big difference to note between compression with a zip file and encoding. A zip file will bring the complete file back 100% after you’ve uncompressed it (aka lossless compression). When we encode a video, however, we want to squeeze as much visual data as possible into fewer bits, so the compression algorithm actually throws away details it doesn’t think is necessary, resulting in some data loss (aka lossy compression). The challenge is knowing what data can be thrown out while maintaining an excellent video experience.
How long does video encoding take?
For a vast majority of use cases, encoding is the most time consuming part of processing video. How long it takes depends on a lot variables but, generally, a short video could take a few seconds while a long video with a large file size using an advanced codec could take days.
No matter how fast stand-alone video encoding API services claim to be, they all require you to encode the entire video first before you can publish it. So there will always be some waiting period before you can make it available to your viewers. But there are innovations happening in this space which are essentially eliminating the wait time.