Answers.Body: <p>A lossless codec that can read/write yuv 4:2:0 samples is logically like zip for the bytes of video data.  You get literally identical (same md5 hash, byte-for-byte identical) output back after decompressing.  That is the definition of lossless.</p>
  
  <p>See my answer to <a href="https://superuser.com/questions/347433/how-to-create-an-uncompressed-avi-from-a-series-of-1000s-of-png-images-using-ff/864520#864520">https://superuser.com/questions/347433/how-to-create-an-uncompressed-avi-from-a-series-of-1000s-of-png-images-using-ff/864520#864520</a> for an example of compressing and then verifying losslessness with ffmpeg.</p>
  
  <p>We all know converting between RGB and YUV is lossy, but even upsampling the chroma and then downsampling again is not necessarily lossless.  <a href="http://forum.videohelp.com/threads/318382-Lagarith-or-x264-lossless?s=e30331c6a8beff0a6fe69b460f6388cb&amp;p=1972486&amp;viewfull=1#post1972486" rel="nofollow noreferrer">Here's a post</a> in a discussion about the lossyness of storing 4:2:0 video by upsampling to 4:2:2 for huffyuv.  Depending on the upsampling algorithm, downsampling again might round differently in the last bit.  (jagabo on that forum knows what he's talking about, not everyone else does.)</p>
  
  <p>So use <code>libx264 -qp 0 -preset ultrafast</code>, or <code>utvideo</code> for lossless tmp files, if you don't have a raid array of scratch space for uncompressed temporary files.  They both support all relevant pixel formats (rgb, 444, 422, and 420), and are fast.  IDK about higher bit-depth support in utvideo, but x264 does support it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-15T09:16:12.313Z
Answers.LastActivityDate: 2015-01-15T09:16:12.313Z
Answers.LastEditDate: 2017-03-20T10:04:28.637Z
Answers.UserDisplayName: Peter Cordes
Answers.Body: <p>Probably no loss, but there is more to it than just YUV420. You can need to make sure the same ITU-R Recommendation is used (BT.601, BT.708 or maybe even 2020) In addition make sure the same color ranges is used (0-255 vs 16-235)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-03T21:17:33.880Z
Answers.LastActivityDate: 2015-01-08T05:23:54.167Z
Answers.LastEditDate: 2015-01-08T05:23:54.167Z
Answers.UserDisplayName: SlimSCSI
Answers.Body: <p>Some people could be more in depth about this, but my understanding is that it depends on how the color is compressed. Going to 4:4:4 would certainly be lossless, but not necessarily worth it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-15T08:56:27.550Z
Answers.Text: Converting to 4:4:4 and back to 4:2:0 could actually introduce rounding errors.
Answers.UserDisplayName: Peter Cordes
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-03T20:54:32.747Z
Answers.LastActivityDate: 2015-01-03T20:54:32.747Z
Answers.UserDisplayName: KC McLaughlin
Body: <p>I have a video that is stored in the YUV 4:2:0 colour space. Assuming I used a lossless video codec but set the output colour space to YUV 4:2:0, would this still be a lossless encode or would I have to use a 4:4:4 colour space to make the encode lossless?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-03T21:33:12.737Z
Comments.Text: Would it help as a test to do the re-encode, then compare the file sizes from the original to the new? If there's no change, then is it probably lossless?
Comments.UserDisplayName: tomh
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-04T18:07:53.767Z
Comments.Text: @Tomh - not necessarily, lossless compression algorithms have different levels of efficiency.  The file size could go up and not be lossless and it could go down and still be lossless.
Comments.UserDisplayName: AJ Henderson
Tags: <encoding>
Title: Is reencoding a YUV 4:2:0 video in a 4:2:0 colour space lossless?
UserDisplayName: Adam Chance
ThreadText: # Is reencoding a YUV 4:2:0 video in a 4:2:0 colour space lossless?
  
  (Asked by: username_0 on 2015-01-03)
  
  I have a video that is stored in the YUV 4:2:0 colour space. Assuming I used a lossless video codec but set the output colour space to YUV 4:2:0, would this still be a lossless encode or would I have to use a 4:4:4 colour space to make the encode lossless?
  
  **Tags:** encoding
  
  > **Comments:**
  > **username_1**: Would it help as a test to do the re-encode, then compare the file sizes from the original to the new? If there's no change, then is it probably lossless?  
  > **username_2**: @username_1 - not necessarily, lossless compression algorithms have different levels of efficiency.  The file size could go up and not be lossless and it could go down and still be lossless.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2015-01-15. Score: 2
  
  A lossless codec that can read/write yuv 4:2:0 samples is logically like zip for the bytes of video data. You get literally identical (same md5 hash, byte-for-byte identical) output back after decompressing. That is the definition of lossless.
  
  See my answer to <https://superuser.com/questions/347433/how-to-create-an-uncompressed-avi-from-a-series-of-1000s-of-png-images-using-ff/864520#864520> for an example of compressing and then verifying losslessness with ffmpeg.
  
  We all know converting between RGB and YUV is lossy, but even upsampling the chroma and then downsampling again is not necessarily lossless. [Here's a post](http://forum.videohelp.com/threads/318382-Lagarith-or-x264-lossless?s=e30331c6a8beff0a6fe69b460f6388cb&p=1972486&viewfull=1#post1972486) in a discussion about the lossyness of storing 4:2:0 video by upsampling to 4:2:2 for huffyuv. Depending on the upsampling algorithm, downsampling again might round differently in the last bit. (jagabo on that forum knows what he's talking about, not everyone else does.)
  
  So use `libx264 -qp 0 -preset ultrafast`, or `utvideo` for lossless tmp files, if you don't have a raid array of scratch space for uncompressed temporary files. They both support all relevant pixel formats (rgb, 444, 422, and 420), and are fast. IDK about higher bit-depth support in utvideo, but x264 does support it.
  
  
  ---
  
  ### Answer by username_4 on 2015-01-03. Score: 1
  
  Probably no loss, but there is more to it than just YUV420. You can need to make sure the same ITU-R Recommendation is used (BT.601, BT.708 or maybe even 2020) In addition make sure the same color ranges is used (0-255 vs 16-235)
  
  
  ---
  
  ### Answer by username_5 on 2015-01-03. Score: 0
  
  Some people could be more in depth about this, but my understanding is that it depends on how the color is compressed. Going to 4:4:4 would certainly be lossless, but not necessarily worth it.
  
  > **Comments:**
  > **username_3**: Converting to 4:4:4 and back to 4:2:0 could actually introduce rounding errors.  
  
  ---
  
  