Log in

View Full Version : x264 wrong colour from original??


Nosmas
5th September 2011, 12:47
Hi,

I have encoded an anime but the colour looks a bit different from original VOB.

I thought it is the resizer problem but it is not..
The weird part is, if I choose RGB32 as the colourspace in ffdshow then the colour looks closer to the original... I don't know why....

I used 10 bit to encode but I don't think that's the problem...

x264-YUV:
http://img696.imageshack.us/img696/7955/123mp4snapshot015720110.png

x264-RGB32:
http://img11.imageshack.us/img11/4444/123mp4snapshot015620110.png

original:
http://img831.imageshack.us/img831/8422/vts011vobsnapshot005820.png

sneaker_ger
5th September 2011, 13:01
10 bit (or rather the necessary conversions) may be the problem, read this and all posts following:
http://forum.doom9.org/showthread.php?p=1517382#post1517382

J_Darnley
5th September 2011, 14:10
That is caused by using the wrong colour matrix. Forcing ffdshow to do the yuv->rgb conversion seems to use the right one.

sneaker_ger
5th September 2011, 14:46
Hmm... when the chain is 10 bit -> 8 bit -> RGB, then indeed the wrong matrix sounds like the correct answer. (Can't really compare the screenshots, as they have not been taken at the same point in time.)
Or even both problems combined?

hello_hello
5th September 2011, 14:49
If you're upscaling then you need to convert from standard definition to high definition colorimetry. You also need to convert when downscaling from HD to SD.

Forcing ffdshow to convert to RGB might fix the problem because it's got to choose a colorimetry when converting to RBG, but the choice is based on resolution, so depending on the input/output resolution it may not be the correct one (if ffdshow isn't doing the resizing for example).

If you want to avoid the ffdshow, RGB conversion while knowing the colorimetry will be correct, use the colormatrix plugin. http://avisynth.org.ru/docs/english/externalfilters/colormatrix.htm
You can enable the ffdshow AviSynth filter and add the appropriate color conversion to it, or you can add it to an AviSynth script manually etc. (when you installed ffdshow I think you also needed to have ticked the option to install ffdshow's AviSynth plugin for the ffdshow AviSynth filter to work).

This is what I add to the ffdshow AviSynth filter for upscaling (as you are):

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ColorMatrix.dll")
ColorMatrix(mode="Rec.601->Rec.709")

For HD to SD, it's the other way around:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ColorMatrix.dll")
ColorMatrix(mode="Rec.709->Rec.601")

PS. If you stay in YUV-land then no color converting takes place while encoding. The encoder simply encodes the YUV video "as is". It's only when converting to RGB that a colorimetry choice is made. If there's no RGB conversion taking place when encoding then the only time a colorimetry choice will be made is on playback, and as you can see Windows (and hopefully most standalone media players etc.) use a different colorimetry when playing back standard definition content than when playing high definition content, hence the need to color convert on the way through.

PPS. You probably don't need to get too involved in all the info on the colormatrix page I linked to, just manually convert the colors when going from HD to SD, or from SD to HD. High definition virtually always uses R.709 and standard definition virtually always uses R.601.

PPPS. I know nothing about 10 bit encoding so I've no idea of it's contributing to a difference in color, but I think it's just a HD vs SD thing.

Nosmas
5th September 2011, 19:50
Thanks for replying, everyone... I will try those who suggest a solution...

If you're upscaling then you need to convert from standard definition to high definition colorimetry. You also need to convert when downscaling from HD to SD.

Forcing ffdshow to convert to RGB might fix the problem because it's got to choose a colorimetry when converting to RBG, but the choice is based on resolution, so depending on the input/output resolution it may not be the correct one (if ffdshow isn't doing the resizing for example).

If you want to avoid the ffdshow, RGB conversion while knowing the colorimetry will be correct, use the colormatrix plugin. http://avisynth.org.ru/docs/english/externalfilters/colormatrix.htm
You can enable the ffdshow AviSynth filter and add the appropriate color conversion to it, or you can add it to an AviSynth script manually etc. (when you installed ffdshow I think you also needed to have ticked the option to install ffdshow's AviSynth plugin for the ffdshow AviSynth filter to work).

This is what I add to the ffdshow AviSynth filter for upscaling (as you are):

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ColorMatrix.dll")
ColorMatrix(mode="Rec.601->Rec.709")

For HD to SD, it's the other way around:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ColorMatrix.dll")
ColorMatrix(mode="Rec.709->Rec.601")

PS. If you stay in YUV-land then no color converting takes place while encoding. The encoder simply encodes the YUV video "as is". It's only when converting to RGB that a colorimetry choice is made. If there's no RGB conversion taking place when encoding then the only time a colorimetry choice will be made is on playback, and as you can see Windows (and hopefully most standalone media players etc.) use a different colorimetry when playing back standard definition content than when playing high definition content, hence the need to color convert on the way through.

PPS. You probably don't need to get too involved in all the info on the colormatrix page I linked to, just manually convert the colors when going from HD to SD, or from SD to HD. High definition virtually always uses R.709 and standard definition virtually always uses R.601.

PPPS. I know nothing about 10 bit encoding so I've no idea of it's contributing to a difference in color, but I think it's just a HD vs SD thing.
I will try that later.. Thanks a lot!!!

EDIT:
It seems like it works! Thanks for the solution!! :)