Compressing Video Files: A Practical Guide

Video encoding is a process you can use to change the format of a video file or to compress a video. It is accomplished through algorithms and is performed to ensure that videos are playable on your intended devices or to reduce the size of video files. Typically, changing formats and compression are performed together. In this article, you will learn how video compression works, including a review of popular video compression tools.

Compressing Video Files

Video Compression Basics

To understand video compression, it is helpful to understand some basic vocabulary. The most common terms you may see include:

  • Frame rate—the number of frames per second (FPS).
  • Master version—a raw version of a video that has typically not been compressed or altered. This is the highest quality copy of your video.
  • Resolution— the height and width of your video as measured in pixels. The most popular resolutions include 426 x 240 (240p), 640 x 360 (360p), 854 x 480 (480p), 1280 x 720 (720p), and 1920 x 1080 (1080p).
  • Bitrate—the number of bits transferred per second during playback. Bitrate is directly connected to quality with higher bitrates producing higher quality. Bitrates are measured in mbps, kbps, or bps.
  • Video container—a package that contains video data, including audio tracks, subtitles, metadata, and codecs. Examples include MP4, MOV, AVI, and MKV.

What are Codecs?

Codec is another term that you need to know to understand video compression. Codecs are hardware or software that you use to encode and decode data. When data is compressed, it is encoded differently or in a different format than it was before.

The codec you use to compress your videos determines the type of compression that is performed (explained below). It also determines which containers can house your video files. Common video codecs include H.264, VP9, and RV40. When you compress video files, you often use these codecs in addition to audio codecs, which can compress audio data.

An important thing to note, codecs are not the same as containers even when the name of the codec and the container are the same. Containers encapsulate all files and data associated with a video and create an interface for video players. Codecs determine the format of data within the container.

How Video Compression Works

Videos are compressed with either lossy or lossless compression. Lossy compression removes data that is deemed unnecessary, such as metadata, color data, or individual frames. Lossless compression identifies patterns in data and replaces instances of a pattern with references to the first occurrence.

Lossy is the more commonly used type of compression since it produces significantly smaller file sizes. Lossy compression is accomplished by reducing bitrates, resolution, frames per second, or depth of color. It can also be performed by removing audio tracks or by intra-frame compression. Intra-frame compression uses predictive algorithms to recreate frames, eliminating the need to store the data that is being predicted.

Conclusion

Video compression works to reduce the size of a file. It is performed to reduce the amount of storage needed to keep files and bandwidth needed to transfer or deliver files. Smaller file sizes enable you to ensure faster loading times when you include videos on your websites and enable you to implement smoother video streaming. Smaller file sizes also enable you to save on storage costs, which can add up quickly if you are storing many videos.