In plain language about how file compression works


Free Download Mp4Gain
picture

In plain language about how file compression works

file compression

File compression allows you to transfer, receive and store large files faster. It’s used everywhere, and you probably know it well – the most popular compressed file extensions are ZIP, JPEG, and MP3. This article will take a quick look at the main types of file compression and how they work.

file compresion

What is compression?

Compressing a file is reducing its size while preserving the original data. In this case, the file takes up less space on the device, which also makes it easier to store and transfer it over the Internet or otherwise. It is important to note that compression is not unlimited and is generally divided into two main types: lossy and lossless. Let us consider each of them separately.

Lossy compression

This method reduces the file size by removing unnecessary bits of information. It is most often found in image, video and audio formats where there is no need for a perfect representation of the source media. MP3 and JPEG are two popular examples. But lossy compression is not entirely suitable for files where all information is important. For example, in a text file or spreadsheet, it will produce garbled output.

MP3 does not contain all the audio information of the original recording. This format eliminates some sounds that people cannot hear. You will notice that they only disappear on professional computers with very high sound quality, so for normal use, removing this information will reduce the file size with little or no inconvenience.

Also, JPEG files remove non-critical portions of images. For example, in an image with a blue sky, JPEG compression can change all the pixels to one or two shades of blue instead of tens.

The more you compress the file, the more noticeable the decrease in quality becomes. You have probably noticed this while listening to low quality MP3 music uploaded to YouTube. For example, compare a high-quality music track to a highly compressed version of the same song.

Lossy compression is suitable when the file contains more information than is necessary for your purposes. For example, suppose you have a huge RAW image file. It is advisable to maintain this quality to print the image on a large banner, but uploading the original file to Facebook will not make sense. The image contains a lot of data that is not visible when viewed on social media. Compressing the image to high-quality JPEG excludes some information, but the image looks almost like the original.

When saving in a lossy format, you can often set the quality score. For example, many image editors have a slider to select JPEG quality from 0 to 100. Savings of 90 percent or 80 percent result in a small reduction in file size with little visual difference. But saving in poor quality or saving the same file again in lossy format will make it worse.

The result was saved in JPEG format with 50% quality. It doesn’t look too bad. You can only notice artifacts around the edges of the frames when you zoom. 310 KB:

Where is lossy compression used?
As we mentioned, lossy compression is great for most media. This is extremely important for companies like Spotify and Netflix, which constantly stream large amounts of information. Reducing the file size as much as possible while maintaining quality makes them work more efficiently.

Lossless compression
Lossless compression allows you to reduce file size so that you can restore the original quality later. Unlike lossy compression, this method does not remove any information.

Lossless file compression illustration

This is a simple illustration of how to perform lossless compression. The same information is stored more efficiently. Consider a real file: mmmmmuuuuuuuoooooooooooo. It can be compressed to a much shorter form: m5u7o12. This allows 7 characters instead of 24 to represent the same data.

Where lossless compression is used

ZIP files are a popular example of lossless compression. Storing information in the form of ZIP files is more efficient, and when you unzip the file, all the original information is there. This is true for executable files, because after lossy compression the unzipped version will be corrupted and unusable.

Other common lossless formats are PNG for images and FLAC for audio. Lossless video formats are rare because they take up a lot of space.


Free Download Mp4Gain
picture


Mp4Gain Main Window
picture


Mp4Gain Features
picture


Free Download Mp4Gain
picture

Author: R. Arias

R. Arias is the author of this article and has extensive experience for more than 30 years as a recording engineer and audio specialist, as well as more than 20 years of experience creating algorithms related to audio and video. Linkedin