Lesson video

In progress...

Loading...

Hello, I'm Dr.

Das, welcome to Computing.

I'm so pleased that you have decided to join me for this lesson today.

In today's lesson, we will be looking at compression ratios.

Welcome to today's lesson from the unit data compression.

This lesson is called Compression Ratios, and by the end of today's lesson you should be able to describe and calculate compression ratios.

Some of the key words that we will be using in today's lesson include compressed size, compressed size, the file size after compression has been applied.

Ratio, ratio, a comparison of the original file size to the compressed file size.

original size, original size, the file size before any compression has been applied.

This lesson is divided into two sections.

Describe compression ratios and calculate compression ratios.

Let's start by looking at the first section where you will learn how to describe a compression ratio.

Data compression is the process of reducing the size of a file file.

To compress a file, compression algorithms are used.

Data compression algorithms work by removing unnecessary data and rearranging information more efficiently.

There are a number of advantages to using data compression such as a reduction in the space needed to store files locally and in the cloud.

Bandwidth usage when transferring data on a network and faster uploading and downloading times to reduce latency.

The compress size of a file can be much smaller than the original size.

So if you look here, the original size of the file, the original file is quite a large file, but having applied a compression algorithm on this, the resulting file size is much smaller.

Compression reduces the number of bits required for a file.

There are two categories of compression algorithm, lossy compression, and lossless compression.

The choice of compression method will depend on factors like the need for data accuracy, the acceptable level of quality loss and the importance of reducing file size.

A compression ratio gives an indication of the effectiveness of a compression method in reducing file size.

This is helpful as it allows you to compare and select the most appropriate compression algorithm for a given scenario.

The compression ratio is a measure of the relative reduction in the size of a file as a result of applying a compression algorithm, it is calculated by dividing the original size of a file by the compressed size, so the compression ratio is equal to original size divided by the compressed size.

A high compression ratio means the compressed size of the file is much smaller compared to its original size.

So if you look at the example here, the original size, the original file is 10 megabytes file.

Having applied the compression algorithm, we reduce it to a file size of one megabytes.

This example therefore has a compression ratio of 10 is to one.

A low compression ratio means the compress size of a file has only been made a little smaller compared to its original size.

So again, looking at the example, the original file size was 10 megabytes.

Having applied the compression algorithm, you get a new file of size eight megabytes.

This example has a compression ratio of 10 is to eight.

It is usually possible to adjust the amount of compression with both lossy and lossless methods.

However, in general, it is possible to achieve higher compression ratios with lossy compression than with lossless compression.

So lossy gives you higher compression ratios and lossless gives you lower compression ratios.

Note that compression ratios should be selected carefully.

There are a number of advantages and disadvantages to using both high and low compression ratios.

These will need to be considered when choosing the most suitable compression ratio for a file.

The advantages and disadvantages of higher compression ratios are outlined in the table below.

So the advantages of a higher compression ratio include significantly smaller file sizes.

The fact that it saves storage space, faster uploads and downloads, ideal for sharing over networks or streaming.

The disadvantages on the other hand include slower performance due to more processing needed.

Longer decompression times, may require more powerful hardware and can reduce quality with lossy compression.

The advantages and disadvantages of lower compression ratios are outlined in the table below.

So the advantages include better quality, especially with lossy files, faster to decompress and access, less processing power required and preserves more of the original.

The disadvantages include larger file sizes.

It takes up more storage space, slower upload and download times, and is less efficient for sharing or streaming.

That brings us to a check.

Using high compression ratios with lossy compression can reduce the quality of a file.

What do you think, is the statement true or is it false? Why don't you pause the video here and have a quick think.

The correct answer is true.

Using high compression ratios with lossy compression can reduce the quality of a file.

Another check, which of the following is an advantage of using lower compression ratios? You've been given three options.

Why don't you pause the video again and try and work this one out.

Did you choose option A? That's the right answer.

The advantage of using lower compression ratios is that it preserves more of the original data.

That brings us to task A.

That brings us to the end of this section.

Before we move on, why don't you attempt this task just to make sure you have understood what we covered in this section.

Aisha's got a question.

Did you say compression ratio? I've never heard of that before.

Why don't you help Aisha improve her understanding of compression ratios by answering the questions below? This task has two parts.

The first one asks you to write a few sentences to describe what a compression ratio is and what it tells you about a file.

The second part asks you to write a few sentences to describe how a compression ratio can impact the compressed file size and quality.

Pause the video here and try and work these two parts out.

I am sure you'll be able to.

Let's look at what possible answers could be.

The first part asked you to write a few sentences to describe what a compression ratio is and what it tells you about a file.

A compression ratio shows how much smaller a file becomes after it is compressed.

It compares the original size to the new compressed size.

For example, a ratio of five is to one means the file was reduced to 1/5 of its original size.

A higher ratio means more compression has taken place.

Part two of this task asked you to write few sentences to describe how a compression ratio can impact the compressed file size and quality.

A higher compression ratio creates a smaller file, which is useful for saving space or faster downloads.

However, in lossy compression, this can also reduce the quality of the file, making an image look blurrier or audio sound less clear.

A lower compression ratio keeps more of the original quality, but the compressed size will be larger.

Well done on adapting that task, let's move on.

The next section looks at calculating compression ratios.

Sofia says, "I've compressed a music album from a CD using FLAC, which is Free Lossless Audio Codec.

The original size of the music was 700 MB.

Now the compress size is 350 MB, so the original size was 700 megabytes and the compress size is 350 megabytes.

Lucas says that's a compression ratio of two is to one, which is quite a small compression ratio.

You've still saved 350 megabytes of storage though, Sofia says, I wonder how Lucas worked out the compression ratio.

It is easy to calculate the compression ratio if the original size and compressed size of the file is known.

