Log in

View Full Version : Could someone explain colorspaces to me?


jellysandwich
1st April 2006, 10:12
For a while now, I've noticed that my videos seemed a little bright during playback. After a bit of investigation, I found something interesting.

I did a short encode on one of my Kenshin DVDs using Vdubmod and Xvid. When I played it back using the default ffdshow settings with MPC, I got this:

http://s92800548.onlinehome.us/js/k_yv12.PNG

When I modified the ffdshow settings so that only RGB32(ffdshow (http://s92800548.onlinehome.us/js/ffd.PNG)) was outputted, I got this:

http://s92800548.onlinehome.us/js/k_rgb32.PNG (notice how it's darker)

I've also noticed that this is what it looks like when I open up the d2v/avs in Vdubmod. Why do they look different? Is it due to differences between colorspaces, and is one of them the "correct" output?

Surprisingly, I couldn't find any good articles about this on google...

Edit: VLC outputs the non-brightened one too...

js

jellysandwich
7th April 2006, 18:50
Would this do better in another forum, like the AVS one? I found a ColorMatrix thread there which seems similar to this...

js

jel
10th April 2006, 00:42
hi jellysandwich,

moving to the avisynth usage forum

good luck
j

foxyshadis
10th April 2006, 02:28
Dammit, I had a whole long reply and accidentally backed out. I hate badly designed javascript sometimes.

Basically, YUV TV levels are 16-235 (because of the circuitry in old tvs), PC levels are 0-255, and when outputting both have to be converted to 0-255 RGB, but there's no way to signal which yours is so confusion abounds. Also video card makers sowed despair by randomly making different output modes, cards, and driver versions either do conversion or not. Nvidia finally settled on 16-235 conversion across the board in a recent driver, but the others haven't bothered. Generally, overlay gets converted while WMR7/9 do not.

The best way is to pick one (TV is more universal, it's what MPEG standards use, unless you use ATI and WMR), stick to it, and if you need to use another output mode, just add the appropriate coloryuv to your output.

Unconverted tv mode looks dull, with greyish blacks and dim whites. Converted PC looks blown out and black all over. (The former is tolerable while the latter is not, which is why cardmakers were so lazy about it.) You can tell which yours is by using histogram and finding a frame with white and black.

Colormatrix is something different; there are two standard formulae for rgb->yuv color conversion, and bt.601 (mpeg-1) is slightly different than bt.709 (mpeg-2), and colormatrix converts between the two (and iirc a few others). Most mpeg-4 players use bt.601. But this isn't hard and fast, all have exceptions. If you decode 709 as 601, colors are a little duller (not nears as much as the uncorrected TV levels above) and just slightly off. It's a good idea to use it on most DVD/HDTV rips, unless you're going back to DVD; to find out for sure, follow wilbert's advice (http://forum.doom9.org/showthread.php?p=596993#post596993).

Jeremy Duncan
10th April 2006, 08:09
I use this Brightness pattern to calibrate the Brightness on my CRT.
The brightness in the Movie Serenity is just barely not Crushed.
No detail is lost due to it being to dark.

http://img85.imageshack.us/img85/1266/17jx.gif

I know this uses 0-255 levels, not 16-235.
But it works on my Monitor.
Why ?

:thanks:

foxyshadis
10th April 2006, 09:54
It's already in RGB, there's no need to convert anything. (If you import it into avisynth, it'll get squashed to 16-235 and then expanded again on output.)

Jeremy Duncan
10th April 2006, 10:05
So FFDShow converts the DVD to 16-235.

My Monitor is calibrated to that 0-255 Level though.
But even then the monitor is using 16-235 because of FFDShow ?

Edit.
I'm not using Avisynth in FFDShow right now.
Is FFDShow still converting the colorspace to 16-235 ?

foxyshadis
10th April 2006, 10:17
huh? I'm not following you, I think you left a few things out of your question.

DVDs are already in 16-235. FFDshow will convert it back if you output RGB mode, otherwise it'll leave it as-is and pass it on to the video driver.

Jeremy Duncan
10th April 2006, 11:08
I've calibrated my Monitor using that brightness test pattern.
It's 0-255 level, not 16-235 video level.

Would a dvd force my crt monitor to only display 16-235 levels ?
I've calibrated the monitor using the buttons on the crt and the osd.

foxyshadis
10th April 2006, 12:20
No, once you calibrate your monitor you're good to go. YUV conversion doesn't affect that. (Almost all dvd players use overlay, so they never have conversion issues. Tweaking the settings could easily cause a dvd to be displayed incorrectly though.)

jellysandwich
17th April 2006, 18:57
Dammit, I had a whole long reply and accidentally backed out. I hate badly designed javascript sometimes.

Basically, YUV TV levels are 16-235 (because of the circuitry in old tvs), PC levels are 0-255, and when outputting both have to be converted to 0-255 RGB, but there's no way to signal which yours is so confusion abounds. Also video card makers sowed despair by randomly making different output modes, cards, and driver versions either do conversion or not. Nvidia finally settled on 16-235 conversion across the board in a recent driver, but the others haven't bothered. Generally, overlay gets converted while WMR7/9 do not.

The best way is to pick one (TV is more universal, it's what MPEG standards use, unless you use ATI and WMR), stick to it, and if you need to use another output mode, just add the appropriate coloryuv to your output.

Unconverted tv mode looks dull, with greyish blacks and dim whites. Converted PC looks blown out and black all over. (The former is tolerable while the latter is not, which is why cardmakers were so lazy about it.) You can tell which yours is by using histogram and finding a frame with white and black.


Ok, after a week or rereading this countless times, I think I understand it a bit better, but am still not entirely sure.

So first image I posted is the unconverted TV (http://s92800548.onlinehome.us/js/k_yv12.PNG), and the second image is the converted PC (http://s92800548.onlinehome.us/js/k_rgb32.PNG)? I don't really know what you mean by blown out and black all over... I used the histogram function in avisynth, and got a graph like this (http://www.avisynth.org/wilbert/pics/histogram_modelevels.jpg). That means that it's uncoverted TV right?

When you say pick one, you mean outputting unconverted TV or PC?

Colormatrix is something different; there are two standard formulae for rgb->yuv color conversion, and bt.601 (mpeg-1) is slightly different than bt.709 (mpeg-2), and colormatrix converts between the two (and iirc a few others). Most mpeg-4 players use bt.601. But this isn't hard and fast, all have exceptions. If you decode 709 as 601, colors are a little duller (not nears as much as the uncorrected TV levels above) and just slightly off. It's a good idea to use it on most DVD/HDTV rips, unless you're going back to DVD; to find out for sure, follow wilbert's advice (http://forum.doom9.org/showthread.php?p=596993#post596993).

Wilbert said that it's for TMPGEnc/CCE using AviSynth or VirtualDub. So if I use x264 CLI, I don't need to worry about it?

js

foxyshadis
17th April 2006, 20:04
Yep, all that is correct, except the colormatrix stuff is backwards. Roughly, DVD->DVD needs no correction, DVD->mpeg4 does (but it can depend on the source and destination). I should have used your first examples in my post, sorry.

(If you want to see blown out high and lowlights, pick a dark movie and do another coloryuv("tv->pc") on stuff that's already pc. Nothing left! :o "Blow out" is a photography jargon that means losing definition by doing that.)

jellysandwich
18th April 2006, 04:02
Ok, last questions.

(If you want to see blown out high and lowlights, pick a dark movie and do another coloryuv("tv->pc") on stuff that's already pc. Nothing left! "Blow out" is a photography jargon that means losing definition by doing that.)
What exactly do you mean by doing another coloryu()? I tried this:


mpeg2source("E:\kenshin\subs.d2v")
coloryuv(levels="tv->pc")
coloryuv(levels="tv->pc")
I can certainly see a difference, as shown through the following screenshots, but I'm not sure if that's what you meant.

0x coloryuv(levels="tv->pc") (http://whitevoid.be/files/cy0.png)
1x coloryuv(levels="tv->pc") (http://whitevoid.be/files/cy1.png)
2x coloryuv(levels="tv->pc") (http://whitevoid.be/files/cy2.png)

Also, I opened up my Kenshin vobs in GSpot, and all of the coefficient boxes were grayed out. According to Wilbert, that means that the default Rec. 709 was used. So does that mean I should indeed use ColorMatrix, and get this (http://whitevoid.be/files/kcm.png) ( vs the original (http://whitevoid.be/files/ko.png))?
mpeg2source("E:\kenshin\subs.d2v")
colormatrix(d2v="kenshin.d2v")

js