The video you get straight from your camera is called RAW. RAW format video is a video recording that captures the data directly from the camera sensor without any compression or processing. They are great since they preserve the maximum amount of information and detail in the video, like exposure, color space, gamma, and so on.

However, when it comes to video transmission and streaming, RAW is not a helpful format. A RAW format video files need to be transformed and, most importantly, compressed before they are fit for transmission. You need video compression to make your videos fit for online distribution. Period.

What is video compression?

Video compression can be defined as reducing the file size of a video by discarding some information or quality.

Video compression has several obvious benefits.

  1. It can ensure optimal use of storage space and reduce the cost, be it cloud-based or on-premise storage.
  2. It can speed up file transfer and hence reduce video buffering instances.
  3. Compressed videos are easier to transmit and consume and are have less network bandwidth consumption.
  4. Compression can improve the quality and delivery of graphics, audio, video, and images by removing redundant or imperceptible data bits.

However, there is a catch. Video compression affects a video's visual quality to a certain extent.

How does video compression affect a video file?

If not done correctly, video compression could affect a video file in several ways. The primary components that get impacted are:

  • Visual quality,
  • File size,
  • Format compatibility, and
  • Functionalities.

Visual quality

Video compression affects the quality of the video by introducing artifacts or distortions that degrade the visual appearance of the video. These artifacts can be noticeable or imperceptible depending on the compression technique, the bitrate, and the video resolution. In other words, you might feel like the video resolution has reduced, leading to an inferior video viewing experience.

Some common traits of reduced video resolution are:

  1. Blocking
  2. Blurring
  3. Ringing
  4. Pixelation

Further, video compression impacts the video's audio quality by reducing the sampling rate, the bit depth, or the number of channels. Now you know why some videos with poor visuals also sound sloppy.

File size

Video compression affects the size of the video file by reducing the amount of data per second in the video. While this might seem good, excessively small video file sizes can leave the absence of any visual artifacts necessary for a good visual experience.

The ideal video file size depends on the codec used, video format, bitrate, resolution, and frame rate. Generally, higher bitrate and resolution result in a larger size, while lower bitrate and resolution result in a smaller size.

However, there is a trade-off between quality and size and diminishing returns after a certain point. Therefore, achieving a moderate balance of the bitrate and resolution to suit the target device and network conditions is important.

Video bit rate

Generally, higher resolution and frame rate result in a higher bit rate, while lower resolution and frame rate result in a lower bit rate.

Video compression affects the bit rate of the video file by reducing the amount of data per second in the video. When the amount of data in each frame is reduced, it also reduces the video data that is rendered per frame. As a result, when the video transits from frame to frame, it appears pixelated, blurry, in some extreme cases, even distorted.

Compatibility

Video compression affects the compatibility of the video file by changing the format or the codec of the video. The format and the codec determine how the video file is stored and played back by different devices and platforms. Some formats and codecs are more compatible than others, while some may require special software or hardware to support them.

For example, MP4 and JPEG are widely compatible with most devices and platforms, while MKV and WebM are less compatible with some devices and platforms. Most often, they might need dedicated video playback software other than the commonly available video players for opening and playing the video file. Therefore, it is important to choose the appropriate format and codec according to the purpose and audience of the video.

Functionalities

Video compression affects the functionality of the video file by adding or removing features or options to enhance or modify the video. Some formats or codecs support some features or options but not others.

For example, subtitles and multiple audio tracks are supported by MKV and WebM but not by MP4 natively. Similarly, Adaptive Bitrate Streaming is supported by H.264 and H.265 but not by motion JPEG.

Filters or effects can be applied to enhance or modify the video during compression using various tools or software. Therefore, it is important to consider the video file's functionality according to the user's needs and preferences.

However, if done correctly, video compression reduces or removes redundancy in video data. This makes it easier to stream the video over the internet early at the best quality possible without any buffering or video streaming issues.

The basic principles of video compression

The basic principles of video compression can be summarized as follows:

Spatial Redundancy

Videos often contain repetitive and redundant information within each frame. Video compression algorithms exploit this by using techniques like spatial downsampling and spatial transforms, such as Discrete Cosine Transform (DCT) or Wavelet Transform, to eliminate or reduce spatial redundancy.

