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 8th October 2004, 19:23   #21  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
You need to use it in case your source is: MPEG2 default or SMPTE 240M standard (both set of coefficients are approximately the same).

The other set of coefficients are approximately the same and equal to the MPEG1 coefficients.

It doesn't really matter what your target is. If you use VDub or AviSynth, these matrix coefficient info is lost, and mpeg1 coefficients will be assumed during playback (at least for DivX/XviD/TMPGEnc/QuEnc, not sure about CCE).

Quote:
Should I use ColorMatrix before converting to ConvertToYUY2 for CCE and ConvertToRGB24 for TMPGE?
Yes. Just directly after loading the source.

Perhaps you can make an avs script, encode it to MPEG2 with CCE, and post the coefficients for me?
Wilbert is offline   Reply With Quote
Old 9th October 2004, 01:47   #22  |  Link
ltc
Registered User
 
Join Date: Jul 2004
Posts: 6
Hmn, interesting. The source DVD is NTSC interlaced. Color coefficient is S170 (SMPTE 170M) according to GSpot.
I re-encoded to D1/2 size using KSVCD template. Encoded with tmpgenc the result video has FCC coefficient. Encoded with CCE, no coefficient present.

script:
Mpeg2Source("D:\TietNhonQuy_DVD\TietNhonQuy_01.d2v")
ColorMatrix()
#
crop(8, 0, -32,0)
GripCrop(352, 480, source_anamorphic=false)
GripSize(resizer="LanczosResize")

dgbob(FOrder(),mode=1 )
convert60ito24p(2,0)
DegrainMedian(mode=1)

converttoyuy2()

# Detect field order
function FOrder(clip c) {
fo= GetParity(c)? 1:0
return fo
}
ltc is offline   Reply With Quote
Old 10th October 2004, 12:33   #23  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
Quote:
Encoded with CCE, no coefficient present.
That's interesting. It means if you are doing DVD -> DVD using AVS_YUY2 -> CCE, the same coefficients are used (in both cases the default MPEG2 coefficients). Thus, in this case, you shouldn't apply ColorMatrix.
Wilbert is offline   Reply With Quote
Old 26th October 2004, 23:46   #24  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
I put up a new version (v1.4). Changelog:

* Added a mode parameter (default is mode="mpeg2->mpeg1" which gives the same output as older versions).

In case you captured something or you have a XviD/DivX (both are encoded mpeg1 coefficients), and you want to encode it to mpeg2 using CCE (which assumes mpeg2 coefficients):

ColorMatrix(clip, mode="mpeg1->mpeg2")

* Added rgb=true, which converts to RGB24 using mpeg2 coefficients.

The following converts a YV12/YUY2 stream to RGB24 using MPEG-2 coefficients (which might be useful if you want to convert DVD to mpeg2 using TMPGEnc):

ColorMatrix(clip, rgb=true)

It should give the same results as

ColorMatrix(clip, mode="mpeg1->mpeg2")
ConvertToRGB24()
Wilbert is offline   Reply With Quote
Old 29th October 2004, 06:06   #25  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,322
Is rgb=true the default in the new version? The filter was slower than usual with just ColorMatrix(), adding rgb=false fixed that.

I'd also like to clear some things up, is this the correct way:

1) DivX/XviD clip to MPEG-2 in CCE : ColorMatrix(mode="mpeg1->mpeg2")
2) MPEG-2 capture (no coeffs shown) to MPEG-2 in CCE : ColorMatrix()
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 29th October 2004, 08:53   #26  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
Quote:
Is rgb=true the default in the new version? The filter was slower than usual with just ColorMatrix(), adding rgb=false fixed that.
Default is rgb=false.

Btw, rgb=true is the same as

ConvertToRGB(matrix="rec709")

which should be faster. I didn't know that when adding that option

Quote:
1) DivX/XviD clip to MPEG-2 in CCE : ColorMatrix(mode="mpeg1->mpeg2")
Yup.
Quote:
2) MPEG-2 capture (no coeffs shown) to MPEG-2 in CCE : ColorMatrix()
That's a tricky one. Of course, your cap application (assuming it's just an analog cap) doesn't know which coefficients should be used. Since pal/ntsc standards always (should) use mpeg1 coefficients (ITU BT.601-4), you should use
ColorMatrix(mode="mpeg1->mpeg2")
Wilbert is offline   Reply With Quote
Old 29th October 2004, 09:04   #27  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,322
Thanks, that cleared things up
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 30th October 2004, 16:53   #28  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
I put up a new version. In the previous ones, the used coefficients were slightly wrong. Although the difference is not noticable in practice

btw, I corrected the naming convention. MPEG-2 coefficients are called Rec.709 and MPEG-1 coefficients Rec.601. Thus

ColorMatrix(clip, mode="Rec.709->Rec.601") (default)
ColorMatrix(clip, mode="Rec.601->Rec.709")

I advice you to use the internal

ConvertToRGB(clip, matrix="Rec.709")

instead of

ColorMatrix(clip, rgb=true).

Output is identical (thx IanB), but the former is faster.

Last edited by Wilbert; 30th October 2004 at 16:56.
Wilbert is offline   Reply With Quote
Old 2nd January 2005, 05:46   #29  |  Link
North2Polaris
Registered User
 
North2Polaris's Avatar
 
Join Date: Jul 2003
Location: Connecticut
Posts: 99
ColorMatrix and Gordian Knot

@Wilbert,

