Log in

View Full Version : Problem with logo fading using overlay()


moelover
11th January 2014, 15:56
I want to overlay video
I use this code

LoadPlugin("F:\Program\megui\tools\avisynth_plugin\VSFilter.dll")

raw = DirectShowSource("F:\raw.mkv", fps=23.976,
audio=false, convertfps=true)
logorgb = aviSource("F:\Logo RGB.avi")
logoalpha = aviSource("F:\Logo Alpha.avi")

raw

clip1 = raw.trim(0,2231)+trim(2232,2252).overlay(logorgb,0,0,logoalpha)+trim(2253,88000)

fin=clip1

return(fin)


it's work but my logo have fading function when them fade backgroud is black color.
same sample picture.

http://img.ihere.org/uploads/623eb000d8.jpg

sorry my bad english.
help me please.

Guest
11th January 2014, 16:04
Please try to use a descriptive thread title in the future. I have edited it for you. That will make it easy for our readers to know if the thread is interesting to them. Thank you and welcome to the forum!

If this isn't solved by our experts within hours I will be very surprised. :)

vampiredom
11th January 2014, 19:56
You may want to try applying Unpremultiply() on the masked logo. You can find the newest version attached to this post:
http://forum.doom9.org/showthread.php?p=1608283#post1608283

In your case:

logorgb = aviSource("F:\Logo RGB.avi").ConvertToRGB32()
logoalpha = aviSource("F:\Logo Alpha.avi").ConvertToRGB32()

logoRGBA = logorgb.Mask(logoalpha).Unpremultiply()

Overlay(logoRGBA,0,0,logoRGBA.ShowAlpha())

vampiredom
11th January 2014, 20:00
Also, in my experience, Layer() usually works more accurately than Overlay() ... but you will also need to convert your source to RGB32 (and then back to YV12 or whatever pixel type you want for output)

poisondeathray
12th January 2014, 01:18
How are you applying the fade ?

I think if you apply the fade only to the alpha it should work . But If I apply the fade to RGB+A, I get the same results as you

http://i39.tinypic.com/2u9hdll.jpg

Youka
12th January 2014, 02:19
vampiredom already wrote it:
You may want to try applying Unpremultiply() on the masked logo.Fade to RGB+A happens considering non-premultiplied alpha. It expects to have the original color and an alpha value, but your image has the color already multiplied with the alpha and the alpha stored as additional information to undo it.

Guest
12th January 2014, 02:28
If this isn't solved by our experts within hours I will be very surprised. :) You guys didn't let me down. :)