Temporal Redundancy

In a video sequence, consecutive frames often share similarities, especially in scenes with minimal motion. Video compression algorithms utilize temporal prediction, where the difference (motion vector) between the current frame and a reference frame is calculated and coded. Only the differences are stored, reducing redundancy.

Quantization

After spatial and temporal redundancies are minimized, the data is quantized. Quantization involves reducing the precision of the transformed data (e.g., DCT coefficients). This step further reduces the amount of data to be encoded, but it can lead to some loss of visual quality.

Entropy Coding

To further compress the video data, entropy coding techniques are employed. These methods assign shorter codes to frequently occurring symbols and longer codes to less frequent ones. Huffman coding and Arithmetic coding are commonly used entropy coding techniques.

Motion Compensation

For video sequences with significant motion, motion compensation plays a crucial role. It involves estimating the motion between frames and encoding the difference between the current frame and a predicted frame generated using motion information.

Inter-Frame and Intra-Frame Compression

Video compression algorithms use both inter-frame (between frames) and intra-frame (within a frame) compression techniques. Inter-frame compression relies on temporal prediction and motion compensation, while intra-frame compression exploits spatial redundancies within a single frame.

Video Coding Standards

Various video coding standards have been developed to ensure compatibility and widespread adoption. Common video compression standards include H.264/AVC, H.265/HEVC, VP9, and AV1. These standards define the rules and guidelines for video compression, ensuring interoperability among different devices and platforms.

Overall, video compression aims to strike a balance between file size reduction and preserving video quality. The compression level and resulting visual quality can be adjusted based on the specific application and available bandwidth.

Video compression can be done using any of the following techniques:

  • Lossy compression and Lossless compression
  • Intra-frame and inter-frame compression
  • Spatial and temporal compression
  • Moving Picture Experts Group (MPEG)

Lossy compression and Lossless compression

Lossless compression reduces the file size without losing any information or quality, while lossy compression discards some information or quality to achieve a smaller file size.

Lossless compression is suitable for videos that require high fidelity and accuracy, such as medical or scientific videos, while lossy compression is more common for videos that can tolerate some degradation, such as entertainment or social media videos.

Intra-frame and inter-frame compression

Intra-frame compression compresses each frame of the video independently, while inter-frame compression compresses the frames by exploiting the similarities and differences between them.

Intra-frame compression is simpler and faster but less efficient, while inter-frame compression is more complex and slower but more efficient. Intra-frame compression is suitable for videos with many motions or changes. For example, sports action or adventure videos.

Inter-frame compression is more common for videos with many static or repetitive scenes, such as documentaries or interviews. Examples of intra-frame codecs are MJPEG, ProRes, and DNxHD, while examples of inter-frame codecs are H.264, H.265, and VP9.

Spatial and temporal compression

Spatial compression reduces the file size by removing the redundant or irrelevant information within each frame, such as color depth or detail level, while temporal compression reduces the file size by removing the redundant or irrelevant information between the frames, such as motion vectors or frame rate.

Spatial compression is more effective for videos that have a lot of detail or variation in each frame, such as nature or art videos, while temporal compression is more effective for videos that have a lot of movement or action in between the frames, such as animation or gaming videos.

Examples of spatial compression techniques are quantization, subsampling, and transform coding, while examples of temporal compression techniques are motion estimation, motion compensation, and frame skipping.

Moving Picture Experts Group (MPEG)

This family of video compression standards uses intra-frame and inter-frame compression techniques. MPEG standards use DCT, quantization for intra-frame compression, and motion estimation and compensation for inter-frame compression. They also use variable length coding (VLC) and Huffman coding for entropy coding.

MPEG standards are more complex and slower but more efficient than motion JPEG. MPEG standards are widely used for digital television, DVD, Blu-ray, streaming, etc. MPEG standards include MPEG-1, MPEG-2, MPEG-4, H.264, H.265, etc.

Exploring the advantages and disadvantages of each technique and when to use them

