ad
ad

Video Compression as Fast As Possible

Science & Technology


Video Compression as Fast As Possible

Video compression is a very important aspect of how video streaming websites like YouTube, Netflix, and Hulu work. Without it, you wouldn't be able to stream such high-quality, high-frame videos like this one.

First, some math. Let's say you're watching a video with a resolution of 1920x1080 pixels—that's around 2 million pixels per frame. If the video is running at 30 frames per second, you're dealing with 62 million pixels per second. Each pixel needs 24 bits or three bytes of information, so you’re looking at 178 megabytes of data per second completely uncompressed. That totals to 51 gigabytes for a five-minute video. Even with fast internet, downloading 51 gigabytes in five minutes is impossible for most.

Fortunately, a five-minute high-definition YouTube video is not 51 gigabytes; it's more like 72 megabytes—that's approximately 700 times smaller. This reduction is achieved through video compression, which works mainly by minimizing redundancy in the video data.

There are numerous methods and standards for video compression involving different video containers and codecs, but we’ll focus on the basics. Video compression can be divided into two categories: spatial compression and temporal compression, also known as intra-frame and interframe compression.

Spatial or intra-frame compression is applied to individual video frames. To compress a video frame, the same process used to compress a still image, like a JPEG, can be employed. When a JPEG is created, color information is reduced in a process called chroma subsampling, and the image is split into sections of 8x8 pixels called macroblocks. Further steps are then taken to reduce the file size. This method can create "compression artifacts," those ugly squares in highly compressed images.

On the other hand, temporal or interframe compression reduces redundancy by focusing on the similarity between consecutive frames. Many frames in a video are almost completely identical. For parts of the video that don't change, instructions can be given to "not change anything." Video formats like MPEG break frames into 8x8 pixel macroblocks as well, each receiving instructions on how to handle pixels. Frames with these instructions are called p-frames, which use about half the data of an i-frame (essentially a JPEG). There are also b-frames that predict changes between i and p-frames, using even less data.

This is why some video files look blocky—these artifacts result from high compression or errors in the encoding or transmission of the video data. Essentially, everything boils down to bit rate. The bit rate is the amount of data or bits used each second. Lower bit rates result in lower quality, higher compression, and increased artifacts. Higher bit rates result in better quality and resolution. Compression is always a balance between video quality and file size.

Thank you for watching. Don't forget to subscribe, comment, and like.

Keywords

  • Video Compression
  • Streaming
  • Spatial Compression
  • Temporal Compression
  • Intra-frame
  • Interframe
  • Chroma subsampling
  • Macroblocks
  • Bitrate
  • Compression Artifacts

FAQ

Q1: What is video compression?

A1: Video compression is the process of reducing the data size of video files to make them more manageable for streaming and storage without significantly compromising quality.

Q2: What are the two main types of video compression?

A2: The two main types are spatial compression (intra-frame) and temporal compression (interframe).

Q3: How does spatial compression work?

A3: Spatial compression works by compressing individual video frames similarly to still images, like JPEGs, reducing color information and dividing the image into blocks called macroblocks.

Q4: What is temporal compression?

A4: Temporal compression reduces redundancy between consecutive frames, utilizing instructions to keep unchanged parts of frames and thus significantly reducing data size.

Q5: What are compression artifacts?

A5: Compression artifacts are visual distortions that occur when a video file is highly compressed, appearing as blocky or pixelated areas in the video.

Q6: What is the bit rate in video compression?

A6: Bit rate is the amount of data (bits) used per second in a video file, influencing both file size and video quality. Lower bit rates result in lower quality and higher compression, while higher bit rates improve quality and resolution.