Answers.Body: <h1>How did they decide that?</h1>
  
  <p>To answer literally, I am the original author of that article and added the claim years ago that CRF ~18 is visually lossless (but not technically lossless like CRF 0). I got that information directly from the main x264 developer (Glaser aka Dark_Shikari) in the <em>#x264dev</em> IRC room, and it looked lossless to me.</p>
  
  <h3>Re-encoding: 0 vs 18</h3>
  
  <p>If you need an intermediate and/or temporary file for re-encoding, use <code>-crf 0</code> or some other lossless compressed format, such as UT video or FFv1, that works within your workflow. Might as well avoid any unnecessary compression artifacts and provide the best quality you can to your clients.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-28T23:56:09.817Z
Answers.LastActivityDate: 2019-05-28T23:56:09.817Z
Answers.UserDisplayName: llogan
Answers.Body: <p>In addition to &quot;visually lossless&quot;, there's the concept of &quot;visually almost lossless&quot;:</p>
  <ul>
  <li>&quot;Visually almost lossless&quot; is usually established by static side-by-side viewing. This is probably what the CRF is about, since it &quot;looks lossless&quot;. I believe Gyan's mention of &quot;scrutiniz[ing] in fine detail&quot; is about this one too.</li>
  <li>&quot;Visually lossless&quot; has a stricter requirement. It is established by a &quot;flicker&quot; test or a &quot;panning&quot; test. The former is the accepted standard under ISO/IEC 29170-2 written by the JPEG. The latter is a <a href="https://www.researchgate.net/publication/317425815_Large_Scale_Subjective_Evaluation_of_Display_Stream_Compression" rel="nofollow noreferrer">proposal for addition</a> used in an evaluation experiment for Display Stream Compression in DisplayPort. It is apparently more sensitive.</li>
  </ul>
  <p>Although both measures are inevitably subjective, humans do appear quite consistent with their judgements as <a href="https://www.researchgate.net/publication/317425815_Large_Scale_Subjective_Evaluation_of_Display_Stream_Compression" rel="nofollow noreferrer">the one large-scale experiment</a> shows.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-01T12:28:19.773Z
Answers.LastActivityDate: 2020-12-01T12:33:29.787Z
Answers.LastEditDate: 2020-12-01T12:33:29.787Z
Answers.UserDisplayName: Mingye Wang
Answers.Body: <p>Technically lossless, or real lossless, means that when the output is decoded by a conformant decoder, the result is mathematically identical to the input.</p>
  
  <p><a href="http://www.digitizationguidelines.gov/term.php?term=compressionvisuallylossless" rel="noreferrer">Visually lossless</a> is a non-rigorous term that indicates subjective transparency i.e. output which to the lay human eye looks indistinguishable from the original. The output may look different if a viewer scrutinizes it in fine detail, but not in normative viewing conditions. As to how 'visual-losslessness' is determinined: there are video quality metrics, like PSNR and SSIM, that provide a quantitative measure of the difference of an image with respect to a reference. Subjective opinion tests have been carried out to establish threshold values for these metrics that can be used to define 'visual losslessness'</p>
  
  <p>From <a href="https://www.researchgate.net/publication/257815643_Performance_Analysis_of_Visually_Lossless_Image_Compression" rel="noreferrer">Performance Analysis of Visually Lossless Image Compression</a>,</p>
  
  <blockquote>
    <p>Note  that  there  are  several  visual quality metrics (indices)
    such as MSSIM [6], PSNR-HVS-M  [7],  WSNR  [8]  and  some  others 
    that  are  able  to characterize  well  enough  quality  of  lossy 
    compressed images  [9].  Recently,  it  has  been  shown  for 
    grayscale images  [5]  that  it  is  enough  to  provide  MSSIM 
    values larger  than  0.985  or  PSNR-HVS-M  values  larger  than 40dB 
    in  order  to  guarantee  practically  invisibility  of distortions 
    in  lossy  compressed  images.</p>
  </blockquote>
  
  <hr>
  
  <p>As for re-encoding resilience, depends on what the goal of the re-encoding is. For viewing-only or casual re-editing purposes, CRF 18 in x264 should be fine. For professional re-editing, I would drop the CRF to, say, 12 or 14. Information, once lost, can't be perfectly recovered. But you can set your own standards by encoding at different CRFs and comparing manually. See <a href="https://video.stackexchange.com/a/17639">https://video.stackexchange.com/a/17639</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-24T20:59:24.157Z
Answers.Text: Are PSNR and SSIM consistent across codecs or just x264?
Answers.UserDisplayName: Hashim Aziz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-25T05:02:15.030Z
Answers.Text: These metrics compare decoded frames i.e. pixels, so the codec doesn't really matter.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-19T06:22:27.767Z
Answers.LastActivityDate: 2019-05-19T06:22:27.767Z
Answers.UserDisplayName: Gyan
Body: <p>In <a href="https://trac.ffmpeg.org/wiki/Encode/H.264" rel="nofollow noreferrer">FFmpeg's H.264 Video Encoding Guide</a> we are told: </p>
  
  <blockquote>
    <p>Tip: If you're looking for an output that is roughly "visually lossless" but not technically lossless, use a <code>-crf</code> value of around 17 or 18 (you'll have to experiment to see which value is acceptable for you). It will likely be indistinguishable from the source and not result in a huge, possibly incompatible file like true lossless mode.</p>
  </blockquote>
  
  <p>This raises some questions. The first and obvious one is "how did they decide that?" The important question is the one in the title. What's the literal difference and if I need to encode <em>from this output</em> later (e.g. I want to compress and archive old data), will a second encode on a crf 18 encoded file give me problems that a crf 0 encoded file wouldn't? </p>
  
