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 29th October 2008, 02:29   #1  |  Link
codemonkey76
Registered User
 
Join Date: Oct 2008
Posts: 4
FadeIn/FadeOut to transparent

I have created an avisynth function (below) that creates a scoreboard that fades in and fades out, i want to overlay it onto another video. My problem is if i do a straightoverlay with no mask it fades in from a black square and fades out to a black square. If i use the ShowAlpha() it doesn't appear at all, i think the fade in/fade out is fading to black, i need it to fade to transparent:

Quote:
function Scoreboard(string "p1a", string "a1a", string "p2a", string "a2a", string "p1b", string "a1b", string "p2b", string "a2b")
{
FramesBefore = 100
FramesAfter = 300
fps = 25
fadeSpeed = 30
LeftScore = 82
RightScore = 171
ScoreHeight = 94
AdvHeight = 183

blankboard = ImageSource("C:\Video\Scoring\Scoreboard\Blank.png", 0, FramesBefore, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
p1Clip1 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + p1a + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
p2Clip1 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + p2a + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
a1Clip1 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + a1a + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
a2Clip1 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + a2a + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")

p1Clip2 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + p1b + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
p2Clip2 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + p2b + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
a1Clip2 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + a1b + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")
a2Clip2 = ImageSource("C:\Video\Scoring\Scoreboard\Numbers\" + a2b + ".png", 0, 1, fps, use_DevIL = false, info = false, pixel_type = "RGB32")

blankboard2 = ImageSource("C:\Video\Scoring\Scoreboard\Blank.png", 0, FramesAfter, fps, use_DevIL = false, info = false, pixel_type = "RGB32")

scoreboard1 = overlay(blankboard,p1Clip1,mode="blend", mask=showalpha(p1Clip1),x=LeftScore,y=ScoreHeight)
scoreboard1 = overlay(scoreboard1,p2Clip1,mode="blend", mask=showalpha(p2Clip1),x=RightScore,y=ScoreHeight)
scoreboard1 = overlay(scoreboard1,a1Clip1,mode="blend", mask=showalpha(a1Clip1),x=LeftScore,y=AdvHeight)
scoreboard1 = overlay(scoreboard1,a2Clip1,mode="blend", mask=showalpha(a2Clip1),x=RightScore,y=AdvHeight)

scoreboard2 = overlay(blankboard2,p1Clip2,mode="blend", mask=showalpha(p1Clip2),x=LeftScore,y=ScoreHeight)
scoreboard2 = overlay(scoreboard2,p2Clip2,mode="blend", mask=showalpha(p2Clip2),x=RightScore,y=ScoreHeight)
scoreboard2 = overlay(scoreboard2,a1Clip2,mode="blend", mask=showalpha(a1Clip1),x=LeftScore,y=AdvHeight)
scoreboard2 = overlay(scoreboard2,a2Clip2,mode="blend", mask=showalpha(a2Clip2),x=RightScore,y=AdvHeight)
scoreboardClip = scoreboard1+scoreboard2

return scoreboardClip.FadeIn(fadespeed).FadeOut(fadespeed)
}

Last edited by codemonkey76; 29th October 2008 at 02:57.
codemonkey76 is offline   Reply With Quote
Old 29th October 2008, 02:40   #2  |  Link
codemonkey76
Registered User
 
Join Date: Oct 2008
Posts: 4
oh i forgot to mention the usage of the function is
Scoreboard("0","0","0","0","1","1","1","1")
where 0:0 - 0:0 is the previous score and 1:1 = 1:1 is the new score
it fades in the scoreboard with the previous score, changes the score to the new score then fades the scoreboard out after a little while
codemonkey76 is offline   Reply With Quote
Old 29th October 2008, 04:38   #3  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Apply the fade in/out on the mask
http://avisynth.org/mediawiki/Mask
http://avisynth.org/mediawiki/Overlay

Another option is to Animate the opacity
http://avisynth.org/mediawiki/Animate

ps
ImageSource((...,0,0,...) is one frame
ImageSource((...,0,1,...) is two frames
mikeytown2 is offline   Reply With Quote
Old 29th October 2008, 04:49   #4  |  Link
codemonkey76
Registered User
 
Join Date: Oct 2008
Posts: 4
Quote:
Originally Posted by mikeytown2 View Post
Apply the fade in/out on the mask
http://avisynth.org/mediawiki/Mask
http://avisynth.org/mediawiki/Overlay

Another option is to Animate the opacity
http://avisynth.org/mediawiki/Animate

ps
ImageSource((...,0,0,...) is one frame
ImageSource((...,0,1,...) is two frames
sorry i am a bit of a newb still and it has taken me days to get that function to sort of work. So I just replace that last return line with what?

EDIT:
OK, i am researching what you have suggested, so should i create a clip, say 30 seconds of white and fade to black and vice-versa and use mask to apply it to the score clip? am i on the right track?

Last edited by codemonkey76; 29th October 2008 at 05:00.
codemonkey76 is offline   Reply With Quote
Old 29th October 2008, 05:18   #5  |  Link
codemonkey76
Registered User
 
Join Date: Oct 2008
Posts: 4
thanks, I guess all i needed was pointing in the right direction, i replaced the last line in the function with

Quote:
fadeClip = BlankClip(scoreboardclip,length=framesBefore+framesAfter, pixel_type="RGB32", fps=25,color=$ffffff).Fadein(30).FadeOut(30)
return Mask(scoreboardClip,fadeClip)
codemonkey76 is offline   Reply With Quote
Old 29th October 2008, 09:31   #6  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
@codemonkey76,

Read the fine print to do with FadeIn/FadeOut with regards to them adding an extra frame, it may throw off your calculations for edit points in your scripts.

Also there is a FadeIO variant.
IanB 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 09:16.


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