Log in

View Full Version : Hey, Wilbert - ColorMatrix for HC/ProCoder?


FredThompson
19th February 2006, 06:45
Hey, Wilbert,

Will you help my poor, pitiful brain out (Ivo will agree with that) and tell me how/when to use ColorMatrix when the encoder is to be either HC or ProCoder?

Is there a way to script such that the conversion is executed only if needed?

TuRiSOft
19th February 2006, 08:24
Hey, Wilbert,

Will you help my poor, pitiful brain out (Ivo will agree with that) and tell me how/when to use ColorMatrix when the encoder is to be either HC or ProCoder?

I just discussed this some time ago here (http://forum.doom9.org/showthread.php?t=106985). HC needs Rec.709 conversion , I wasn't able to tell which color conversion to use with ProCoder. If you find something , please let me know !!!

Is there a way to script such that the conversion is executed only if needed?
You can add "hints=true" to the Colormatrix filter line !!

Boulder
19th February 2006, 09:06
Encoding a clip with ProCoder and then opening the result in DGIndex says that it's rec.709 as well.

FredThompson
19th February 2006, 21:08
Am I correct that the "info=3" argument must be part of the mpeg2source call for this to work? Is there a way to get DVD-RB to include that or must a global search/replace be used on the generated avs files?

Hmmm...the notes for ColorMatrix mention it will clamp the output to CCIR-601. I wonder if HC and ProCoder clamp. If not, clamping would be removing detail. I can see where clamping would be a desired default but an option to prevent overflow instead of clamping would be more useful in some cases. (Such as...you don't care to limit the chroma and luma ranges to the "old" TV standards.)

jdobbs
19th February 2006, 21:51
Maybe I could add a hidden setting that can be appended to every MPEG2Source() variable -- if not I could end up having a neverending feature overload... and most people would never use them. Something like:

AddToMPEG2Source=", info=3"

FredThompson
20th February 2006, 05:50
Yeah, that would work. Maybe it would be more appropriate to have a string for the arguments with a default setting and make that something that isn't available in the GUI.

I wonder if Donald has plans to put automagic coefficient conversion into DGDecode...

NaN
20th February 2006, 08:46
Just to note: this info-parameter is *only* needed for neuron2's builds. My build always outputs colorimetry-hints (needs no additional parameters whatsoever).

Cheers, NaN

FredThompson
20th February 2006, 08:56
Good point, I'd forgotten about that.

Unfortunately, your builds haven't worked with the difficult streams I've pulled from silver discs.

IIRC, jdobbs used file length as the only way to automagically detect your builds and DG's builds.

Boulder
20th February 2006, 09:01
Just to note: this info-parameter is *only* needed for neuron2's builds. My build always outputs colorimetry-hints (needs no additional parameters whatsoever).

Cheers, NaN
I still couldn't get that working every time. Sometimes it worked, sometimes it didn't..

I'll try to test it thoroughly as soon as I have the time (from Wednesday onwards, possibly even earlier than that). On a really quick test I noticed that the position of ColorMatrix in the script affects the result, also SetMTMode might have something to do with it.

NaN
20th February 2006, 09:36
Hi Boulder!

Sorry for not responding to your problem - I was very busy lately. It would be great if you could do some tests, easiest would be to download DebugView from sysinternals.com, add the debug switch to ColorMatrix' parameters and have a look at its output. Just use Gspot or DGIndex to read colorimetry from the source, so you know what should happen. If hints are not detected, please ensure you're using my build called DGDecode 1.1.1 (from http://forum.doom9.org/showthread.php?t=105484 ).

Cheers, NaN

Boulder
20th February 2006, 16:28
OK, I had the time to do a small test. I noticed that the distance and the filter/function calls between MPEG2Source and ColorMatrix matter..

This works:

LoadPlugin("C:\Program Files\DVD-RB PRO\DGDecode.dll")
mpeg2source("D:\Temp\DVD-Rip\Rebuilder\D2VAVS\V01.D2V",idct=6)
LRemoveDust_YV12(17,4)
TemporalSoften(2,5,5,8,2)
trim(0,603)
ColorMatrix(mode="rec.601->rec.709",hints=true)
ConvertToYUY2(interlaced=true)

While this doesn't:

LoadPlugin("C:\Program Files\DVD-RB PRO\DGDecode.dll")
mpeg2source("D:\Temp\DVD-Rip\Rebuilder\D2VAVS\V01.D2V",idct=6)
LRemoveDust_YV12(17,4)
TemporalSoften(2,5,5,8,2)
trim(0,603)
ConvertToYUY2(interlaced=true)
ColorMatrix(mode="rec.601->rec.709",hints=true)

If I replace the ConverttoYUY2 line with Deen, it works. If I even place RemoveGrain after that, it still works.

Needless to say, I'm puzzled:confused: but the workaround is to place ColorMatrix as the first line after MPEG2Source. Looks like that hints get lost somewhere along the way.

EDIT: DGDecode v1.4.5 doesn't work either with the latter script. As a matter of fact, it looks like resizing and colorspace conversion are the two things that destroy the hints. I guess I'll have to notice either Wilbert or neuron2 unless they happen to read this thread.

TuRiSOft
20th February 2006, 17:41
@boulder

With DGDecode 1.4.5 you MUST add info=3 to the MpegSource("..\...\myd2v.d2v,idct=6) line !!!

And as for the second script , it could be ColorMatrix works only in YV12 (I don't remember well , but try to put the line just before the ConvertToYUY2() line ) ....

Boulder
20th February 2006, 17:43
Trust me, I know what I'm doing ;) info=3 was there, I just forgot to mention it.

And ColorMatrix does support YUY2 as well. If it didn't, it would complain about the colorspace instead of hints. As noted, resizing or colorspace conversion will lose the hints.

TuRiSOft
20th February 2006, 17:53
Trust me, I know what I'm doing ;) info=3 was there, I just forgot to mention it.

And ColorMatrix does support YUY2 as well. If it didn't, it would complain about the colorspace instead of hints. As noted, resizing or colorspace conversion will lose the hints.


... ok ! Anyway , I use to use ColorMatrix just after the Mpeg2Source line and I use NAN build of DGDecode , version 1.1.1 , as it gives auto hints!!!

Boulder
20th February 2006, 20:25
Yep, the problem seems to be that the hints are lost when you resize or convert the colorspace. Probably one for Don I think..

FredThompson
20th February 2006, 20:44
The docs for DGDecode talk about the hinting information being embedded in the stream but there's nothing DG can do about the behavior of other filters. Seems to me you'd want to do the colorspace change as soon as possible, though.

FWIW, I've asked Wilbert to add an option so the result has overflow protetion but doesn't clip the luma and colorspace.

Video Dude
21st February 2006, 01:06
I read the 10 page ColorMatrix thread, but I just want to make sure I understand:

When using CCE Basic with DVD-RB,

If the input DVD is Rec.709, then ColorMatrix is not needed.

If the input DVD is SMPTE 170M, then you should add the line
ColorMatrix(mode="Rec.601->Rec.709", hints=true)
If ColorMatrix is not used, then there will be a difference in brightness between the original and the backup.

Is that correct?


Also, since the filter clamps, does that have any negative side effects on dvd backup?

Thanks.

FredThompson
21st February 2006, 01:20
Also, since the filter clamps, does that have any negative side effects on dvd backup?Probably not but IMNSHO it's not a good design. Clamping to that standard assumes ALL equipment and processes that will EVER be used in the production flow are restricted to the chroma and luma of analog TV sets. To me, this is sort of like restricting the audio range of CDs to that of LPs.

Boulder
21st February 2006, 07:04
The docs for DGDecode talk about the hinting information being embedded in the stream but there's nothing DG can do about the behavior of other filters.

Well, he might have some idea since he's the one that implemented it IIRC. Besides, resizing and colorspace conversion are internal functions so there's a good chance that it can be fixed easily.

Seems to me you'd want to do the colorspace change as soon as possible, though.

Nope, those scripts were just a small demonstration for the problem. I usually convert to YUY2 (unless I'm using HC) as the last item or before reinterlacing.

@Video Dude: just use the line ColorMatrix(mode="Rec.601->Rec.709", hints=true) every time and you can't go wrong.

spyhawk
21st February 2006, 07:46
Just need a confirmation. If I use Nan's build 1.1.1, I don't need to add 'hints=true' to the ColorMatrix line, and no need for info=3 to the MpegSource line. I only add these 2 respective parameters only if I use DGDecode 1.4.5. Correct?

The ColorMatrix line will only execute if it finds the source is needed to eliminate the brightness difference?

Is DGDecode 1.4.6 compatible with RB now?

Boulder
21st February 2006, 07:54
Just need a confirmation. If I use Nan's build 1.1.1, I don't need to add 'hints=true' to the ColorMatrix line, and no need for info=3 to the MpegSource line. I only add these 2 respective parameters only if I use DGDecode 1.4.5. Correct?

If you use NaN's build, you don't need info=3 but you need to use hints=true in ColorMatrix. With DGDecode 1.4.5, you need both.

The ColorMatrix line will only execute if it finds the source is needed to eliminate the brightness difference?

If the hints state that the conversion should be done, it's done. Otherwise it'll only call Limiter().

I don't think DGDecode 1.4.6 will work at the moment.

FredThompson
21st February 2006, 10:14
@Boulder, DG added some info the the stream. The only way that info will pass through a filter is if the filter is specifically coded to do so.

Boulder
21st February 2006, 10:18
OK then, since we're talking about Avisynth's internal stuff, I'll link to this thread in the official ColorMatrix thread and hope Wilbert will be able to do something (or pass it on to someone who is).

SDragoon
22nd February 2006, 22:13
Maybe I could add a hidden setting that can be appended to every MPEG2Source() variable -- if not I could end up having a neverending feature overload... and most people would never use them. Something like:

AddToMPEG2Source=", info=3"
That would be great!

Am I correct in thinking there is currently no way to use "ColorMatrix(mode="rec.601->rec.709",hints=true)" directly through the DVD-RB Filter Editor interface using DGDecode 1.4.5 (without editing the AVS files manually)?

NaN
23rd February 2006, 15:32
I think there's a bit trouble understanding how hinting works. Hints are embedded in the stream itself, so if you apply a filter the hints get destroyed. So unless the hinting is done completely different (this would need internal avisynth support) there isn't much you can do.

Cheers, NaN

Boulder
23rd February 2006, 15:37
I think there's a bit trouble understanding how hinting works. Hints are embedded in the stream itself, so if you apply a filter the hints get destroyed. So unless the hinting is done completely different (this would need internal avisynth support) there isn't much you can do.

Cheers, NaN
Yep, the process was clarified in the ColorMatrix thread. Hints work most reliably (i.e. always) when ColorMatrix is called directly after MPEG2Source.