Page 1 of 2

Inaccurate colors (YUV>RGB color conversion issue)

Posted: 06 Nov 2018, 12:49
by abolibibelot
Hi,
Doing extensive tests and comparing all the thumbnails previews generating utilities I could find, I noticed that most of them fail to respect the colors of 720p+ footage, most likely because they use the Bt.601 matrix instead of the Bt.709 when converting YUV to RGB. Video Thumbnails Maker has that issue. The only tool in my tests which natively preserved the accurate colors is SMPlayer, but it doesn't offer much in terms of customizing options, and doesn't allow to batch-process an entire directory. I managed to tweak VCSI, a python script, by adding a bt.709 switch in its ffmpeg calls, it works fine, but is significantly slower than VTM. So is there any way with the current version of VTM of adding such a switch, perhaps from the command line ? Or if not, could it be implemented in a future revision ?
Thanks.

Image
SMPlayer
Image
Scorp MTN, the greens are “flashier”, the reds darker

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 10 Nov 2018, 00:35
by admin
Hi,

what engine did you use?
Please find the difference between Engine 1 and the others (Ultimate, Crystal and Engine 2) in sense of color space.

Meanwhile I will have a look into Bt.601 and Bt.709. The difference looks almost negligible. Never thought that is important.
Anyhow, I will check if I can improve the conversion.

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 11 Nov 2018, 11:08
by abolibibelot
what engine did you use?
Please find the difference between Engine 1 and the others (Ultimate, Crystal and Engine 2) in sense of color space.
Both the “Ultimate” and “Crystal” engines seem to produce the same result with regards to the color conversion. I couldn't get the other two engines to work with one of the files I have to inventory, which are hundreds of AVI files with the “GAVC” video codec and no audio (CCTV type of footage) ; I installed CCCP as advised, still not working.
But I could get them to work with a more conventional MP4/H.264 video, see below.
Meanwhile I will have a look into Bt.601 and Bt.709. The difference looks almost negligible. Never thought that is important.
Anyhow, I will check if I can improve the conversion.
The difference is quite conspicuous on all-red or all-green areas : on my sample pictures, look at the green sign on the upper left, and the red packages of cakes in the middle.

I made further tests with a personal video (1280x720 MP4 H.264, purposefully created with the Bt.709 color conversion matrix in an Avisynth script encoded with MeGUI, as advised on this VideoHelp thread), showing near the begining a still picture which I took of a red car, so I could accurately compare the screenshots with the original still picture. I found out that the colors were correct with “Engine 2” (at least with this particular 1280x720 video).
Doing that I also discovered a discrepancy in the way each engine interprets the timecodes when they are defined manually in the “specific time” field.

– Scorp Movie Thumbnails Maker, “Ultimate” module, specific time start 4s end 7s step 3s :
https://www.cjoint.com/c/HKlgyXi4ARL
=> The colors are wrong (see still picture below).

