View Full Version : ColorMatrix Help Needed


slimer5
14th March 2007, 20:58
hey everyone,

i have been running my Jackass 2 dvd through DVD-RB multiple times with each time having an output with a noticeable loss of color. after talking to kumi and playing it with DGIndex to find out the colorimetry, he said that i need to add colormatrix to my avisynth plugins and put in the right "call" into dvd-rb's filter editor.

now, being a noob to the program, i am not exactly sure of the uses of matrices and i have no idea how to put in the correct "call" into the filter editor. if someone would be so generous as to put up a process of what to do after putting the dll in the avisynth plugins directory, since i do not know what to do from there, i would be very grateful.

thanks for anything.

kumi
14th March 2007, 22:19
hey everyone,

i have been running my Jackass 2 dvd through DVD-RB multiple times with each time having an output with a noticeable loss of color. after talking to kumi and playing it with DGIndex to find out the colorimetry, he said that i need to add colormatrix to my avisynth plugins and put in the right "call" into dvd-rb's filter editor.

now, being a noob to the program, i am not exactly sure of the uses of matrices and i have no idea how to put in the correct "call" into the filter editor. if someone would be so generous as to put up a process of what to do after putting the dll in the avisynth plugins directory, since i do not know what to do from there, i would be very grateful.

thanks for anything.

1/ Put Colormatrix.dll in your autoloading plugin folder. It's probably C:\Program Files\Avisynth 2.5\plugins

2/ Use mode="Rec.601->rec.709" in step 3 if DGIndex information shows one of these two:
Colorimetry: ITU-R BT.470-2
Colorimetry: SMPTE 170M

Use mode="SMPTE 240M->rec.709" in step 3 if DGIndex information shows:
Colorimetry: SMPTE 240M

Use mode="FCC->rec.709" in step 3 if DGIndex information shows:
Colorimetry: FCC

3/ After a prepare phase, open the DVD Rebuilder Beta Segment Viewer, and expand the list of VIDEO TITLE SETS.

If the VTS marked (feature) is the only one you need to apply ColorMatrix() on, paste this code into the Filter Editor window, press "Save and Exit", and re-run the prepare phase. Replace mode="foo->bar" with the correct conversion for your feature VTS:
f:p:ColorMatrix(mode="foo->bar")
f:i:ColorMatrix(mode="foo->bar", interlaced=true)

If all of the VTSs need the same conversion, paste this code into the Filter Editor window, press "Save and Exit", and re-run the prepare phase. Replace mode="foo->bar" with the correct conversion for your VTSs:
p:ColorMatrix(mode="foo->bar")
i:ColorMatrix(mode="foo->bar", interlaced=true)

If the Feature needs one type of conversion, and the extras need another, you can use the f: (feature) and e: (extras) prefixes in the Filter Editor window for each type of VTS. Replace mode="foo->bar" and mode="abc->xyz"with the correct conversion for the feature/extras VTSs:
f:p:ColorMatrix(mode="foo->bar")
f:i:ColorMatrix(mode="foo->bar", interlaced=true)
e:p:ColorMatrix(mode="abc->xyz")
e:i:ColorMatrix(mode="abc->xyz", interlaced=true)

slimer5
14th March 2007, 23:54
wow, thank you very much for the detailed response, i will definitely put this to work.

kumi
15th March 2007, 00:03
My pleasure.

By the way, I'm assuming here that you're using HC, CCE, or ProCoder. All three assume Rec.709 coefficients, hence the mode= parameters I recommended.

If you're using QuEnc, ReJig, or AutoQmatEnc, you'll have to ask someone which coefficients they use.

canuckerfan
15th March 2007, 02:54
uhm, little confused. rec601 or rec709 for mpeg2 using cce????

http://forum.doom9.org/showthread.php?t=119644 (look at foxyshadis' post)

kumi
15th March 2007, 03:09
I think she accidentally switched the two around in the post.

CCE outputs Rec.709 streams. So I assume it expects Rec.709 as well.

Thus, use colormatrix(mode="FOO->Rec.709"), where FOO is your source colorimetry as specced by Gspot or DGIndex.

slimer5
15th March 2007, 07:34
bit of a problem,

i put in the following code into the filter editor:

f:p:ColorMatrix(mode="Rec.601->rec.709")
f:i:ColorMatrix(mode="Rec.601->rec.709", interlaced=true)


then, i ran the encode, but HC gave me an error that the m2v was not present. so I switched to cce and the output was the following:

http://img.photobucket.com/albums/v412/JunnyLudLoafBug/vlcsnap-4401074.jpg

what am I doing wrong?

kumi
15th March 2007, 07:40
Colormatrix.dll probably isn't being autoloaded. Try adding this line to the first line of the Filter Editor (remember to re-run the prepare phase.)

