<p>If you imagine you have a video signal, and you want to capture all of it.. Let's say it is 1920x1080 at 25fps. You can store all the information about every pixel at full colour depth on every frame.  This would be lossless - you could full recreate the signal upon playback, and it would be identical to the original that you captured.</p>
<p>The downside of this process is that the files would be extremely large, and you may require relatively powerful hardware to successfully playback the signal successfully without dropping any frames.</p>
<p>So you may compress the signal or file instead in a number of different ways:  You might look at each frame, and try to spot areas where there isn't much detail (such as in an out-of-foucus background).  Instead of storing every pixel in this area of the frame, you could say &quot;these twenty pixels are all about the same shade of blue).  The frame you have stored would take up less space on your computer, but when you come to recreate the frame upon playback, it would no longer be identical to the original.</p>
<p>Now you could also do this over time - this is called <a href="https://en.wikipedia.org/wiki/Inter_frame" rel="nofollow noreferrer">inter-frame compression</a>.  So you can look at a number of frames over time, and spot where there is little variation in the image - and only record information where there is a significant change.</p>
<p>All of this involves working from a model of &quot;perception&quot; - what can the eye-brain combination see?  How clearly can it tell when something has been data reduced?</p>
<p>Lossy formats can store the same video at much smaller file sizes.  Or - another way to look at it - with a given amount of bandwidth, you can transmit a much higher quality video if it is compressed than if it was transmitted as a lossless format.</p>
<p>Recreating video from a lossy format also has performance overheads. So for a given system, you may find a codec that plays back well on one system performs very badly on another.</p>
<p>In general, most video files delivered on the internet to consumers are lossy.  This is for the reason mentioned earlier - you can deliver a perceptably &quot;better&quot; looking file using a lossy codec faster, than you could if the file was lossless.  So final deliveries to website such as YouTube etc are usually in a lossy format such as h264.</p>
<p>During the production process, this is not the case. If your camera can export it, and you have a fast enough computer, with enough storage space, you may want to use lossless formats for editing, or at least formats which don't use any inter-frame compression.  This is so that your computer doesn't need to &quot;rebuild&quot; frames that don't exist when you are scrubbing through your edit.  Each frame in a format like ProRes is fully described, even though there is still some data compression in the way the colour of each pixel is described.</p>
<p>Lossless and lossy formats both have their place. They're both useful tools when used in the right part of the production process.</p>

CC BY-SA 4.0
2021-04-26T13:37:46.497Z
2021-04-26T13:37:46.497Z
tomh
<p>Just to add a little detail to t @tomh's excelent answer: a 1920×1080 image comprises 2,073,600 pixels. To capture this in a way that includes all the visual information that you could see with your naked eye would require <em>at least</em> 14 stops of dynamic range, which translates to 3 channels of 14-bit colour (the three channels are the RGB components, or more usually the YUV components, and since an ƒ-stop is a doubling of the light levels, and because each bit you add to the end a binary number doubles it, 14 stops = 14 bits). So that's 42 bits of colour information, per pixel, per frame, or 2,073,600×42 = 87,091,200 bits per frame or roughly 10 Mb. Multiply that by the number of frames per second, e.g. 25 and you need ≈ 250 Mb/s to represent the image. Every minute will require 15Gb of storage. It's pretty easy to see that compression is going to be necessary.</p>
<p>There are lossless compression codecs that work by removing redundancy in the bits recorded, similar to the way you can zip a file on your computer to reduce the size, but still get back an identical copy when you unzip it. Most lossless compression uses this kind of compression scheme, particularly because a video stream usually has a lot of redundancy. They're nowhere near as efficient as lossy algorithms, but what you get out will be exactly the same as what you put in.</p>
<p>Whether any codec is <em>better</em> than another depends on a few factors, including:</p>
<ul>
<li>fidelity—how accurate the output is compared to the input</li>
<li>data rate and efficiency—how much data it requires to record the video</li>
<li>speed—how quick it is to encode / decode frames</li>
<li>complexity—how much processing power is required to encode / decode the codec</li>
<li>robustness—how well the codec deals with missing or corrupted data during transmission, e.g. digital terrestrial television broadcast</li>
<li>availability—whether the codec is commonly available, whether it is free to use, also whether the format is open or closed source</li>
<li>compatibility—with container formats—some codecs only work in quicktime .mov or .avi containers, and with playback technology, e.g. does it play in browsers</li>
</ul>

