<p>H.264 does support true lossless compression (see 'Lossless mode' on this <a href="http://www.avidemux.org/admWiki/doku.php?id=tutorial%3ah.264" rel="nofollow">page</a>). It seems that to avoid chroma format conversion, you need to encode using the Hi444PP profile, which accepts RGB pixels. However, a cursory search indicates that x264 doesn't support Hi444PP (yet), whereas some commercial codecs like MainConcept do.</p>

CC BY-SA 3.0
2015-11-05T09:20:00.693Z
That page you report says something different, h264 lossless exists using an option like -qp 0 and also h264rgb could be achieved for example in libx264rgb. A question could arise: Do this kind of video compatible everywhere and played correctly? Depends, often no unless they support all the range of possible decoding, all softwares based on ffmpeg and ffshow can however, including VLC.
user3450548
CC BY-SA 3.0
2013-02-25T21:28:30.263Z
Seems like maybe a high bitrate would be a good alternative. Of course the OP has long since dealt with this problem one way or another by now.
Matt Browne
CC BY-SA 3.0
2012-02-19T13:56:35.093Z
2012-02-19T13:56:35.093Z
Gyan
<p>if you want yuv444p try something like this: &quot;-vcodec libx264 -pix_fmt yuv444p&quot;</p>
<p><a href="https://trac.ffmpeg.org/wiki/Encode/H.264#LosslessH.264" rel="nofollow noreferrer">LosslessH.264</a> seems to imply that lossless (or practically lossless) is available via -qp 0</p>

CC BY-SA 3.0
2015-01-09T01:53:52.263Z
just a note about yuv444p, it's not as widely supported as yuv420 so depending on what you're doing with the video *next*, this can cause issues (e.g. Apple Quicktime, iMovie, and devices can't handle yuv444)
drfrogsplat
CC BY-SA 3.0
2014-01-16T18:42:49.583Z
You can also use `-crf 0` with 8-bit builds of x264. The only reason `-qp` is used instead is because 10-bit builds of x264 uses different values for `-crf` (I believe `-crf -12` for 10-bit would be lossless) to achieve a similar visual quality.
llogan
CC BY-SA 4.0
2014-01-16T18:00:58.217Z
2023-03-29T17:07:07.703Z
2023-03-29T17:07:07.703Z
rogerdpack
<p>If you need something less complicated try rec, which is mine :)
<a href="https://sites.google.com/site/joopeter/" rel="nofollow">https://sites.google.com/site/joopeter/</a></p>

<p>It is also free, lossless but more efficient and accurate!</p>

CC BY-SA 3.0
2015-02-18T06:17:32.973Z
@Peter You could improve your answer by giving a little more detail about what rec is and how it works.
stib
CC BY-SA 3.0
2014-11-11T05:04:18.343Z
It works only on Windows
Display Name
CC BY-SA 3.0
2013-10-29T12:01:15.987Z
2013-10-29T12:01:15.987Z
Peter
<p>I'm trying to create a screencast for playback on the web. Would like to use h.264, webm, and ogg. The source files are in the Apple Animation codec, and they look perfectly accurate. However when I try to convert to mp4 using ffmpeg lossless settings, there is some definite degradation. It seems to be because the source is RGB and ffmpeg auto-selects yuv420p instead.</p>

<pre><code>Incompatible pixel format 'rgb24' for codec 'libx264', auto-selecting format 'yuv420p'
</code></pre>

<p>Anyone know how to get the same color accuracy with mp4/h.264 as with Apple Animation?</p>

<p>Thanks</p>

<ffmpeg><lossless>
creating a lossless mp4 screencast
ben
# creating a lossless mp4 screencast

(Asked by: username_0 on 2012-02-16)

I'm trying to create a screencast for playback on the web. Would like to use h.264, webm, and ogg. The source files are in the Apple Animation codec, and they look perfectly accurate. However when I try to convert to mp4 using ffmpeg lossless settings, there is some definite degradation. It seems to be because the source is RGB and ffmpeg auto-selects yuv420p instead.
Incompatible pixel format 'rgb24' for codec 'libx264', auto-selecting format 'yuv420p'

Anyone know how to get the same color accuracy with mp4/h.264 as with Apple Animation?
Thanks

**Tags:** ffmpeg, lossless


---

## 3 answers

### Answer by username_1 on 2012-02-19. Score: 4

H.264 does support true lossless compression (see 'Lossless mode' on this [page](http://www.avidemux.org/admWiki/doku.php?id=tutorial%3ah.264)). It seems that to avoid chroma format conversion, you need to encode using the Hi444PP profile, which accepts RGB pixels. However, a cursory search indicates that x264 doesn't support Hi444PP (yet), whereas some commercial codecs like MainConcept do.

> **Comments:**
> **username_3**: Seems like maybe a high bitrate would be a good alternative. Of course the OP has long since dealt with this problem one way or another by now.  
> **username_2**: That page you report says something different, h264 lossless exists using an option like -qp 0 and also h264rgb could be achieved for example in libx264rgb. A question could arise: Do this kind of video compatible everywhere and played correctly? Depends, often no unless they support all the range of possible decoding, all softwares based on ffmpeg and ffshow can however, including VLC.  

---

### Answer by username_4 on 2014-01-16. Score: 0

if you want yuv444p try something like this: "-vcodec libx264 -pix\_fmt yuv444p"

[LosslessH.264](https://trac.ffmpeg.org/wiki/Encode/H.264#LosslessH.264) seems to imply that lossless (or practically lossless) is available via -qp 0

> **Comments:**
> **username_6**: You can also use `-crf 0` with 8-bit builds of x264. The only reason `-qp` is used instead is because 10-bit builds of x264 uses different values for `-crf` (I believe `-crf -12` for 10-bit would be lossless) to achieve a similar visual quality.  
> **username_5**: just a note about yuv444p, it's not as widely supported as yuv420 so depending on what you're doing with the video *next*, this can cause issues (e.g. Apple Quicktime, iMovie, and devices can't handle yuv444)  

---

### Answer by username_7 on 2013-10-29. Score: 0

If you need something less complicated try rec, which is mine :)
<https://sites.google.com/site/joopeter/>

It is also free, lossless but more efficient and accurate!

> **Comments:**
> **username_9**: It works only on Windows  
> **username_8**: @username_7 You could improve your answer by giving a little more detail about what rec is and how it works.  

---

