I was re-encoding videos downloaded from YouTube with Lossless H.264 (using FFmpeg) because I'm experimenting with CRF=0.

I found that resulting videos are much bigger (1 gigabyte) than the original video (100 megabyte).

However, from my knowledge of lossy compression, it is basically like lossless compression (plus, it's the same codec) except it throws away lots of minor details that won't be noticed but take up lots of space. Hence, shouldn't I achieve a similar file size if I encode the decoded file using CRF=0 because lots of data are already thrown away? I don't quite understand this.

I use the following command:

ffmpeg -i 'file' -an -c:v libx264 -crf 0 'out file'

3 Answers 3


You have a fundamental misunderstanding of how lossy compression works. It doesn't throw away information so much as ignore the portions of the image that don't conform to the patterns it is looking for. It does care about small amounts of error, so it doesn't spend time to store them, however it still decodes to a complex video. The lossless compression doesn't use the same algorithms as the lossy, the shortcuts taken by the lossy algorithm can't be reused by the lossless one.

The lossy algorithm is optimized towards using patterns that will have minimal error with minimal data usage. Lossless algorithms are optimized towards minimizing the data required when not losing any data, so they work quite differently.


When data “thrown away” by the encoder, the decoder must still render a full image. The image is just not faithful to the original image, but it is a full image. When you reencode with CRF 0 you are telling the encoder, “I want the output to be identical to the input” and the encoder doesn’t know information was lost on a previous encode. so it must spend bits to encode the “new” image losslessly.

  • But since the new picture is less complex, shouldn't it take less space?
    – Joy Jin
    Jul 17, 2019 at 8:39
  • 2
    The new picture is not less complex
    – SlimSCSI
    Jul 17, 2019 at 14:15
  • Think of it this way. If you compress with a very low bitrate in the first pass, you get a lot of artifacts and blocking that was not in the original images. Compressing that a second time would attempt to preserve that blockyness. Every time you compress, the generational loss is amplified and preserved, not reduced.
    – SlimSCSI
    Jul 17, 2019 at 16:18

Maybe this helps you: We'll work with images, not video. It's a bit easyer. Imagine you have a 10x10 pixel image, every second pixel is whitenand every other is black. Now you lossy compress it, instead of storing black-white-black-white... It just stores "Display 100 Grey Pixels".

Now you open the image in your NLE and reencode it lossless, now it has a 10x10 pixel image that is grey, so it will store 100x "This Pixel is grey"

So instead of 1x "Display 100 Grey Pixels" in the beginning, you have 100x "Pixel is grey".

This is really really really simplified as even s lossless codec can store it just as 1x "Display 100 Grey Pixel"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.