<p>In order to test a lossless recording system, I have to verify that the input video is exactly the same than the output video.
As a test source I have generated an ffmpeg's <a href="https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-haldclutsrc_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2" rel="nofollow noreferrer">testsrc</a> pattern, which is really nice by the way.
It makes such pictures, for those who don't know: <a href="https://i.sstatic.net/0laHY.jpg" rel="nofollow noreferrer">https://i.sstatic.net/0laHY.jpg</a>
<a href="https://i.sstatic.net/0laHY.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0laHY.jpg" alt="enter image description here"></a></p>

<p>When I play this video with <a href="https://mpc-hc.org/" rel="nofollow noreferrer">MPC-HC</a> and I make print screen, I could see that the Reg, Green and Blue color bars are not as expected:</p>

<p><code>
    Player          |  Red (R, G, B)  | Green (R, G, B) |  Blue (R, G, B) |
MPH-HC (Gamma 2.20) | (255,  17,   0) | (  0, 216,   0) | (  0,   6, 255) |
MPH-HC (Gamma 2.35) | (255,  13,   0) | (  0, 213,   0) | (  0,   4, 255) |
MPH-HC (Gamma 2.40) | (255,  12,   0) | (  0, 213,   0) | (  0,   4, 255) |
  ffplay            | (235,  15,  14) | ( 14, 237,  14) | ( 16,  15, 239) |
  ffmpeg -&gt; .bmp    | (255,   0,   0) | (  0, 255,   0) | (  0,   0, 255) |
</code></p>

<p><strong>Note:</strong> To get the (R, G, B) value I did a print screen and paste into MS Paint. Then I use the color picker tool.</p>

<p>I can explain the ffplay value, it's due to TV levels [16..235] instead of PC level [0..255]. After having googled how to configure ffplay so as to output PC levels I didn't find any possibilities.</p>

<p>I can explain the variation of the color bars when I use different value of gamma in MPC-HC. As a software developer I have modified MPC-HC source code to play with other values of gamma. I couldn't find a value of gamma that doesn't alter the color. A lower value will increase the quantity of Green in the Red and Blue color bars. A higher value will decrease the quantity of Green in the Red and Blue color bars, but it will also decrease the quantity of green in the Green bar! So my conclusion is that it doesn't come from the gamma correction.</p>

<p>I've generated a 3840 x 2160 video, so the color are in BT.709 space. When I play with MPC-HC I confirm the BT.709 is used.</p>

<p>Does anyone have an idea where it may come from?</p>

CC BY-SA 3.0
2016-06-21T13:15:07.420Z
What command are you using to generate the file you play in MPC-HC?
Gyan
CC BY-SA 3.0
2016-06-21T13:15:25.107Z
To generate full-range using ffplay: `ffplay -f lavfi -i testsrc -vf scale=dst_range=1`
Gyan
CC BY-SA 3.0
2016-06-21T13:30:46.543Z
@Mulvya the command to generate the file is `ffmpeg -f lavfi -i testsrc=duration=60:size=38400x2160:rate=60 testsrc.mp4`
RawBean
CC BY-SA 3.0
2016-06-21T13:37:56.307Z
That's not a lossless encoding. Try `ffmpeg -f lavfi -i testsrc=duration=60:size=3840x2160:rate=60 -crf 0 -c:v libx264rgb testsrc.mp4`
Gyan
CC BY-SA 3.0
2016-06-21T13:50:37.557Z
Finally, what I needed is a source in full range. So MPC-HC is perfectly playing without altering the colors. The ffmpeg command I used is `ffmpeg -f lavfi -i testsrc=duration=60:size=3840x2160:rate=60 -crf 0 -c:v libx264rgb -vf scale=dst_range=1 testsrc.mp4` it works perfectly! Thanks a lot @Mulvya for your great support. By the way, Is always -crf 0 doing lossless like -qp 0 does?
RawBean
CC BY-SA 3.0
2016-06-21T14:02:29.683Z
Yes, crf 0 is lossless.
Gyan
<ffmpeg><encoding><h.264><colorspace>
MPC-HC is altering the colors
RawBean
# MPC-HC is altering the colors

(Asked by: username_0 on 2016-06-21)

In order to test a lossless recording system, I have to verify that the input video is exactly the same than the output video.
As a test source I have generated an ffmpeg's [testsrc](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-haldclutsrc_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2) pattern, which is really nice by the way.
It makes such pictures, for those who don't know: <https://i.sstatic.net/0laHY.jpg>
[![enter image description here](https://i.sstatic.net/0laHY.jpg)](https://i.sstatic.net/0laHY.jpg)

When I play this video with [MPC-HC](https://mpc-hc.org/) and I make print screen, I could see that the Reg, Green and Blue color bars are not as expected:

`Player | Red (R, G, B) | Green (R, G, B) | Blue (R, G, B) |
MPH-HC (Gamma 2.20) | (255, 17, 0) | ( 0, 216, 0) | ( 0, 6, 255) |
MPH-HC (Gamma 2.35) | (255, 13, 0) | ( 0, 213, 0) | ( 0, 4, 255) |
MPH-HC (Gamma 2.40) | (255, 12, 0) | ( 0, 213, 0) | ( 0, 4, 255) |
ffplay | (235, 15, 14) | ( 14, 237, 14) | ( 16, 15, 239) |
ffmpeg -> .bmp | (255, 0, 0) | ( 0, 255, 0) | ( 0, 0, 255) |`

**Note:** To get the (R, G, B) value I did a print screen and paste into MS Paint. Then I use the color picker tool.

I can explain the ffplay value, it's due to TV levels [16..235] instead of PC level [0..255]. After having googled how to configure ffplay so as to output PC levels I didn't find any possibilities.

I can explain the variation of the color bars when I use different value of gamma in MPC-HC. As a software developer I have modified MPC-HC source code to play with other values of gamma. I couldn't find a value of gamma that doesn't alter the color. A lower value will increase the quantity of Green in the Red and Blue color bars. A higher value will decrease the quantity of Green in the Red and Blue color bars, but it will also decrease the quantity of green in the Green bar! So my conclusion is that it doesn't come from the gamma correction.

I've generated a 3840 x 2160 video, so the color are in BT.709 space. When I play with MPC-HC I confirm the BT.709 is used.

Does anyone have an idea where it may come from?

**Tags:** ffmpeg, encoding, h.264, colorspace

> **Comments:**
> **username_1**: What command are you using to generate the file you play in MPC-HC?  
> **username_1**: To generate full-range using ffplay: `ffplay -f lavfi -i testsrc -vf scale=dst_range=1`  
> **username_0**: @Mulvya the command to generate the file is `ffmpeg -f lavfi -i testsrc=duration=60:size=38400x2160:rate=60 testsrc.mp4`  
> **username_1**: That's not a lossless encoding. Try `ffmpeg -f lavfi -i testsrc=duration=60:size=3840x2160:rate=60 -crf 0 -c:v libx264rgb testsrc.mp4`  
> **username_0**: Finally, what I needed is a source in full range. So MPC-HC is perfectly playing without altering the colors. The ffmpeg command I used is `ffmpeg -f lavfi -i testsrc=duration=60:size=3840x2160:rate=60 -crf 0 -c:v libx264rgb -vf scale=dst_range=1 testsrc.mp4` it works perfectly! Thanks a lot @Mulvya for your great support. By the way, Is always -crf 0 doing lossless like -qp 0 does?  
> **username_1**: Yes, crf 0 is lossless.  

---

## 0 answers