I recently used your filter on a Mpeg2 to Xvid conversion using AviSynth and VDubMod. The difference, to my eyes at least, was remarkable. I have wondered why past encodes were "less bright" than I expected and needed to be adjusted.

I took a look at the AviSynth plugins that come with Gordian Knot. I did not see ColorMatrix among them, which surprised me given the discussion in the current thread and the following threads:

http://forum.doom9.org/showthread.ph...0&pagenumber=3

http://forum.doom9.org/showthread.php?s=&threadid=81191

Does Gordian Knot handle this problem another way or not at all?

Thanks for your work on this! Happy New Year!

North
North2Polaris is offline   Reply With Quote
Old 2nd January 2005, 13:53   #30  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
Quote:
Does Gordian Knot handle this problem another way or not at all?
No. Perhaps len0x is not aware of the problem. Did you ask him about this?
Wilbert is offline   Reply With Quote
Old 2nd January 2005, 15:52   #31  |  Link
North2Polaris
Registered User
 
North2Polaris's Avatar
 
Join Date: Jul 2003
Location: Connecticut
Posts: 99
Quote:
Originally posted by Wilbert
No. Perhaps len0x is not aware of the problem. Did you ask him about this?
@Wilbert,

I just sent a PM to len0x about this.

I tried using LumaFilter in DGDecode to adjust the "brightness".

From DGDecode html,

Quote:
Useful additional YV12 Filters :

To Darken Luminosity.

LumaFilter(-10,0.9)

To Ligthen Luminosity.

LumaFilter(+10,1.1)
Will lightening luminosity address the brightness problem addressed by ColorMatrix or just "cover it up"?

North
North2Polaris is offline   Reply With Quote
Old 2nd January 2005, 16:02   #32  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,322
The original problem is not actually the brightness, it's that the colors are off slightly.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 2nd January 2005, 16:10   #33  |  Link
len0x
I'm afraid we've to stop
 
len0x's Avatar
 
Join Date: Mar 2003
Location: Amongst mad people
Posts: 5,400
Hm... Am I right in understanding that every DVD source needs to be converted to a proper color matrix before encoding into MPEG4?

*Edit* remark about RGB removed
__________________
Gordian Knot Family:
Gordian Knot: website, download
Auto Gordian Knot: Website and download, tutorial, FAQ

Last edited by len0x; 2nd January 2005 at 16:22.
len0x is offline   Reply With Quote
Old 2nd January 2005, 16:35   #34  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
Quote:
Hm... Am I right in understanding that every DVD source needs to be converted to a proper color matrix before encoding into MPEG4?
Yup, well "to the same color matrix" as MPEG4 uses/assumes (Rec.601 coefficients).
Wilbert is offline   Reply With Quote
Old 2nd January 2005, 16:52   #35  |  Link
North2Polaris
Registered User
 
North2Polaris's Avatar
 
Join Date: Jul 2003
Location: Connecticut
Posts: 99
Quote:
Originally posted by Boulder
The original problem is not actually the brightness, it's that the colors are off slightly.
@Boulder,

Thanks. When you don't know that the underlying problem is a color problem, it looks like a problem with brightness, which can lead to unsatisfactory attempts to correct it.

North
North2Polaris is offline   Reply With Quote
Old 2nd January 2005, 17:19   #36  |  Link
len0x
I'm afraid we've to stop
 
len0x's Avatar
 
Join Date: Mar 2003
Location: Amongst mad people
Posts: 5,400
Quote:
Originally posted by Wilbert
Yup, well "to the same color matrix" as MPEG4 uses/assumes (Rec.601 coefficients).
Bummer - now I have a dilemma since speed loss is at least 10% when doing correction so it might not be a good idea to make it default in GK/AGK...

Btw, do you have XML description of the filter? (I can add it to GK then)
__________________
Gordian Knot Family:
Gordian Knot: website, download
Auto Gordian Knot: Website and download, tutorial, FAQ
len0x is offline   Reply With Quote
Old 2nd January 2005, 17:25   #37  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
Quote:
Bummer - now I have a dilemma since speed loss is at least 10% when doing correction so it might not be a good idea to make it default in GK/AGK...
I wish I could do MMX

Quote:
Btw, do you have XML description of the filter? (I can add it to GK then)
Not yet. I will do it this week and send you a pm.
Wilbert is offline   Reply With Quote
Old 2nd January 2005, 17:30   #38  |  Link
len0x
I'm afraid we've to stop
 
len0x's Avatar
 
Join Date: Mar 2003
Location: Amongst mad people
Posts: 5,400
Quote:
Originally posted by Wilbert
Not yet. I will do it this week and send you a pm.
cheers
__________________
Gordian Knot Family:
Gordian Knot: website, download
Auto Gordian Knot: Website and download, tutorial, FAQ
len0x is offline   Reply With Quote
Old 17th January 2005, 06:46   #39  |  Link
Steve56
Registered User
 
Join Date: Jun 2002
Posts: 38
ColorMatrix does virtually the same as BT709ToBT601 from http://mywebpages.comcast.net/trbarry/downloads.htm, or?

Steve56

Last edited by Wilbert; 17th January 2005 at 10:23.
Steve56 is offline   Reply With Quote
Old 17th January 2005, 10:26   #40  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,295
I corrected the url above

Yes that's true, I noticed that too late. His plugin contains optimization code, so it might be faster. (btw, hdtv isn't always Rec.709 as suggested in his docs ...)
Wilbert 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 01:49.


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