Wednesday, June 26, 2024

Audio, Image, Video Compressions, for Non-Informaticians

Choosing the right codec for every project takes a lot of time. Not everybody is an informatician. My goal here is to reduce the amount of time that you need to spend in order to understand the simple and relevant compression ways.

Sometimes compression process causes some loss of information and sometimes not. In order to save some space, we trade-off some data by throwing it away. Lowering the resolution is one way of doing it. But first of all how does data compression work?

Representation of an Image

Representing digital image can take a lot of space. For example, if you want to store 4-minute song digitally, it would take up over 40 megabytes of space. 2-hour HD video would take 1000 gigabytes. To take up less space, in the real world the information is digitally compressed. The 40-megabyte song can be compressed to 4-megabyte, 2-hour video can be reduced to just 2-gigabyte etc.

But are we enough aware of our options when it comes to the compressions?

Here are some tips to lose less or not to lose any data.

Lose Data Compression Ways

  1. 1. Spatial compression: Identical pixels are not represented. Instead of coding the same pixels separately one selected pixel represents all. JPEG, MGPG, AVCINTRA, ALL-INTRA, Animated GIF are just some examples of lost information compression.
  2. 2. In Audio: FLAC and MP3
  3. 3. Temporal Compression: To reduce the size of a storage keyframes either are left uncompressed or only differences between frame are compressed. MPEG-1, MPEG-2, MPEG-4
  4. 4. Color Sampling (In French échantillonnage): Some parts of the colour is only registered.
colour sampling ways for VHS, some other cameras

Lossless Data Compression

It means that: the compressed data can be decompressed back into the exact original. Every single parts of data that was originally in the file, remains the way it was after it is uncompressed.

Png, GIF, ZIP, Motion JPEG 2000, VC-2 HQ, AV1, Apple Animation, FFmpeg, CorePGN are some of the examples of this type of compression. For more in detail: 

My Suggestions

For your photographs you can use also psd, bmp or TIFF. In TIFF you can be sure that no data is being lost in the compression.

For audio: WAV is entirely uncompressed, but it takes a lot of space.

Video: If you want no image quality loss for video then HEVC (H.265) and MRP are the ones that I can suggest.

Don’t Afraid to Lose Data

It looks frightening at first, thinking about how much compromises you need to initiate. Using a lossy compression gives you more space in your data storage. But lowering down the quality forces you to accept the imperfection. However, sometimes lossy compression options for images can be a smart move to do. If the image is as good as to human eyes, another way to say, if visual quality is just about the same, why should we care about the technical loss?

On the other hand sometimes a highly compressed image from the beginning, especially in video, doesn’t allow for the necessary touches after. Such as low-quality footage in the first place makes the colour correction or contrast arrangements difficult afterward. That’s why for the video, it is a good idea to shoot your rushes (footage) in high quality. That will allow you to keep as much detail as possible from the start. But once you finish the editing and arrive to post production you can compress it by lossy compression. It is perfectly fine. You will see it is not going to make a very big difference.

Otherwise for audio storage, I suggest you do the opposite. Higher the quality better the benefit. Because adding changings on a sound wave afterward, won’t give the same calibre. Sound is not as suitable as the image files in terms of compression. When you lose the quality it is completely gone. That’s why for me, you should consider keeping the audio files as lossless as possible in your archive.


İlgili Makaleler