CC BY-SA 4.0
2021-04-29T04:14:57.010Z
2021-04-29T04:14:57.010Z
stib
<p>What exactly are the differences between lossless and lossy codecs? And is one better format better than the other or is it mostly relative?</p>

<video-quality><codec><file-formats>
What is the difference between lossless and lossy formats?
GAP
# What is the difference between lossless and lossy formats?

(Asked by: username_0 on 2021-04-22)

What exactly are the differences between lossless and lossy codecs? And is one better format better than the other or is it mostly relative?

**Tags:** video-quality, codec, file-formats


---

## 2 answers

### Answer by username_1 on 2021-04-26. Score: 1

If you imagine you have a video signal, and you want to capture all of it.. Let's say it is 1920x1080 at 25fps. You can store all the information about every pixel at full colour depth on every frame. This would be lossless - you could full recreate the signal upon playback, and it would be identical to the original that you captured.

The downside of this process is that the files would be extremely large, and you may require relatively powerful hardware to successfully playback the signal successfully without dropping any frames.

So you may compress the signal or file instead in a number of different ways: You might look at each frame, and try to spot areas where there isn't much detail (such as in an out-of-foucus background). Instead of storing every pixel in this area of the frame, you could say "these twenty pixels are all about the same shade of blue). The frame you have stored would take up less space on your computer, but when you come to recreate the frame upon playback, it would no longer be identical to the original.

Now you could also do this over time - this is called [inter-frame compression](https://en.wikipedia.org/wiki/Inter_frame). So you can look at a number of frames over time, and spot where there is little variation in the image - and only record information where there is a significant change.

All of this involves working from a model of "perception" - what can the eye-brain combination see? How clearly can it tell when something has been data reduced?

Lossy formats can store the same video at much smaller file sizes. Or - another way to look at it - with a given amount of bandwidth, you can transmit a much higher quality video if it is compressed than if it was transmitted as a lossless format.

Recreating video from a lossy format also has performance overheads. So for a given system, you may find a codec that plays back well on one system performs very badly on another.

In general, most video files delivered on the internet to consumers are lossy. This is for the reason mentioned earlier - you can deliver a perceptably "better" looking file using a lossy codec faster, than you could if the file was lossless. So final deliveries to website such as YouTube etc are usually in a lossy format such as h264.

During the production process, this is not the case. If your camera can export it, and you have a fast enough computer, with enough storage space, you may want to use lossless formats for editing, or at least formats which don't use any inter-frame compression. This is so that your computer doesn't need to "rebuild" frames that don't exist when you are scrubbing through your edit. Each frame in a format like ProRes is fully described, even though there is still some data compression in the way the colour of each pixel is described.

Lossless and lossy formats both have their place. They're both useful tools when used in the right part of the production process.


---

### Answer by username_2 on 2021-04-29. Score: 0

Just to add a little detail to t @username_1's excelent answer: a 1920×1080 image comprises 2,073,600 pixels. To capture this in a way that includes all the visual information that you could see with your naked eye would require *at least* 14 stops of dynamic range, which translates to 3 channels of 14-bit colour (the three channels are the RGB components, or more usually the YUV components, and since an ƒ-stop is a doubling of the light levels, and because each bit you add to the end a binary number doubles it, 14 stops = 14 bits). So that's 42 bits of colour information, per pixel, per frame, or 2,073,600×42 = 87,091,200 bits per frame or roughly 10 Mb. Multiply that by the number of frames per second, e.g. 25 and you need ≈ 250 Mb/s to represent the image. Every minute will require 15Gb of storage. It's pretty easy to see that compression is going to be necessary.

There are lossless compression codecs that work by removing redundancy in the bits recorded, similar to the way you can zip a file on your computer to reduce the size, but still get back an identical copy when you unzip it. Most lossless compression uses this kind of compression scheme, particularly because a video stream usually has a lot of redundancy. They're nowhere near as efficient as lossy algorithms, but what you get out will be exactly the same as what you put in.

Whether any codec is *better* than another depends on a few factors, including:

* fidelity—how accurate the output is compared to the input
* data rate and efficiency—how much data it requires to record the video
* speed—how quick it is to encode / decode frames
* complexity—how much processing power is required to encode / decode the codec
* robustness—how well the codec deals with missing or corrupted data during transmission, e.g. digital terrestrial television broadcast
* availability—whether the codec is commonly available, whether it is free to use, also whether the format is open or closed source
* compatibility—with container formats—some codecs only work in quicktime .mov or .avi containers, and with playback technology, e.g. does it play in browsers


---