Tags: <ffmpeg><compression><h.264>
Title: What's the difference between "visually lossless" and real lossless and what does this mean for future encodes?
UserDisplayName: user3643
ThreadText: # What's the difference between "visually lossless" and real lossless and what does this mean for future encodes?
  
  (Asked by: username_0 on 2019-05-18)
  
  In [FFmpeg's H.264 Video Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/H.264) we are told:
  
  > Tip: If you're looking for an output that is roughly "visually lossless" but not technically lossless, use a `-crf` value of around 17 or 18 (you'll have to experiment to see which value is acceptable for you). It will likely be indistinguishable from the source and not result in a huge, possibly incompatible file like true lossless mode.
  
  This raises some questions. The first and obvious one is "how did they decide that?" The important question is the one in the title. What's the literal difference and if I need to encode *from this output* later (e.g. I want to compress and archive old data), will a second encode on a crf 18 encoded file give me problems that a crf 0 encoded file wouldn't?
  
  **Tags:** ffmpeg, compression, h.264
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2019-05-19. Score: 8 | Accepted answer
  
  Technically lossless, or real lossless, means that when the output is decoded by a conformant decoder, the result is mathematically identical to the input.
  
  [Visually lossless](http://www.digitizationguidelines.gov/term.php?term=compressionvisuallylossless) is a non-rigorous term that indicates subjective transparency i.e. output which to the lay human eye looks indistinguishable from the original. The output may look different if a viewer scrutinizes it in fine detail, but not in normative viewing conditions. As to how 'visual-losslessness' is determinined: there are video quality metrics, like PSNR and SSIM, that provide a quantitative measure of the difference of an image with respect to a reference. Subjective opinion tests have been carried out to establish threshold values for these metrics that can be used to define 'visual losslessness'
  
  From [Performance Analysis of Visually Lossless Image Compression](https://www.researchgate.net/publication/257815643_Performance_Analysis_of_Visually_Lossless_Image_Compression),
  
  > Note that there are several visual quality metrics (indices)
  > such as MSSIM [6], PSNR-HVS-M [7], WSNR [8] and some others
  > that are able to characterize well enough quality of lossy
  > compressed images [9]. Recently, it has been shown for
  > grayscale images [5] that it is enough to provide MSSIM
  > values larger than 0.985 or PSNR-HVS-M values larger than 40dB
  > in order to guarantee practically invisibility of distortions
  > in lossy compressed images.
  
  ---
  
  As for re-encoding resilience, depends on what the goal of the re-encoding is. For viewing-only or casual re-editing purposes, CRF 18 in x264 should be fine. For professional re-editing, I would drop the CRF to, say, 12 or 14. Information, once lost, can't be perfectly recovered. But you can set your own standards by encoding at different CRFs and comparing manually. See <https://video.stackexchange.com/a/17639>
  
  > **Comments:**
  > **username_4**: Are PSNR and SSIM consistent across codecs or just x264?  
  > **username_3**: These metrics compare decoded frames i.e. pixels, so the codec doesn't really matter.  
  
  ---
  
  ### Answer by username_2 on 2020-12-01. Score: 3
  
  In addition to "visually lossless", there's the concept of "visually almost lossless":
  
  * "Visually almost lossless" is usually established by static side-by-side viewing. This is probably what the CRF is about, since it "looks lossless". I believe username_3's mention of "scrutiniz[ing] in fine detail" is about this one too.
  * "Visually lossless" has a stricter requirement. It is established by a "flicker" test or a "panning" test. The former is the accepted standard under ISO/IEC 29170-2 written by the JPEG. The latter is a [proposal for addition](https://www.researchgate.net/publication/317425815_Large_Scale_Subjective_Evaluation_of_Display_Stream_Compression) used in an evaluation experiment for Display Stream Compression in DisplayPort. It is apparently more sensitive.
  
  Although both measures are inevitably subjective, humans do appear quite consistent with their judgements as [the one large-scale experiment](https://www.researchgate.net/publication/317425815_Large_Scale_Subjective_Evaluation_of_Display_Stream_Compression) shows.
  
  
  ---
  
  ### Answer by username_1 on 2019-05-28. Score: 2
  
  # How did they decide that?
  
  To answer literally, I am the original author of that article and added the claim years ago that CRF ~18 is visually lossless (but not technically lossless like CRF 0). I got that information directly from the main x264 developer (Glaser aka Dark\_Shikari) in the *#x264dev* IRC room, and it looked lossless to me.
  
  ### Re-encoding: 0 vs 18
  
  If you need an intermediate and/or temporary file for re-encoding, use `-crf 0` or some other lossless compressed format, such as UT video or FFv1, that works within your workflow. Might as well avoid any unnecessary compression artifacts and provide the best quality you can to your clients.
  
  
  ---
  
  