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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th October 2006, 18:20   #241  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
[link removed, read down for a newer version], finally finshed the new version I mentioned back in January. Changes from v1.10:
Code:
+ Rewrote a large portion of the code
+ Added ability to convert between any of: Rec.709, FCC, Rec.601, and SMPTE 240M
+ Added source and dest parameters
+ Added scaling parameter (optional clipping and unscaled coefficients)
+ d2v option supports changing colorimetry info (with trim() and frame rearrangement restriction)
- fixed a problem with calculated luma values that were < 0 being set to 255 instead of 0
Main items are ColorMatrix can now convert between any of: Rec.709, FCC, Rec.601, and SMPTE 240M... everything in the mpeg2 specs. The pre/post clipping with limiter is optional, and there is also the option to use non-scaled coefficients if desired. The d2v option supports changing colorimetry (though there are still a few restrictions with using trim() and the like beforehand -- see the read me). The new syntax is:

ColorMatrix(clip, string "mode", int "source", int "dest", int "scaling", bool "interlaced", bool "hints", string "d2v", bool "debug", int "opt")

Last edited by tritical; 19th January 2007 at 01:38.
tritical is offline   Reply With Quote
Old 13th October 2006, 20:12   #242  |  Link
G_M_C
Registered User
 
Join Date: Feb 2006
Posts: 1,076
The downloadlink times-out for me, guess the whole world is getting an update :P

Last edited by G_M_C; 13th October 2006 at 20:40.
G_M_C is offline   Reply With Quote
Old 15th October 2006, 02:10   #243  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,698
Shouldn't you update the title of the thread?
And maybe your website?
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 15th October 2006, 03:48   #244  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
hm, I had updated my website but the university's servers had a little outage around then and I guess something screwy happened. Anyways, it's updated now. I can't edit the thread title since it isn't mine. I opted not to post this in a separate thread so that all the ColorMatrix related info would stay together.
tritical is offline   Reply With Quote
Old 21st October 2006, 15:58   #245  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
A few questions..
- When using colormatrix with the d2v parameter, do we still have to specify the interlace parameter ?

If so:
- If a PAL interlaced source, for a progressive one I suppose the interlace parameter should be set to false ?
But for a NTSC source, if the d2v was done with honor pulldown flags", should the interlaced parameter be true or false ? Same question for a d2v in forced film ?

I have these questions because the d2v analysed is showing fields, not frames I think, so I am not sure how the interlace parameter is used..

Thanks
Alain2 is offline   Reply With Quote
Old 21st October 2006, 16:50   #246  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
A few questions..
- When using colormatrix with the d2v parameter, do we still have to specify the interlace parameter ?
Yes.

Quote:
for a progressive one I suppose the interlace parameter should be set to false ?
Yes.

Quote:
But for a NTSC source, if the d2v was done with honor pulldown flags", should the interlaced parameter be true or false ? Same question for a d2v in forced film ?
That's a good one. You need to make it progressive first by inverse telecining it. Note that the first frame is not altered by the ivtc process (the first few bytes are altered in the first frame when using hints in dgdecode), so you can use ColorMatrix directly after doing the inverse telecine.
Wilbert is offline   Reply With Quote
Old 21st October 2006, 17:55   #247  |  Link
canuckerfan
Registered User
 
Join Date: Jul 2005
Posts: 317
I tried the above suggestion, to use colormatrix after IVTC, but it says no hints detected in red text. It worked fine when I called it before IVTC. here's my script:

Quote:
mpeg2source("E:\Video\Hindi Movies\Dil.Chahta.Hai.2001.DVD9-bj1988\temp\slow.d2v",idct=5,info=3)

Setmemorymax(512)

AssumeTFF()
Interp = SeparateFields().SelectEven().EEDI2(field=1)
Deinted=TDeint(order=1,field=1,edeint=Interp)
TFM(mode=6,order=1,PP=7,slow=2,mChroma=true,Clip2=Deinted)
TDecimate(mode=1)

ColorMatrix(mode="Rec.601->Rec.709",hints=true)

DeSpot(pwidth=65,pheight=65,p1=35,p2=14,mthres=25)
RemoveDirt()

Tweak(sat=1.12,cont=1.12,bright=10.4)

FFT3DFilter(sigma=2.2,ow=48/2,oh=48/2)
Dehalo_alpha()
LimitedSharpenFaster(Smode=4,Lmode=2,overshoot=14,strength=200)

Crop(0,48,0,-48)
AddBorders(0,48,0,48)

ConvertToYUY2()
canuckerfan is offline   Reply With Quote
Old 21st October 2006, 18:12   #248  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
Ok, so if I understand well:

- in case of a d2v in forced film, then I get a progressive clip out of mpeg2source, and thus set interlaced=false in colormatrix ?

