What Is Video Compression?
The majority of websites need to deliver many media files to user browsers, including videos. To ensure the files load quickly and efficiently, without causing loading delays or consuming too much storage and bandwidth resources, site developers and admins often apply various video optimization techniques, such as video compression.
Video compression techniques enable you to reduce the size of your video files.
To compress a file, you typically need to perform a process called video encoding, during which you convert your video files into a smaller format.
Video encoding is implemented through the use of video codecs, which can be a piece of software, an algorithm, or a device. The codec can perform two functions:
- Encoding—converting the original format of your video into another one.
- Decoding—converting the video file back to the original format, thus reversing the process of encoding.
The process ends with a different format.
The goal of video compression is to reduce storage usage and costs while delivering an optimal video loading time. Smaller files take less storage space, cost less, and can be transferred quickly between locations.
Video Compression Concepts
There are many concepts utilized in video compression. Below are the most basic concepts everyone should know.
Compression techniques—lossy vs lossless
Traditionally, video compression techniques are split between two main categories: lossy compression and lossless compression. Each technique leverages different conversion types and delivers different results.
Lossy compression removes data redundancies from your file, providing a compression ratio of maximum 300:1 for each video file. However, while lossy compression can significantly reduce file size, the process cannot be reversed, and file quality degrades more when additional compressions are performed.
Lossless compression removes data redundancies without degrading video quality. This algorithm builds bit sequences based on statistical models. Each bit sequence rate specifies the amount of data needed by each second of the video. The rest of the data is deemed redundant, and subsequently eliminated. This technique provides a max 8:1 compression ratio, which preserves the quality but the file size still remains relatively large.
Video encoding processes format your files for output. This is when files are compressed, but you can also add information to the file during this process, such as chapters and subtitles.
Transcoding processes convert one encoding format to another, usually applied using lossy compression. You can start, for example, with H.264 and then convert the format to MPEG4. Transcoding is performed typically when you prepare your video for web distribution.
A codec compresses or decompresses a video file, using a wide range of compression algorithms. The codec determines the ratio of quality and file size.
The term “resolution” specifies the number of horizontal lines the video file contains in each frame, and expressed in width by height. When the resolution is low, the file size is small.
Frame Rate (FPS)
FPS determines the frequency at which separate frames (images) are displayed, expressed in frames per second (FPS).
Bitrate, which is also called “data rate,” controls the size of the file. Files with higher quality have a higher bitrate, while lower bitrates translate into lower file sizes. This is expressed in kilobytes per second (Kbps).
Video Compression Tips: 7 Quick Techniques
Video files are composed of many different elements, any of which can contribute to a higher file size. Here are key methods you can use to quickly compress the size of your video files:
- Film in slow motion—helps reduce drastic changes made from one image frame to the following one. The slow movement enables the compression codec to recycle additional pixels from one image to another, and the result is better quality. Quick motion, on the other hand, can turn video files into a blurry mesh which is far more difficult for codecs to analyze frame by frame.
- Do not upload flat footage—when looking for redundant data to remove, compression codecs look for details in each scene. When there is clear contrast and saturation, the codec can detect and preserve different elements in the frame. However, if there is not enough contrast and saturation, the codec cannot make this separation. This is why nighttime and flat footage often look blurry.
- Convert video files to formats that support HTML5—HTML5 is the standard language used in web design. Previous versions of HTML required Flash plugins for video viewing. However, HTML5 does not require Flash at all. You can convert your files to MP4 or WebM and achieve smooth video uploads.
- Upload video files with high bitrate—you can avoid unnecessary quality degradation by uploading high bitrate video files, between 20Mbps and 50Mbps. It might take longer to load, but the transcoding process will take care of that after the initial upload. Try using codecs like Photo-JPEG or ProRes.
- Backup your master files—video compression involves conversion. During the conversion process, your video loses quality. To ensure you always have a high quality video to use, keep a master copy in a backup repository. This way, if your file was too degraded, you can fall back to the original version. Never convert your master file.
- Remove the audio from muted video files—if your video is only shown and isn’t heard, then there is no need to keep the audio data. For videos you created, you can easily remove the audio. There are also editing tools you can use to remove audio from files you have not created.
- Do not loop your video endlessly—because endless loops use a lot of central processing unit (CPU) resources. This can quickly slow down your page. Instead, you can configure your video to stop playing after one loop or pause after a number of seconds.
Video files take up a lot of space and resources. Heavy video files can slow down your site, creating a poor user experience. Additionally, high demands on resource and storage usage often result in high billing. You can optimize your video files to avoid these issues. Typically, you do this by removing data redundancies. However, since this process degrades your video, you should always keep a master copy of your video.