Video compression technique Advantage Disadvantage When to use
Lossless compression Preserves high quality and fidelity Produces large file size For videos that require high accuracy and detail, such as medical or scientific videos
Lossy compression Reduces file size significantly Discards some information or quality For videos that can tolerate some degradation, such as entertainment or social media videos
Intra-frame compression Simple and fast Less efficient than inter-frame compression For videos that have a lot of motion or changes, such as sports or action videos
Inter-frame compression More efficient than intra-frame compression Complex and slow, requires more processing power and memory For videos that have a lot of static or repetitive scenes, such as documentaries or interviews
MPEG compression Uses both intra-frame and inter-frame compression techniques, supports adaptive bitrate streaming Introduces artifacts such as blocking or ringing, complex and slow For various applications, such as digital television, DVD, Blu-ray, streaming, etc.

Best practices to follow in video compression


Choosing the right video compression technique wins half the battle. The remaining battle can be won by applying best practices, such as selecting the appropriate codec and format, adjusting the bitrate and resolution, using a tool, and testing the results.

Selecting the appropriate codec and format

The choice of codec and format depends on various factors, such as the video's purpose, platform, audience, quality, and bandwidth. For example, if the video is intended for streaming over the Internet, a codec that supports adaptive bitrate streaming, such as H.264 or H.265, is preferable.

A codec that preserves high quality and fidelity, such as ProRes or DNxHD, is preferable if the video is intended for archival or editing purposes. The format also affects the compatibility and functionality of the video. For example, if the video needs to support subtitles or multiple audio tracks, a format that supports these features, such as MP4 or MKV, is preferable.

Adjusting the bitrate and resolution

The bitrate and resolution are key parameters affecting video quality and size. The bitrate is the data per second in the video, while the resolution is the number of pixels in each frame. Generally, higher bitrate and resolution result in higher quality and larger size, while lower bitrate and resolution result in lower quality and smaller size.

However, there is a trade-off between quality and size and diminishing returns after a certain point. For example, increasing the bitrate beyond the perceptual threshold of the human eye will not improve the quality significantly but will increase the size unnecessarily.

Similarly, increasing the resolution beyond the device's display capabilities will not improve the quality significantly but will increase the size unnecessarily. Therefore, adjusting the bitrate and resolution according to the target device and network conditions is important. A common rule of thumb is to use a bitrate of 0.1 Mbps per pixel for standard definition (SD) videos, 0.2 Mbps per pixel for high-definition (HD) videos, and 0.4 Mbps per pixel for ultra-high definition (UHD) videos.

Use a video compression/optimization tool

Various tools and software are available for video compression, ranging from free and open source to commercial and proprietary. FFmpeg, HandBrake, VLC, and Adobe Media Encoder are typical examples.

These tools and software allow users to customize various compression settings and apply filters or effects to enhance or modify the video. They also support batch processing and conversion of multiple videos at once.

However, different tools and software may have different features and performance levels, so it is advisable to compare them before choosing one.

If you want to make a quick and best choice of a video compression tool, try ImageKit. It helps automatically convert videos to the best format and quality suitable for web delivery. It facilitates video streaming to any platform or device with adaptive bitrate streaming that automatically chooses the right format and video quality suitable for the end-user device and connection speeds.

Further, it is a no-code tool, meaning you can reduce the size of the videos by using URL-based parameters and default compression settings. ImageKit also provides a fast CDN and easy integrations with popular storage services and web servers.

Testing the results

After applying video compression techniques, it is important to test the results to ensure that they meet the desired quality and size requirements. Testing can be done by using objective metrics or subjective evaluations. Objective metrics are mathematical formulas that measure the difference between the original and compressed videos regarding pixel values or frequency components.

Some examples are peak signal-to-noise ratio (PSNR), structural similarity index (SSIM), video quality metric (VQM), etc. Subjective evaluations are human judgments that rate the perceived quality of the compressed videos based on criteria such as sharpness and colorfulness.

Bringing it all together

In a nutshell, we can describe video compression as a vital technique for efficiently storing and transmitting video data on the internet. Many video compression techniques and standards have been developed over the years, each with advantages and disadvantages. Choosing the right compression technique can make or break your video delivery. The wise choice would be to use a tool that can automate the heavy lifting and help you streamline video delivery at its best.

Try ImageKit. Its forever-free plan comes with a free 20 GB storage space. Upgrade whenever you are ready.

πŸ‘‰ Sign up for ImageKit.