- in case of a d2v in honor pulldown flags, then I have a telecined clip. You say it's better to ivtc first (with tfm+tdecimate for instance) before applying colormatrix, so in that case the d2v won't have the same number of frames than what is fed through colormatrix.
-- I can't use the d2v parameter then (so won't detect eventual changes of colorimetry within the clip) ?
-- If I don't ivtc first but place colormatrix with d2v=.. and interlaced=true immediately after mpeg2source, would that be a worse solution and why ?
Alain2 is offline   Reply With Quote
Old 21st October 2006, 23:19   #249  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
- in case of a d2v in forced film, then I get a progressive clip out of mpeg2source, and thus set interlaced=false in colormatrix ?
Yes.

Quote:
- in case of a d2v in honor pulldown flags, then I have a telecined clip. You say it's better to ivtc first (with tfm+tdecimate for instance) before applying colormatrix, so in that case the d2v won't have the same number of frames than what is fed through colormatrix.
Yes.

Quote:
-- I can't use the d2v parameter then (so won't detect eventual changes of colorimetry within the clip) ?
I never thought about this, but i guess that means yes indeed.

Quote:
-- If I don't ivtc first but place colormatrix with d2v=.. and interlaced=true immediately after mpeg2source, would that be a worse solution and why ?
Yes, a little bit worse. The chroma of the clip will be blurred more in that case (because it's being treated as interlaced).

@canuckerfan,

Quote:
I tried the above suggestion, to use colormatrix after IVTC, but it says no hints detected in red text. It worked fine when I called it before IVTC. here's my script:
I'm not sure why, but perhaps tritical can explain. In any case, you can store the hints in a different clip:

Code:
Setmemorymax(512)

mpeg2source("E:\Video\Hindi Movies\Dil.Chahta.Hai.2001.DVD9-bj1988\temp\slow.d2v",idct=5,info=3)
savedHints = last
AssumeTFF()
Interp = SeparateFields().SelectEven().EEDI2(field=1)
Deinted=TDeint(order=1,field=1,edeint=Interp)
TFM(mode=6,order=1,PP=7,slow=2,mChroma=true,Clip2=Deinted)
TDecimate(mode=1)

MergeHints(hintClip=savedHints) # add hints back for use with ColorMatrix
ColorMatrix(mode="Rec.601->Rec.709",hints=true)

DeSpot(pwidth=65,pheight=65,p1=35,p2=14,mthres=25)
RemoveDirt()

Tweak(sat=1.12,cont=1.12,bright=10.4)

FFT3DFilter(sigma=2.2,ow=48/2,oh=48/2)
Dehalo_alpha()
LimitedSharpenFaster(Smode=4,Lmode=2,overshoot=14,strength=200)

Crop(0,48,0,-48)
AddBorders(0,48,0,48)

ConvertToYUY2()
Wilbert is offline   Reply With Quote
Old 21st October 2006, 23:58   #250  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Quote:
-- I can't use the d2v parameter then (so won't detect eventual changes of colorimetry within the clip) ?
You can still use the d2v parameter as long as the colorimetry doesn't change at some point in the d2v. The same number of frames requirement is only enforced if colormatrix detects that the colorimetry does indeed change in the d2v file. That requirement is checked for during filter construction, so if you are able to load the script without an error then everything is fine. In the case that the colorimetry does change, colormatrix has to correctly match up input frames to frames in the d2v file to determine which frames need which conversion... thus the requirement that the number of frames be the same.

@canuckerfan
The hints wont survive tfm because by default it writes its own hints into the same bytes that dgdecode uses for hints. Unfortunately, the mergehints() workaround that Wilbert posted wont work correctly either since the frames in the saved clip wont match up with the frames after ivtc... which would be required to correctly handle changing colorimetry. If the colorimetry didn't change, then it would be fine, but in that case you could just use the d2v parameter.
tritical is offline   Reply With Quote
Old 22nd October 2006, 00:02   #251  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
@tritical,

So if you want to use hints on a telecined source, your only option is to use interlaced=true in ColorMatrix?
Wilbert is offline   Reply With Quote
Old 22nd October 2006, 00:02   #252  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,556
The interlacing part kind of confused me. I always though colomatrix worked like levels, where every value mapped to only one output value, and neighboring pixels had no influence. I guess I'm wrong about that? It should only effect interlaced chroma differently if a pixel's vertical neighbors are taken into account.
foxyshadis is offline   Reply With Quote
Old 22nd October 2006, 00:14   #253  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
The interlacing part kind of confused me. I always though colomatrix worked like levels, where every value mapped to only one output value, and neighboring pixels had no influence. I guess I'm wrong about that? It should only effect interlaced chroma differently if a pixel's vertical neighbors are taken into account.
Good that you mention Levels. I never thought about Levels in relation to interlaced stuff. I can't imagine it works correctly on an interlaced clip?