– Scorp Movie Thumbnails Maker, “Engine 2” module, specific time start 4s end 7s step 3s :
https://www.cjoint.com/c/HKlgA7e7N3L
=> With the same “specific time” parameters, it shows different frames, at 00:02 and 00:05 instead of 00:04 and 00:07 as requested. The colors are correct (the car's painting is displayed in the correct shade of red, the green leaves in the background are displayed in the correct shade of green).
Engine 1 shows the same frames (with the same parameters) but with shifted colors as above with “Ultimate”.

– Scorp Movie Thumbnails Maker, “Crystal” module, specific time start 4s end 7s step 3s :
https://www.cjoint.com/c/HKlgFgyvDwL
With the same “specific time” parameters, it shows different frames yet again (different from “Engine 1” / “Engine 2” and also from “Ultimate”), yet the timestamps are the same as with “Ultimate” (this is a portion of video showing still pictures in rapid succession, so even a slight discrepancy is clearly visible). I couldn't get the “Crystal” module to show the same tiles as the first test above (it would require a better precision than 1s in the “specific time” field, VCSI accepts milliseconds as input, allowing to set times very accurately, which was useful here since VCSI showed a different second image with a 1s granularity, i.e. with 00:00:07 or 00:00:08), but from the previous tests I made, I guess that the results would be the same as with “Ultimate” (i.e. wrong colors for Bt.709 “HD” footage).

– Scorp Movie Thumbnails Maker, “Engine 1” module, specific time start 5s end 8s step 3s :
https://www.cjoint.com/c/HKlgCKhiGbL
=> With different “specific time” parameters I could get the same tiles with “Engine 1” as with the first test using the “Ultimate” module (i.e. showing the same source still pictures, not necessarily the exact video frames) ; the colors are wrong.

– Scorp Movie Thumbnails Maker, “Engine 2” module, specific time start 5s end 8s step 3s :
https://www.cjoint.com/c/HKlgDTqDOQL
=> Same tiles as above (“Engine 1” and “Engine 2” seem to interpret the “specific time” parameters identically), but the colors are correct (again, search for the reds and greens).

– VCSI (tweaked by adding "-vf", "zscale=matrixin=709:matrix=709,format=rgb24", to each ffmpeg call in the script, this switch was suggested in this VideoHelp thread) with the parameters -g 2x1 (grid) -w 2560 (width) -m 0:00:05s,0:00:07.200 (manual timecodes) :
https://www.cjoint.com/c/HKlgGLgqBdL
=> The colors are correct.

– Original still picture of the red car for comparison (just resized by 50%, no shift in colors compared with the straight-out-of-camera original) :
https://www.cjoint.com/c/HKlgI5MWHaL


_____________________________________________

For clarity, I selected three of the pictures linked above to display directly at the end of this post :

– Scorp Video Thumbnails Maker “Ultimate” (wrong colors – same with “Engine 1” and probably “Crystal”) :
Image

– Scorp Video Thumbnails Maker “Engine 2” engine (correct colors) :
Image

– Tweaked VCSI script (correct colors – the native VCSI would show the wrong colors) :
Image

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 11 Nov 2018, 11:13
by abolibibelot
Now the question is : since I found out that the “Engine 2” module produces the expected result, how can I get that module to work with those “GAVC” videos which it currently fails to process ?

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 14 Nov 2018, 08:28
by abolibibelot
Another example of color shifting and timecodes shifting, from the movie “Inglorious basterds”.

Engine 2, layout 2x1, specific time start 2185 / step 4426:

Engine 2, layout 2x1, specific time start 2190 / step 4425:
=> On the right, the same frame is shown with a different displayed timecode.

Engine 2, layout 2x1, specific time start 2178 / step 4438:
=> With different settings, the two frames are identical as on the first picture, but the displayed timecodes are different.

Crystal, layout 2x1, specific time start 2185 / step 4426:
=> Same settings as the first picture (“Engine 2”, 2185 / 4426), different frames but same displayed timecodes.
=> Shifted colors (based on my previous tests, “Engine 2” most likely renders the colors correctly).

Crystal, layout 2x1, specific time start 2180 / step 4426:
=> Almost the same frame on the right obtained with different settings (could not get the exact same frames by trying other parameters).
=> Shifted colors (based on my previous tests, “Engine 2” most likely renders the colors correctly).

Ultimate, layout 2x1, specific time start 2180 / step 4426:
Ultimate, layout 2x1, specific time start 2179 / step 4426:
Ultimate, layout 2x1, specific time start 2178 / step 4426:
=> Three identical pictures obtained with different parameters, and different displayed timecodes.
=> Shifted colors (based on my previous tests, “Engine 2” most likely renders the colors correctly).

Sorry for the particular frames I chose for this test (!), but they're well suited to verify the color accuracy as they contain large plain red areas... Download the first and last pictures, or the third and last (showing the exact same frame on the right), and view them in rapid succession, by switching from one to the other and back : it should be obvious that the reds are significantly darker with the “Ultimate” module (and it would most likely look the same for the same frames with the “Crystal” and “Engine 1” modules) than with the “Engine 2” module. With plain green areas it should be the opposite : using Bt.601 instead of Bt.709 results in lighter shades of green (see examples in my previous posts).

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 15 Nov 2018, 21:12
by admin
Thank you for your research.
I know the issue with timestamps and will check what can I do for color shift issue.
At lease the next version should make changes in specific step behavior.

P.S. Regarding "GAVC” - please try to use 32-bit version of CCCP codec pack.

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 16 Nov 2018, 06:42
by abolibibelot
Thank you for the feedback.
I managed to get the “Engine 2” module working with those 1920x1080 GAVC files, after installing the specific codec found here, but with those files the colors are the same (i.e. wrong) using all 4 modules, it's quite puzzling... I'll try with CCCP 32 bits then, but I'll be surprised (again) if the outcome is different.

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 19 Nov 2018, 11:18
by abolibibelot
I tried with CCCP 32 bits, and now it does work as expected, with the correct colors.
At first it made VTM crash, then I checked the "AVI" box under "LAV Splitter" in "LAV Splitter Settings", then it worked without issue.

The colors are correct, and the levels seem to be correct too. In the previous tests, the screenshots were converted (if I understand this correctly) in limited range 16-235 RGB, which gave them a slightly dull, “washed-out” aspect ; with this configuration the levels are expanded to full range 0-255 RGB, preserving the contrast. In a future revision, there should be an option to switch between limited range 16-235 and full range 0-255, and another to switch between Bt.601 / Bt.709 / Bt.2020 (see this VideoHelp thread I mentioned earlier, regarding the color accuracy of video screenshots, and that one on the specific issue of thumbnails previews generating tools).
Only other difference is that with the GeoVision codec the proprietary timestamps and metadata are displayed on the screenshots.
When compared with the other video rendering modules, it seems like the internal ones (“Crystal” / “Ultimate”) are more tolerant with corrupted videos (those videos I'm processing have been deleted then recovered, some of them are partially or totally overwritten, “Ultimate” generates a preview for some of the partially overwritten ones while “Engine 2” fails).

Scorp VTM + “engine 2” with GeoVision codec
Image
Scorp VTM + “engine 2” module with CCCP 32 bits
Image

Another small criticism : it is not possible to resize the window. Any specific reason for this ?

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 01 Dec 2018, 23:36
by admin
Ok, I managed to get some results on the issue.

Could you please share a short video file and I will provide results form test version to you for a check.

Re: Inaccurate colors (YUV>RGB color conversion issue)

Posted: 02 Dec 2018, 22:38
by admin
VTM version 12.1.0.0 is released.
Give it a try ;)

Ultimate and Crystal engines should produce correct images.