So the original size of Sofia's file was 700 megabytes.

The compressed size was 350 megabytes.

So the compression ratio will be the original size divided by the compressed size, which means for Sofia's file, the compression ratio would be 700 divided by 350, which gives us two.

The compression ratio is two is two one.

Lucas says, I wonder what the compressed size would be if you used MP3 lossy compression.

Sofia says, that's a really good idea, Lucas, I'll compress the music album into an MP3 format and work out the compression ratio.

Maybe I can save even more storage space.

Sofia says, the original size of the file was 700 megabytes and the compressed size using MP3 is now 70 megabytes.

So original size, 700 megabytes, compressed size 70 megabytes, which gives us the compression ratio as 700 divided by 70.

So your original size divided by the compressed size, which is equal to 10.

So the compression ratio is 10 is to one.

Sofia says, I've worked it out and the compression ratio using MP3 is 10 is to one.

That's quite a high compression ratio, isn't it? Lucas says that is quite a high compression ratio, Sofia, by using MP3 lossy compression, you have saved 630 megabytes.

That's a lot of storage space you've saved that can be used to store other files.

I'm just wondering, Sofia, Lucas says, do the FLAC and MP three files sound the same or can you tell any in the audio quality? Sofia says, well, both the FLAC and MP three sound pretty good, but I think I can just notice that the FLAC file sounds a bit clearer and has a little more detail.

It should be noted that the compression ratio provides important details about the relationship between the original and compressed files.

If the compression ratio is 10 is to one, so 10 MB of original storage reduces to one MB of compressed storage.

This can be useful when you're considering things such as storage requirements and estimating how long a compressed file might take to upload or download.

To calculate the compressed file size, you take the original size of the file and then divide it by the first number in the ratio.

So if we have the original size as 20 MB and a compression ratio of five is to one, we look at the first number and divide 20 by five to give you four.

So this answer then gets multiplied by the second number, which in this ratio is one.

So four times one equals four, the predicted compressed file size is four MB.

Calculating compression ratios and compressed file size is quite straightforward.

There are, however, a few things to consider to ensure your calculations and predictions are correct.

Always convert file sizes to the same unit before calculating.

For example, make sure both values are either in MB or KB, et cetera.

So original size is one MB compressed size is 0.

1 MB or 100 kilobytes, but instead of saying it's 100 kilobytes, you say it's 0.

1 MB.

Next, make sure you are using the correct formula and rearrange as needed.

Compression ratio is equal to original size divided by the compressed size.

Express the compression ratio in its simplest form to make it easier to understand.

For example, instead of saying 100 is to 25, you say it's four is to one.

That brings us to a check.

What is the compressed file size if a file is originally 250 MB in size and compressed with the ratio of 25 is two one? You've been given four options.

Why don't you pause the video here and try and work this out.

I'm sure you'll be able to.

Did you choose option C, 10 MB? Well done, so the original file size was 250 MB.

The first number in the compression ratio is 25.

So you divide 250 MB by 25, which gives you 10 MB and then you multiply that with the second number in the ratio, which is one.

So 10 MB multiplied by one gives you the answer as 10 MB.

Well done on working that out, let's do another check.

It is not possible to predict the size of a compressed file if the compression ratio and original size of a file are known.

What do you think? Is the statement true or is it false? Why don't you pause the video here and have a quick think.

The correct answer is false.

Why, because it is possible to predict the compress size of a file if you know the compression ratio and the original size.

Well done, let's move on.

That brings us to the end of this section.

To make sure that you've understood what we covered in this section, why don't you attempt this task? Task B is made up of two parts.

The first part asks you to calculate the compression ratios in the following examples.

There are three examples for which you need to work out the compression ratios.

Why don't you pause the video here and try and work these out.

Let's look at what the different compression ratios are.

So for the first part of this question, the original size is 50 MB.

The compress size is five MB.

Your compression ratio is calculated by dividing the original size by the compressed size.

So 50 divided by five gives you 10, which means the compression ratio is 10 is to one.

For the second one, the original size is 100 MB, compressed size is 20 MB.

When you divide 100 by 20, you get five.

So the compression ratio is five, is to one.

For the final one, the original size is 300 MB.

The compress size is 50 MB 300 divided by 50 gives you six.

So the compression ratio is six is to one.

Well done on working all the three parts out.

Let's now look at the second part of this task.

The second part asks you to calculate the size of the compressed files for the following examples.

Again, three examples for which you need to calculate the compressed file size.

Pause the video here and try and work these out.

You have done so well until now that I'm sure you'll be able to work these out as well.

Let's look at what the different solutions are.

So for the first part of this question, the original size of the file is 50 MB, compression ratio is five is to one.

So you take the 50 MB and you divide it by the first number of the ratio.

So 50 divided by five gives you 10.

Then you multiply this with the second number of the ratio.

So 10 times one is 10.

So the size of the compressed file for this example is 10 MB.

The second example, the original file size is 200 MB.

The compression ratio is five is to one, so the size of the compressed file will be 200 divided by five, which is equal to 40 MB.

Finally, for the original size of 300 MB and compression ratio of 10 is to three, you divide the original size 300 MB by 10, which is the first number of the ratio, that gives you 30, and then you multiply that with the second number of the ratio, which is three.

So 30 times three gives you 90, which means the size of the compressed file is 90 MB.

Really well done on working all of these out and completing task B.

The summary, to summarise, compression ratios are calculated using the formula original size divided by compressed size.

A compression ratio compares the files original size to the compressed size, showing how much smaller the file becomes.

A higher compression ratio means the file size has been reduced more, but this may lead to lower quality with lossy compression.

A lower compression ratio preserves more of the original files quality, but results in a larger file.

Finally, predicting or calculating compressed file sizes using compression ratios helps with storage planning and performance.