LoadPlugin("C:\Program Files\Avisynth 2.5\plugins\colormatrix.dll")

Substitute the path for your own, of course.

slimer5
15th March 2007, 07:52
i was wondering how it knew where the plugin was,


thanks once again!

slimer5
16th March 2007, 05:27
im still getting the error with HC

this is the code im using

LoadPlugin("C:\Program Files\Avisynth 2.5\plugins\colormatrix.dll")
p:ColorMatrix(mode="Rec.601->rec.709")
i:ColorMatrix(mode="Rec.601->rec.709", interlaced=true)

this is a copy of the log

[00:09:21] One Click encoding activated...
-----------------
[00:09:25] Phase I, PREPARATION started.
- "Steal Space from Extras" mode is enabled.
- VTS_03: 1,937,935 sectors.
-- Scanning and writing .D2V file
-- Processed 134,737 frames.
-- Building .AVS and .ECL files
- VTS_04: 1,096,095 sectors.
-- Scanning and writing .D2V file
-- Processed 80,722 frames.
-- Building .AVS and .ECL files
- VTS_05: 545,112 sectors.
-- Scanning and writing .D2V file
-- Processed 40,335 frames.
-- Building .AVS and .ECL files
- VTS_06: 111,219 sectors.
-- Scanning and writing .D2V file
-- Processed 8,456 frames.
-- Building .AVS and .ECL files
- VTS_07: 275,382 sectors.
-- Scanning and writing .D2V file
-- Processed 22,073 frames.
-- Building .AVS and .ECL files
- Reduction Level for DVD-5: 49.9%
- Overall Bitrate : 2,441Kbs
- Space for Video : 3,558,834KB
- Movie improvement from extra reduction = 59.4%
- HIGH/LOW/AVERAGE Cell Bitrates: 5,627/600/2,441 Kbs
[00:20:50] Phase I, PREPARATION completed in 11 minutes.
[00:20:50] Phase II ENCODING started
- Creating M2V for VTS_03 segment 0
-- Encoding resulted in no .M2V, retrying.
- Creating M2V for VTS_03 segment 0
-- Encoding resulted in no .M2V, retrying.
- Creating M2V for VTS_03 segment 0
Aborted.

any suggestions?

kumi
16th March 2007, 05:31
What do you see when you open one of the V03*.AVS files (located in your working directory after a prepare phase) in a media player such as VirtualDub or VirtualDubMod?

slimer5
16th March 2007, 05:45
What do you see when you open one of the V03*.AVS files (located in your working directory after a prepare phase) in a media player such as VirtualDub or VirtualDubMod?