As for ColorMatrix
Quote:
I always though colomatrix worked like levels, where every value mapped to only one output value, and neighboring pixels had no influence.
For YV12, the chroma is adjusted for 2x2 pixels. For interlaced stuff you need to pick different 2x2 pixels than for progressive stuff. (Internally, SeparateFields().stuff().Weave() is done when interlaced=true.)
Wilbert is offline   Reply With Quote
Old 22nd October 2006, 00:17   #254  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Quote:
So if you want to use hints on a telecined source, your only option is to use interlaced=true in ColorMatrix?
I'd say at the moment that would be the only save solution. i.e.

mpeg2source(info=3)
colormatrix(hints=true,interlaced=true)
otherstuff()

Or use an ivtc solution that wont mess with the hints. I'm not aware off hand of which could be guaranteed not to and under which circumstances they wouldn't. Though if you use a script such as:

mpeg2source(info=3)
ivtc()
colormatrix(hints=true)

and it doesn't complain about there not being hints then it should be fine.

@foxyshadis
As Wilbert said, the calculations require both luma/chroma to be considered together, so in interlaced YV12 the luma values that go with each set of chroma pixels is different for interlaced vs progressive.

Last edited by tritical; 22nd October 2006 at 03:12.
tritical is offline   Reply With Quote
Old 22nd October 2006, 02:24   #255  |  Link
canuckerfan
Registered User
 
Join Date: Jul 2005
Posts: 317
^If that's the case, to use the interlaced parameter for telecined material. Wouldn't the progressive frames be handled incorrectly?
canuckerfan is offline   Reply With Quote
Old 22nd October 2006, 02:39   #256  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,556
Ah, that makes sense then. Levels (and color/coloryuv) acts independantly on each channel, so I was confused. Thanks.
foxyshadis is offline   Reply With Quote
Old 22nd October 2006, 03:03   #257  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Quote:
^If that's the case, to use the interlaced parameter for telecined material. Wouldn't the progressive frames be handled incorrectly?
They wont be handled as well as they could so to speak, but it wont really change much overall. It's a lot like using converttoyuy2(interlaced=true) on progressive YV12 material. The difference between that and using converttoyuy2(interlaced=false) on the same material isn't that great. However, using converttoyuy2(interlaced=false) on interlaced YV12 material will give quite a big difference vs using converttoyuy2(interlaced=true)... at least in areas of motion.

The reason is that when you use interlaced=true you're making luma lines 0/2 use chroma line 0, luma lines 1/3 use chroma line 1, etc... instead of making luma lines 0/1 use chroma line 0, luma lines 2/3 use chroma line 1, etc... as would happen with interlaced=false.

The difference between those two isn't going to matter much when used on progressive material since everything comes from the same point in time. However, with interlaced material where every other line could be from a different point in time the mixing of chroma from one field with luma from another (which happens with interlaced=false) can cause very visible artifacts.

Unless you have clips with changing colorimetry that you need to handle, I would recommend using:

mpeg2source("d2v.d2v")
ivtc()
colormatrix(d2v="d2v.d2v")

I've only seen a handful of clips with changing colorimetry, and most of those just had small sections at the beginning of pure black frames which had a different colorimetry than the rest of the clip. In those cases, where the difference doesn't really matter, I just change the first line or two of the d2v so that the colorimetry matches the rest of the clip.

Last edited by tritical; 22nd October 2006 at 03:15.
tritical is offline   Reply With Quote
Old 22nd October 2006, 04:24   #258  |  Link
canuckerfan
Registered User
 
Join Date: Jul 2005
Posts: 317
Thanks for the explanation, tritical. Btw, really appreciate all the hard work that's been put into TDeint and TIVTC. Here's hoping you'll have time in the future to continue the magic plugs.
canuckerfan is offline   Reply With Quote
Old 22nd October 2006, 12:23   #259  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
Thanks for the very detailed answers, got it all now
Alain2 is offline   Reply With Quote
Old 4th November 2006, 14:48   #260  |  Link
anne_so78
Registered User
 
Join Date: Sep 2005
Posts: 79
I've noticed that the ColorMatrix filter makes the picture more yellowish. Although I like the warm tinge, I don't want anything distorting my videos. I'd like the encodes to stay as true to the original as possible (Encoding from VOB to x264 using meGUI). So, should I enable or disable the ColorMatrix filter? Thanks.

P.S- I've tried reading these pages but I couldn't figure out the ColorMatrix filter...
anne_so78 is offline   Reply With Quote
Reply

Tags
colormatrix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.