Log in

View Full Version : Force colorimetry in x264


Mole
14th December 2012, 16:26
Is there any way to specify colorimetry in x264?

For example, if I'm re-encoding a BD, I would then not need to use ColorMatrix to convert the colorimetry and could just encode it as BT.709.

J_Darnley
14th December 2012, 17:31
--colormatrix bt709 will set the flag in the stream and not do anything else. Is that what you meant?

Mole
15th December 2012, 04:01
Thanks. In other words, I won't need to do any color conversion and just re-encode a BD source as it is with this flag, right?

Mole
15th December 2012, 05:37
What about the settings --colorprim bt709 and --transfer bt709?

Do I have to set them all to be the same, or would setting --colormatrix bt709 be enough?

poisondeathray
15th December 2012, 07:34
set them all the same to bt709 when going HD=>HD

but as mentioned above the x264 VUI flags don't change the actual YUV data (they are just "labels")

but when converting HD=>SD you typically convert to bt601 (just changing the flags won't change the data, it has to be done with a filter)

Mole
15th December 2012, 08:22
Yes, but if I just convert from say 1920x1080 -> 1280x720 or 768x432, then I can just keep it as bt709 without converting, no?

Selur
15th December 2012, 09:39
You always can. It's just typical to convert the color space from bt709 to bt601 when going from HD to SD.
And yes, since you go from HD to HD, staying with bt709 is the typical way.
What posiondeathray just wanted to emphasize is that if you change the flag, you change only the flag, x264 does not do any color change for you.

Mole
15th December 2012, 09:41
Yes, I'm fully aware of this and I do not wish that x264 will do any conversion for me either.

My understanding was that certain codec such as xvid always used bt601, so that's why you had to convert.

sneaker_ger
15th December 2012, 09:46
The other problem is that many players actually ignore those color flags and will assume the matrix based solely on the resolution. Using ColorMatrix() (plus flagging correctly) still has the best compatibility.

vivan
15th December 2012, 15:46
You always can. It's just typical to convert the color space from bt709 to bt601 when going from HD to SD.It's not just typical, broken renderer (like... any, except madVR) ignore this flag and produce wrong image.

poisondeathray
15th December 2012, 16:21
My understanding was that certain codec such as xvid always used bt601, so that's why you had to convert.

This is not the case . That statement would only apply to a RGB source

e.g. If you take a blu-ray and convert directly using xvid (HD or SD), nothing happens to the YUV data in terms of colormatrix . The matrix only refers to RGB<=>YUV conversions

The colormatrix() filter converts YUV data to YUV as if that data were had used either 709 or 601 (or other specified matrix) in the first place from a prior RGB conversion (from earlier upstream RGB master source)