Avisynth open failure:
Script error: syntax error
(K:\WORKING\D2VAVS\V03*.AVS, line 9, column 2

kumi
16th March 2007, 05:59
Oh I think I see what the problem is...

You need at least version 1.20.4 of DVD Rebuilder Professional edition for the "i:", "p:", "f:" and "e:" modifiers to work.

slimer5
16th March 2007, 16:06
Oh I think I see what the problem is...

You need at least version 1.20.4 of DVD Rebuilder Professional edition for the "i:", "p:", "f:" and "e:" modifiers to work.

there's no code that works with the free version?

JohnGalt
16th March 2007, 20:44
You can use RB-Opt (which installs with RB itself, I believe) to add whatever filters you like to any VTS you like. Use RB in 3-click mode, run Prepare, then load your resultant INF file in RB-Opt. Select a VTS in the left pane, then click "AVS Settings" on the right. A new window will pop up allowing you to add or delete lines in the AVS script. Save your altered INF file. Then run the Encode stage in RB, continuing as usual.

slimer5
17th March 2007, 01:14
You can use RB-Opt (which installs with RB itself, I believe) to add whatever filters you like to any VTS you like. Use RB in 3-click mode, run Prepare, then load your resultant INF file in RB-Opt. Select a VTS in the left pane, then click "AVS Settings" on the right. A new window will pop up allowing you to add or delete lines in the AVS script. Save your altered INF file. Then run the Encode stage in RB, continuing as usual.

i will try this out and get back to you.

slimer5
17th March 2007, 02:27
i placed the following code into each VTS

LoadPlugin("C:\Program Files\Avisynth 2.5\plugins\colormatrix.dll")
p:ColorMatrix(mode="Rec.601->rec.709")
i:ColorMatrix(mode="Rec.601->rec.709", interlaced=true)

is that what i should have done?

kumi
17th March 2007, 03:52
No. The "p:" and "i:" are flags used by DVD Rebuilder. They are not part of AviSynth, and will produce the error you described earlier.

An AVS like this:
#------------------
# AVS File Created by DVD Rebuilder
# VOBID:01, CELLID:06
#------------------
LoadPlugin("C:\Program Files\DVD-RB PRO 1.21\DGDecode.dll")
mpeg2source("D:\DVDRB WORKING\D2VAVS\V01.D2V",idct=7)
trim(107926,109862)
ConvertToYV12(interlaced=true)

Should end up like this:
#------------------
# AVS File Created by DVD Rebuilder
# VOBID:01, CELLID:06
#------------------
LoadPlugin("C:\Program Files\DVD-RB PRO 1.21\DGDecode.dll")
LoadPlugin("C:\Program Files\Avisynth 2.5\plugins\colormatrix.dll")
mpeg2source("D:\DVDRB WORKING\D2VAVS\V01.D2V",idct=7)
ColorMatrix(mode="Rec.601->rec.709", interlaced=true)
trim(107926,109862)
ConvertToYV12(interlaced=true)

Colormatrix() should always be placed immediately after the MPEG2Source() line.

Also, if your ConvertToYV12() function does not contain "interlaced=true", omit the "interlaced=true" argument from the ColorMatrix() call.

slimer5
17th March 2007, 05:48
alright, gotta try this out now.

btw, what does the added (interlaced=true) to ConvertToYV12 do and why wasnt it already there?

kumi
17th March 2007, 05:54
DVD Rebuilder adds that to segments that need interlaced processing. Don't modify it...

slimer5
17th March 2007, 19:28
It worked! the output looks much better, and believe it or not, it looks like it gained more color than the source dvd9!

thank you very much kumi and JohnGalt for all your help.

~bT~
20th March 2007, 21:17
I'm sorry if this has been asked before..

I'm doing a re-encode but the source is interlaced yet I have to disable de-interlace as its looks horrid if I do enable it.

My question is, do I add interlaced=true or not?

Also off topic but it was mentioned here.
The i: p: e: f: parameters, is there a link I can read more on it?

Rippraff
20th March 2007, 23:47
My question is, do I add interlaced=true or not?
Normally you don't have to care about this, RB will do this for you.
Try this: Start a new run in 3-Click-Mode, after prepare phase go to your working folder and check one of the main movie avs files.
If it says ConvertTo...(interlaced=true) you should be on the safe side.
Edit: And if your question is related to the use of ColorMatrix then you have to set interlaced=true like kumi wrote above.

Also off topic but it was mentioned here.
The i: p: e: f: parameters, is there a link I can read more on it?
These are prefix recognitions in the filter editor introduced in v1.20.4.
i = interlaced
p = progressive
e = extras
f = feature
They are meant as a limitation for the use of filters.

You can combine them as well if you want:
1) i:e:undot().deen()
2) p:f:msharpen()

Means:
1) If your source is interlaced and an extra use undot and deen
2) If your source is progressive and the main movie use the sharpener.

If I remember correctly there mustn't be a space between the prefix and the filter.

Cu Rippraff

~bT~
21st March 2007, 00:26
Edit: And if your question is related to the use of ColorMatrix then you have to set interlaced=true like kumi wrote above.
I understood what kumi said and I use it all the time, but its just this occasion I'm not sure what I need to do..
My source is interlaced, but I have disabled the de-interlacer within DVD-RB.
Am I right in believing, even though I disable de-interlace, DVD-RB does a pull-down/IVTC?
If the above is true, then I should use interlaced=true.

jdobbs
21st March 2007, 03:21
Interlaced logic would be used on sources that are not of the pulldown type. Pulldown is normally applied to a progressive source. Also, iVTC is not something that you have to do when you work with the source -- because that is just a function of what the flags are telling a decoder to do... the source itself doesn't actually contain the frames that are created during telecining.

But -- with that said, you should normally always disable deinterlacing -- it is just meant for some very specific circumstances. DVD-RB recognized interlaced material (as well as progressive) and handles it appropriately.

If you are using DVD-RB Pro -- you can use the "i:" or "p:" prefix on the line and add the "interlaced=true" parameter (assuming its appropriate) to the functions that require it along with the "i:" prefix. You'd leave it off of the ones with the "p:"

~bT~
21st March 2007, 13:59
But -- with that said, you should normally always disable deinterlacing -- it is just meant for some very specific circumstances. DVD-RB recognized interlaced material (as well as progressive) and handles it appropriately.

Wouldn't it be a good idea to have it disabled by default then?

jdobbs
21st March 2007, 17:24
I think we may be talking about two different things... because it is disabled by default.

There is a setting called "Deinterlace with Decomb". That's what I'm talking about.

There is also another setting called "Disable Interlaced" -- but that is not a deinterlacer. It is a way to turn off the interlaced flag on sources that are actually progressive but are incorrectly flagged (I've been told that happens fairly often in PAL land).

Neither of these options are checked (enabled) by default.