Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
19th October 2020, 13:24 | #1 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,259
|
Problem with ColorMatrix
I use this(695kB) clip with:
Code:
ClearAutoloadDirs() SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE) LoadPlugin("I:\Hybrid\32bit\AVISYN~1\LSMASHSource.dll") LoadPlugin("I:\Hybrid\32bit\AVISYN~1\ColorMatrix.dll") # loading source: C:\Users\Selur\Desktop\ColorTest.mp4 # color sampling YV12@8, matrix: bt709, scantyp: progressive, luminance scale: limited Source = LWLibavVideoSource("C:\Users\Selur\Desktop\COLORT~1.MP4",cache=false,format="YUV420P8", prefer_hw=0,repeat=true) # current resolution: 1440x1080 SourceFiltered = Source # color modifications SourceFiltered = SourceFiltered.ColorMatrix(mode="Rec.709->Rec.601",clamp=0,interlaced=false,hints=false) # filtering # adjust color to RGB32 SourceFiltered = SourceFiltered.ConvertToRGB32(matrix="Rec601") # adjust color to RGB32 Source = Source.ConvertToRGB32(matrix="Rec709") # interleaving for filter preview Source = Source.Subtitle("Original") SourceFiltered = SourceFiltered.Subtitle("Filtered") Interleave(Source, SourceFiltered) PreFetch(8) return last There is no difference between the original and filtered version, as if ColorMatrix had no effect. (on other files this problem does not occur.) -> What am I missing? What did I do wrong? Can someone explain why there is no difference? (or are my eyes simply getting to old?) Cu Selur |
19th October 2020, 22:22 | #2 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
It's the expected result, because you used 2 different ConvertToRGB32 matrices
Source was converted to RGB with 709 SourceFiltered was converted to RGB with 601 . Normally there would be a colorshift , but you compensated for that with colormatrix Rec.709->Rec.601 |
19th October 2020, 22:31 | #3 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,259
|
@poisondeathray: Okay, so ColorMatrix X->Y really is basically just ConvertToRGB(matrix=X).Convert<Some YUV color space>(martix=Y) ? I always assumed it did more.
Okay, follow up question: How do I need to adjust the preview then to view it correctly (I want to compare source and filtered version. So should I use Code:
# adjust color to RGB32 SourceFiltered = SourceFiltered.ConvertToRGB32(matrix="Rec601") # adjust color to RGB32 Source = Source.ConvertToRGB32(matrix="Rec601") # interleaving for filter preview Source = Source.Subtitle("Original") SourceFiltered = SourceFiltered.Subtitle("Filtered") Interleave(Source, SourceFiltered) Code:
# adjust color to RGB32 SourceFiltered = SourceFiltered.ConvertToRGB32(matrix="Rec709") # adjust color to RGB32 Source = Source.ConvertToRGB32(matrix="Rec709") # interleaving for filter preview Source = Source.Subtitle("Original") SourceFiltered = SourceFiltered.Subtitle("Filtered") Interleave(Source, SourceFiltered) Cu Selur Last edited by Selur; 19th October 2020 at 22:48. |
19th October 2020, 22:46 | #4 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Quote:
It doesn't go through a RGB step, and that's the main benefit |
|
19th October 2020, 23:00 | #5 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,259
|
Ah okay, thanks for clearing that up.
But the question remains: How can I preview and compare source&filtered? (I need RGB32 for Preview) Should I use: ConvertToRGB32(matrix="Rec709") since I specified it as 'from' in ColorMatrix or ConvertToRGB32(matrix="Rec601") since I specified it as 'to' in ColorMatrix or ConvertToRGB32(matrix="Rec709") since I specified it the source was flagged with it. ? Cu Selur |
19th October 2020, 23:02 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This might be worth pointing out.
Someone once asked if "RGB is 601 or 709 ?" [or words of similar meaning]. Matrix only really applies to YUV, and how it was converted from RGB (and how to convert back to RGB again). You would usually only use ColorMatrix() on RGB if was previously converted wrongly from YUV. EDIT: RGB is just RGB, it has no matrix, and no need of one. EDIT: Leastwise, above as I understand it.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 19th October 2020 at 23:28. |
20th October 2020, 00:34 | #8 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
By default, and convention, "HD" uses 709 . So if your video is "HD" dimension use 709, if "SD" use 601 for the RGB conversion. That's what many media players will be using . Some have different definitions for "HD" based on certain width or height . Since you have 1440x1080 (That's "HD" by any definition), use 709 for both RGB conversions
|
20th October 2020, 05:40 | #9 | Link |
Registered User
Join Date: Nov 2008
Posts: 100
|
Can someone answer this simple question for me please?
I have a 720x540 YV12 source. I want to upscale it and eventually watch it on a HDTV. My filter chain looks like this: import source nnedi3_resize16(1440,1080) colormatrix("rec.601->rec.709") output as MagicYUV - YUV 4:2:0 using 709 colorspace Does the resulted, upscaled clip look 'the same' (in terms of colors) on my HDTV as the source clip when also displayed on the HDTV? Last edited by pwnsweet; 20th October 2020 at 05:48. |
20th October 2020, 05:51 | #10 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Quote:
But it depends on your playback chain. No TV can playback MagicYUV natively So it depends on what is playing it back, how it's being sent to the TV, where and how the RGB conversion is being done. You can test a short clip. |
|
20th October 2020, 06:03 | #11 | Link | |
Registered User
Join Date: Nov 2008
Posts: 100
|
Quote:
If that's true...how is it true? The colors visibly change in AVSPmod when I apply colormatrix("rec.601-rec.709"). Is that color change 'reversed' when the TV decodes a YUV HD source (using the 709 matrix) to display it on the RGB screen? Is my undestanding correct here? Last edited by pwnsweet; 20th October 2020 at 07:15. |
|
20th October 2020, 15:33 | #12 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Quote:
video => YUV->RGB -> "resolution based" would mean the preview uses 701 for "HD" , 601 for "SD" . If that's the case the should look the same with original video 720x540 video vs. the script. If you had it set to 709 or 601, it should be different . "<= 576" height is usually one of the cut offs for "SD" video, but it might be slightly different in different applications Another way to check is explicitly control the RGB conversion for the preview with ConvertToRGB(matrix="blah") at the end of the script . The assumption is that HD uses 709, SD uses 601. It's a valid and true assumption for 99.9% of the cases (there are a few exceptions) |
|
29th October 2020, 12:14 | #13 | Link | |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
Quote:
The main thing to worry about is if the colors are the same as the source video when you open it directly. Open the source and scripts in different instances of MPC-HC if you want to compare them. This should display with the same colors as the source. Code:
import source nnedi3_resize16(1440,1080) colormatrix("rec.601->rec.709") Code:
import source colormatrix("rec.601->rec.709") Code:
import source nnedi3_resize16(1440,1080) It doesn't hurt to set the correct colorimetry info when encoding with x264. Add this to the command line: --colormatrix bt709 For standard definition, I use --colormatrix bt470bg for PAL and -colormatrix smpte170m for NTSC. (there's no bt601 option) |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|