Log in

View Full Version : Used colormatrix to convert to rec.709. Now want to preserve color.


Jeremy Duncan
3rd March 2008, 05:59
I'm using ffdshow on my dvd's. And I want to use colormatrix to get rec.709, and I want to use convert to convert to 24 bit with lanczos scaling instead of the default bicubic.

Here is my code I tried.
It looked a bit weird.

setmemorymax(1024)
ColorMatrix(Mode="Rec.601->Rec.709",clamp=false,threads=2)
ConvertToRGB24
chromaresample="Lanczos"

I'm worried that convert is changing the rec.709 back to rec.601.
I want it whatever colormatrix has it to. I don't want it changed by convert. :)

d2v sample (http://rapidshare.com/files/96637521/New_Folder.zip.html)

I'm using colormatrix 2.2

Jeremy Duncan
3rd March 2008, 19:08
setmemorymax(1024)
ColorMatrix(Mode="Rec.601->Rec.709",clamp=false,threads=2)
ConvertToRGB24(matrix="pc.709")
chromaresample="Lanczos"

I wonder if this is what I'm looking for?

Wilbert
3rd March 2008, 19:19
rec.601 or rec.709 makes only sense when you are converting from YCbCr to RGB (or vice versa).

Is your source YCbCr [0,255] (Rec.601)?

Jeremy Duncan
3rd March 2008, 19:32
I'm not sure, but I treat it like it's 0-255.
Have a look at the sample I uploaded to be sure though.

Standard ntsc movie from the disk.

Wilbert
3rd March 2008, 22:39
Assuming your source is Rec.709 [0,255] you need to use


setmemorymax(1024)
ConvertToRGB24(matrix="pc.709")
chromaresample="Lanczos"


If your source is Rec.601 [0,255]:


setmemorymax(1024)
ConvertToRGB24(matrix="pc.601")
chromaresample="Lanczos"


No need to use ColorMatrix in either case.

tetsuo55
6th March 2008, 14:41
DVD source is always 601 right?

talen9
6th March 2008, 17:12
DVD source is always 601 right?

Not always, in R2 PAL DVDs at least: I'd say that 75% of commercial DVDs here are reporterd by DGIndex to have BT.709 colorimetry.

manono
8th March 2008, 12:26
Get a more up-to-date DGIndex. Everything's changed.

orion44
2nd April 2010, 12:13
DVD source is always 601 right?

With most DVDs I tested, DGIndex always reports ITU-R BT.470-2 colorimetry (Rec.601),
even though the colorimetry info is not specified in the header of the MPEG-2 file.

And when this info is not present in the header (which is almost always),
we are supposed to use ITU-R BT.709 colorimetry, which most DVDs use.

manono
2nd April 2010, 13:17
And when this info is not present in the header (which is almost always),
we are supposed to use ITU-R BT.709 colorimetry, which most DVDs use.
Since you didn't pose that as a question, I'll just say that's not correct.

Alex_ander
2nd April 2010, 13:23
And when this info is not present in the header (which is almost always), we are supposed to use ITU-R BT.709 colorimetry, which most DVDs use.

The name of Rec. ITU-R BT.709 is:
Parameter Values for the HDTV Standards for Production and International Programme Exchange.

Correspondingly, from DGindex manual:
..if the stream does not declare the colorimetry, then ITU-R BT.709* is reported for HD video, and ITU-R BT.470-2* is reported for SD video. The * character indicates that the stream did not declare the colorimetry.


From Canopus specification:
Video Filters:
601 to 709 color correction (ITU-R BT 601 SD to ITU-R BT 709-5 HD)

when this info is not present in the header
It only means not set at encoding or simply not used by a particular encoder (like CCE).

P.S. In case of RGB input CCE uses 601 coefficients to get YUY2 before encoding (with reference to ITU-R BT 601 in its manual), still without writing color space data to mpeg header.

Wilbert
2nd April 2010, 17:49
http://avisynth.org/mediawiki/Colorimetry contains a discussion about this.

orion44
2nd April 2010, 23:44
Since you didn't pose that as a question, I'll just say that's not correct.

lol, whatever works for ya, buddy.

Ben_Nicholls
10th September 2017, 10:50
Okay guys, a little bit confused.

I can completely see the need to know when converting to/from YVx to/from RGBx but I am unclear if it is required otherwise.

If I rip a DVD to x264 is it necessary to use ColorMatrix("Rec.601->Rec.709") before encoding?

x264 has an switch to set the colour matrix. Is there any benefit processing the video to Rec.709 and then setting x264 to --colormatrix bt709 over leaving with the colour matrix set to "Undefined" (there doesn’t appear to be one for "Rec.601), at least not listed in StaxRip.

I have always just left Rec.601 flagged as "Undefined". The only issue I have run into is a few DVDs/MPEG-2 broadcasts that failed to signal that they were 16-235 (in which case ColorYUV(levels="TV->PC") seemed to sort the issue out fine (checked and the blacks became close enough to 0,0,0 and whites 255,255,255).

Any advice on if using ColorMatrix for Rec.601 material is necessary (in the same way correcting 16-235 is for PC viewing)?

Thanks in advance guys!

sneaker_ger
10th September 2017, 11:11
Usually with SD resolution players assume Rec.601 colors, with HD they assume Rec.709. So if your output is HD but your input was SD (with Rec.601!) you want to Rec.601->Rec.709 to increase playback compatibility. Flagging will mostly not be need - some people just like to explicitly flag in an attempt to be more correct/orderly.

there doesn’t appear to be one for "Rec.601
There are but they are called differently:
http://forum.doom9.org/showthread.php?p=1681479#post1681479

Ben_Nicholls
11th September 2017, 09:48
There are but they are called differently:
http://forum.doom9.org/showthread.php?p=1681479#post1681479

Thanks!

I guess now I should go through my x264 DVD rips and try and figure out if they are Rec.601 or Rec.709. I don't know if the MPEG-2 VOB decoders (like DGIndex) converts to Rec.709 (they seem to correct 16-235 to 0-255).

When it comes to the TV or PC levels issue it's straightforward, just take a few screen grabs, load them into Photoshop, then check the histogram and see if there is anything above 235 above below 16.

Is there any method of image analysis that can be used to determine of your video is Rec.601 or. Rec.709?

Thanks,

Ben

sneaker_ger
11th September 2017, 13:06
Is there any method of image analysis that can be used to determine of your video is Rec.601 or. Rec.709?
No. DGIndex should show source colors. But for DVD I think you can always assume Rec.601 TV range colors. In reality we have Millions of DVDs, mastered badly. Often authoring houses don't know what they are doing or have bad masters to begin with. And often colors are changed between releases purposely. Getting it 100% right is a futile goal. So just assuming Rec.601 TV range should be good enough.

manono
11th September 2017, 20:07
I don't know if the MPEG-2 VOB decoders (like DGIndex) converts to Rec.709.
DGIndex doesn't. It gives you back what's on the DVD and if no colorimetry is declared it uses ITU-R BT.470-2 (aka ITU-R BT.601).
...they seem to correct 16-235 to 0-255
DGIndex gives you back what's on the DVD and does no remapping. There are plenty of DVDs with luma ranges outside of 16-235.

FranceBB
12th September 2017, 18:32
Thanks!
When it comes to the TV or PC levels issue it's straightforward, just take a few screen grabs, load them into Photoshop, then check the histogram and see if there is anything above 235 above below 16.

Is there any method of image analysis that can be used to determine of your video is Rec.601 or. Rec.709?


You can check histogram within Avisynth using avspmod or virtualdub or Avisynth studio etc


TurnRight.Histogram.TurnLeft #luma
Histogram("color2") #chroma

Ben_Nicholls
24th September 2017, 04:40
DGIndex doesn't. It gives you back what's on the DVD and if no colorimetry is declared it uses ITU-R BT.470-2 (aka ITU-R BT.601).

DGIndex gives you back what's on the DVD and does no remapping. There are plenty of DVDs with luma ranges outside of 16-235.

Ah... is the DGIndex "Video\YUV -> RGB\PC Scale" option just a preview setting then?

manono
24th September 2017, 08:30
Ah... is the DGIndex "Video\YUV -> RGB\PC Scale" option just a preview setting then?As the DGIndex User Manual (http://rationalqm.us/dgmpgdec/DGIndexManual.html) makes clear, that setting is only for those using VFAPIs to frameserve. And, since no one in their right mind still uses a VFAPI you can ignore that setting as it'll do nothing when using MPEG2Source to frameserve. I suppose if you do have it set and use DGIndex's picture to study your video, you might find yourself being misled.