AWS Media Blog

A Video Compression Primer

This article originally appeared in FEED Magazine, Issue 10.

What used to be a relatively simple proposition for broadcasters – delivering a single analogue or digital signal to one type of device – has become a highly complex series of technological tasks.

Broadcasters, pay TV operators and OTT services must deliver video to every type of device now, from big HD and 4K televisions to mobile phones and tablets. The caveat: audiences expect video to look just as good on the smallest device as it does on the largest one.

Today’s TV shows are shot at the same quality as feature films, quality that translates into a data rate that could be as high as 5TB an hour or more. Those files are far too large for even the fastest internet connection to deliver consistently, and most consumer devices aren’t designed to play back these video source formats.

So how do you stream premium content to viewers on smart TVs, mobile phones, or tablets – whether those devices are connected to Gigabit Ethernet, a cellular network, or any connection speed in between the two?

The answer: compressing video files into smaller sizes and formats. The dilemma: enabling high-quality playback of these files on every possible type of screen.

Codecs are the key to addressing size, format and playback requirements. A codec allows you to take video input and create a compressed digital bit stream (encode) that is then played back (decoded) on the destination device.

There are two types of codecs: lossless and lossy. Lossless compression allows you to reduce file sizes while still maintaining the original or uncompressed video fidelity. Digital cinema files are generally encoded in a lossless format. The video files that you watch on your smart TVs and personal devices are all encoded with a lossy codec, which means taking the original file and reducing as much of the visual information as possible while still allowing the image to look great. All streaming video is encoded using lossy codecs.

There are many different video codecs available – including proprietary ones, algorithms that have been developed by a company and can only be played back on devices made by that company or by licensing its technology. More common are open-source or standards-based codecs. These are typically less expensive to use and don’t require content owners to be locked into a closed system.

Today’s most popular standards-based codecs for video streaming are AVC/H.264 and HEVC/H.265. Broadcasters and pay TV operators sometimes still use MPEG-2, which is more than 20 years old. The crucial goal in codec development is to achieve lower bitrates and smaller file sizes while maintaining similar quality to the source. Until fairly recently, most video encoding was performed using specially built hardware chips. AWS Elemental pioneered software-based encoding, which runs on off-the-shelf hardware.


To reduce video size, encoders implement different types of compression schemes. Intra-frame compression algorithms reduce the file size of key frames (also called intra-coded frames, or I-frames) using techniques similar to standard digital image compression. Other codec algorithms apply interframe compression schemes to intelligently process the frames between key frames.

AWS Elemental has its own algorithms that it uses to analyze I-frames and the differences in subsequent frames, storing information on the changes between these frames in predicted frames (P-frames), and processing only the parts of the image that change. Bi-directional predicted frames (B-frames) can look backward and forward at other frames and store the changes.

Once compression has been applied to the pixels in all the frames of a video, the next parameter in video delivery is the bitrate or data rate – the amount of data required to store all the compressed data for each frame over time, usually measured in kilobits or megabits per second (Kbps or Mbps).

Generally speaking, the higher the bitrate, the higher the video quality – and therefore, the more storage required to hold the file and the greater the bandwidth required to deliver the stream.


AWS Elemental compression products are divided into two different categories – live encoders and video-on-demand encoders. Live encoders take in a live video signal and encode it for immediate delivery, in use cases such as a live concert or sporting event, or for traditional linear broadcast channels.

While live encoders are limited to analyzing and encoding content in real time, VOD encoders that use file-based media sources are not restricted to processing the content in real time. VOD encoders may take multiple passes at the video, analyzing it for motion and complexity. For example, explosions in an action movie might require more effort to encode than a talking-head interview.

Constant bitrate (CBR) encoding, unsurprisingly, encodes the video at a more or less consistent bitrate for the duration of a live stream or entire video file. Variation occurs because different frame types will have different data rates, and because buffers on clients allow a small amount of variability in the bitrate during playback. Variable bitrate (VBR) encoding, on the other hand, means the video bitrate can vary greatly over the video’s duration.

A VBR encode spreads the bits around, using more bits to encode complex parts of content (like action or high-motion scenes) and fewer bits for simpler, more static shots. In either CBR or VBR encoding, the bitrate target is followed as closely as possible, resulting in outputs that are very close in size.

Overall, especially at lower average bitrates, VBR encoded video is going to look much better than CBR-encoded video. Another key factor to consider with VBR is that the encoder needs to be configured so that the peak data rate isn’t set so high that the viewing device can’t process the stream or file.

Quality-based encoding takes VBR one step further by basing the differences in bitrate on the desired image quality, which can be defined by objective measurements, subjective analysis, or a combination of the two. AWS Elemental encoders employ sophisticated algorithms to consistently deliver the highest-quality image at the lowest possible bitrate.


For premium content, such as a television series or movie, AWS Elemental Server encodes video files to the highest possible quality. On-demand services may employ a fleet of AWS Elemental Servers to process VOD assets, again passing them along to a packaging and delivery platform like AWS Elemental Delta when playback is requested.

The codec of choice for delivering video evolves every few years, and each advance brings with it improved video quality at lower bitrates. At the same time, screen sizes and resolutions get bigger, so it takes considerable computing power to generate compressed files with high video quality.

Until recently, H.264 (also known as AVC) was the best codec for optimizing quality and reducing file sizes; many content publishers still use it today. But it’s quickly giving way to HEVC: High-Efficiency Video Coding. It’s also referred to as H.265; different standards groups employ different designations to refer to the same standard.

HEVC requires more computing power than H.264, but it’s more efficient. Because AWS Elemental writes all of its encoding software from scratch, rather than relying on off-the-shelf encoding software, it is able to take the efficiency gains in each new generation of codec and adjust the software accordingly to get the best quality and/ or smallest video file sizes, along with the shortest encoding times.

Learn more about the fundamentals of video compression and delivery in this Video Compression & Delivery 101 E-book.