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 27th December 2009, 09:34   #1  |  Link
2E7AH
Registered User
 
Join Date: Mar 2009
Posts: 18
Strange color artifacts with Overlay()

Consider this code, which doesn't make sense but I simplified larger code as I could:

Code:
file = AviSource("clip.avi", audio=false)
drop = ImageSource("empty.png", pixel_type="rgb32")

y = Height(file)

Overlay(BlankClip(file, Height = 7*y, Width = Width(file), color=$ffffff), drop)

Layer(Trim(file,434,0),"add",256,0,0)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))

Layer(Trim(file,434,0),"add",256,0,y)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))

Layer(Trim(file,434,0),"add",256,0,2*y)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))

Layer(Trim(file,434,0),"add",256,0,3*y)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))

Layer(Trim(file,434,0),"add",256,0,4*y)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))

Layer(Trim(file,434,0),"add",256,0,5*y)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))

Layer(Trim(file,434,0),"add",256,0,6*y)
Overlay(drop, 0, 0, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))
where empty.png is png with transparency

Result:


Now, if we use this only once:

Code:
Layer(Trim(file,434,0),"add",256,0,0)
Overlay(drop, 6, 3, mask=ShowAlpha(Mask(drop, drop.ShowAlpha(pixel_type="rgb32"))))
it's almost like nothing happened, but as we repeat that function, the ugly artifact grows on and on.

Can someone tell me why is this happening?

Thanks

Last edited by 2E7AH; 27th December 2009 at 09:37.
2E7AH is offline   Reply With Quote
Old 27th December 2009, 09:36   #2  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Looks like artifacts from repeated colorspace conversion maybe?
Dark Shikari is offline   Reply With Quote
Old 27th December 2009, 09:57   #3  |  Link
2E7AH
Registered User
 
Join Date: Mar 2009
Posts: 18
Thanks for the fast response

I don't know if I understand you right: there is no conversion in above example code, and it happens with any clip I try
Here is another example (I needed to use ConvertToRGB here for the clip source as it is in YUY2)



How can I avoid this?
2E7AH is offline   Reply With Quote
Old 27th December 2009, 12:37   #4  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Overlay converts to YUV internally, so maybe it's compound rounding errors?

David
wonkey_monkey is offline   Reply With Quote
Old 28th December 2009, 13:15   #5  |  Link
2E7AH
Registered User
 
Join Date: Mar 2009
Posts: 18
So it seems that using Overlay() more than once in the same scene is not good idea
I managed to use Layer() instead

Thanks for explanations
2E7AH is offline   Reply With Quote
Reply

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 15:30.


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