View Full Version : Colorspace conversion question
Seraphic-
25th October 2009, 02:39
Is there a lossless way to go from:
YUY2/UYVY (Capture) to RGB (Editing) to YV12 (Encoding)
Thanks
Guest
25th October 2009, 02:41
Going YUY2 to YV12 necessarily discards half the vertical chroma information.
It's like asking can I put 8 bits into 4 bits losslessly?
Seraphic-
25th October 2009, 02:58
Yes, but what I was trying to get across was conversion outside the realm of the chroma information that is lost.
Also, I was trying get a better understand as to why these images differ so much in terms of color/black levels.
Top one is YUY2 and bottom is RGB. At first glance the YUY2 would look to be correct as the color is so much more brighter.
But when you compare the clouds from the YUY2 version, to the clouds in the RGB version, you see the RGB version is correct.
However, the RGB version has like a darken grayish color overlay to it. Could you explain why that is?
http://www.seraphicgate.com/extra/yuy2.jpg
http://www.seraphicgate.com/extra/rgb.jpg
poisondeathray
25th October 2009, 03:08
How was the conversion done? A straight conversion using avisynth won't shift the levels like that (unless you tell it to)
How did you take the screenshots?
What editor? Vegas? What settings used for project (in terms of 8-bit vs. 32-bit project, gamma, and video vs. pc levels?
Seraphic-
25th October 2009, 03:19
How was the conversion done? A straight conversion using avisynth won't shift the levels like that (unless you tell it to)
How did you take the screenshots?
What editor? Vegas? What settings used for project (in terms of 8-bit vs. 32-bit project, gamma, and video vs. pc levels?
I am using the Conopus HQ codec and conversion was done using EDIUS.
But I can also do the conversion in Vdub/avisynth.
The codec options are RGB has ITU-R BT.601 range (bottom image) or Convert RGB range [0,255] as IRE [0,100] (top image).
Screenshots were done in Vdub.
Also have an intensity card here, and captures done with it match the bottom image (rgb version).
So I guess that is how it is supposed to look. Just didn't understand why it had the darken overlay.
poisondeathray
25th October 2009, 03:27
You can open it up and look in a waveform monitor (or use videoscope in avisnth). Your rgb conversion just compressed the range (but kept the ends clamped), that's why it looks "darkened".
Here are 2 screenshots of the waveform. The 0 and 100 IRE correspond to 16-235, so you have a bunch of overshoots
http://www.mediafire.com/download.php?dxwjyzw01ez
Seraphic-
25th October 2009, 03:36
You can open it up and look in a waveform monitor (or use videoscope in avisnth). Your rgb conversion just compressed the range, that's why it looks "darkened".
Not sure how to use videoscrop, so I'll have to find a guide or something.
Do you have any suggestions on to do the rgb coversion so it does not compress the color range?
Also, here is an image of the raw file played in WMP.
As you can see, it most matches the YUY2 version, but does not have the over color saturation.
http://www.seraphicgate.com/extra/wmp.jpg
poisondeathray
25th October 2009, 03:45
^I edited my post above to include the waveforms
When you play it in a media player, there are a bunch of other variables, like the decoder, renderer (e.g. vmr9 vs. overlay etc...) that can render the final picture at different levels. So even though the underlying source is the same, it may appear different if you use different combinations. e.g. as a test play it in MPC, and use overlay mixer to play it. Then change it to vmr9, exit & restart and play it again - you will see a huge difference in the levels and the way it appears, even though the video is the same.
If you do a straight conversion in avisynth, it won't shift the levels (i.e. input=output)
So
WhateverSource()
ConvertToRGB()
However, your editing program may decompress the image using different levels (so even if you do the conversion in avisynth, it may change it again). This is why I asked you about the settings earlier. But you are using a different editor, and I'm not familiar with Edius, so someone else will have to help you with that
The whites are overshot in the yuy2 version, so compressing the dynamic range recovers more detail to the clouds in the rgb version, but at the expense of making it look "darkened". The same thing with the blacks (e.g. in the hair).
Seraphic-
25th October 2009, 05:16
Thanks for your help, poisondeathray.
Those waveforms are interesting. What problem did you use in order the view them?
I tried the straight conversion method you listed, but there is no change to the rgb image I posted.
Was not expecting to have this kind of issue. I'll have to see if there is a work around or something.
Thoughts from other people would be appreciated though.
Here is a sample video, if you are unable to open in Vdub, use the exe within the folder and installed the codec.
Also included a photoshop file that includes some more sample images. In this case the version played in WMP looks perfect.
But I was unable to get the converted file to match it. The yuy2/uyvy/ images are way off in color.
poisondeathray
25th October 2009, 06:17
I used vegas' waveform monitor, but all NLE's including Edius should have similar ones. You could use avisynth's videoscope() too, but that requires YUY2() input
Remember, edius might be doing something too (e.g. expanding or compressing luma range), as well how it's viewed in WMP isn't consistent (it depends on what directshow decoder is being used,and that may vary across different PC's). So I'm not sure what you are asking?
Seraphic-
25th October 2009, 06:35
Yeah, I believe it does. Was just asking what you used though.
I don't have any codec packs installed, so it's just based on what the codec/edius does on its own.
Wasn't really asking anything, was just including a sample video and the codec itself, in case you wanted to try the video on your end.
poisondeathray
25th October 2009, 06:39
I believe your issues are caused by canopus which forces the luma change, or a setting in edius which interprets the values differently
Was the video you uploaded the original capture? are you capturing with canopus too? If you view it as is, it is YUY2. If you use ConvertToRGB() the luma values don't shift i.e. input=output values.
What is the reason you are converting? Why can't you use the original input directly?
If you're finding the output from edius shifting, it might be due to a setting in edius (just like there are different levels and gamma settings in vegas for example)
Seraphic-
25th October 2009, 07:05
Yeah, there are two other settings within edius: White and Super White
They work out to be the same as RGB has ITU-R BT.601 range and Convert RGB range [0,255] as IRE [0,100]
Tried both just now and results just about match the first and second image I posted.
In "White" RGB black (0,0,0) translates to ITU-R BT.601 "safe" black and RGB white (255,255,255) translates to ITU-R BT.601 "safe" white.
In "Super White" RGB black translates to super-black, and white translates to super-white.
If your RGB images have already been compensated for broadcast with ranges 16,16,16-235,235,235 then you should use it in Super White mode, otherwise your blacks will turn muddy and whites will turn gray.
If your RGB images are normal, then use White to ensure that black and white ends up in the safe range.
If you use Super White, your blacks will become super-black and whites will be super-white and things will be out of safe range.
And yes, that was the original file. You saying you tried ConvertToRGB() and it didn't have the darken overlay?
poisondeathray
25th October 2009, 07:10
You saying you tried ConvertToRGB() and it didn't have the darken overlay?
Yes , when viewed in avsp or vdub as the avs script. There is no shift or "darken overlay" (ie. input=output levels). So the changes are likely caused by something later in the chain of events (ie. edius or encoding to canopus)
Seraphic-
25th October 2009, 07:14
Did you have to install the codec from the folder I included in the .rar file in order to open/view the video?
Also, that file was a Canopus HQ file. Could you post a screen capture please?
poisondeathray
25th October 2009, 07:21
Nope, I already had it installed.
I took screenshots of the AVI file you uploaded in avsp. "Original" is the YUY2 original with just AVISource. The other is converted to RGB using ConvertToRGB
http://www.mediafire.com/download.php?dmt5ztldyzn
Remember this is a video game capture, so it has 0-255 RGB levels or "PC" levels. Most editors assume "video levels" or 16-235, as if taken from video cameras and camcorders. You usually have to change the default settings in your editor
Seraphic-
25th October 2009, 07:25
Ah, yeah, they do match.
But they are still incorrect, as the whites are too bright.
By the way, that video I uploaded was in Super White mode.
White mode, displays as the "darker" version we have seen here.
Seems to be no middle ground or way to get correct levels as of yet.
It's late though, thanks for your help.
I'll pick this up again tomorrow.
poisondeathray
25th October 2009, 07:27
Yes, the whites are too bright and darks are too dark. You can see that in the waveform monitor.
You can correct them to whatever you want in the editor. Thats what the "levels" filter is for... all NLE's have them.
Seraphic-
25th October 2009, 07:32
Yes, but was trying to get the levels correct without having to use such a filter.
When I said seems to be no way to correct levels, I meant using the settings in edius or the codec itself.
poisondeathray
25th October 2009, 07:41
Yes, but what is your intended target? It should be scaled to TV levels if you are watching on a TV. And again, it depends on how the decoder, renderer on the target machine is configured. If they expand to full range it will look different than if it was set to scale to TV... etc... etc... There are many variables that can go into how it ends up looking
To help you understand better what's going on, I included 2 more screenshots with videoscope readout attached. The first is "normal" which is just AVIsource(). Notice how it's full range which is normal for a PC game capture, but there are blown out details (e.g. the cloud detail). The other is converted to TV Levels using Levels(0, 1, 255, 16, 235, coring=false) , but the detail in the whites and blacks are more clear, at the expense of the dynamic range (less vibrant).
http://www.mediafire.com/download.php?jqdzmyfvnyd
I am willing to bet edius has settings for this stuff (project settings), that let you to interpret levels , but it probably also has a level filter as well
Seraphic-
25th October 2009, 08:00
Well, my content will be played back on computers and consoles (both which can use T.V and/or Monitor).
Just started really using Edius, so I'm sure you are right in that it has these filters, etc.
I'll take a look tomorrow. Hopefully I can get the levels to be correct.
Seraphic-
28th October 2009, 06:43
Here are some samples I messed around with.
First Image - Default
Second Image - Light White Balance
Third Image - High White Balance
Forth Image - Light Black, Grey, and White Balance
I tested the game directly on my monitor and the clouds aren't fully visible there either.
They seem match what would best be described as image two as best I could tell (no way to view them side by side really to tell for sure).
Image four doesn't look too bad as well, as it adds a little extra color pop, but maybe too much vs what I saw on monitor.
http://www.seraphicgate.com/extra/df.jpg
http://www.seraphicgate.com/extra/halfwb.jpg
http://www.seraphicgate.com/extra/maxwb.jpg
http://www.seraphicgate.com/extra/bgw.jpg
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.