Hi,
I'm new to avisynth but am loving the control it offers. I'm having major problems creating a fadein title for one of my videos.
I have the clip, and on top i'd like to fade in a smaller rectangle with some writing on it.
This is what I have so far
The opaque rectangle is placed correctly but does not fade in.Code:base= DirectShowSource(\"sequencer.avi\").ConvertToYUY2().Sharpen(0.5) temp1 = BlankClip(base, 180, 500, 250) temp2 = Subtitle(temp1, \"Test Subtitle\n and some more\",250,125,0, 180,\"Arial\", 60 ,$FFFFFF, align=5, lsp=1) temp3 = Trim(base, 5106, 5300) Overlay(temp3, temp2.fadein(30), 110, 100, opacity=0.5)
I've tried every different combination of multiple overlays and layers but cannot seem to get it to work.
I understand that because I'm in YUY2, I can't create a mask and do a showalpha()?
I want the background clip to be constantly there, thus preventing a overall FadeIn on the Overlay
I'm also trying to get the subtitle to have no opacity (while the background plate is 0.5 opacity)
(PS is there a good resource on explaining masks in a avisynth setting? I still haven't fully grasped it yet)
Thanks for any help you might be able to shed, these forums have been invaluable to me so far.
cheers
damo
+ Reply to Thread
Results 1 to 13 of 13
-
-
**bump**
Can anyone help me out or point me in the right direction?
cheers
damo -
are you trying to fade in the black box from 0 to 50% opacity ? and they fade out or stay at 50%?
what about the timing of the text ? how do you want it to fade in or out or stay ? and do you want it timed in unison with the black box ?
the problem you have right now is your 50% opacity black box is controlled by the overlay command, so you would have to animate the opacity parameter from 0 to 0.5 ; but animate() is difficult to use in that fashion - it is usually used to control a filter, not part of a filter. I don't know how to do it, maybe someone else does.
There are probably better ways to do this, but one approach this would be to create your 50% opacity black box in an image editor (e.g. photoshop, irfanview, gimp) . I attached one below. You have to use an image format that supports alpha channel (e.g. png) , and use RGBA or RGB32 (in order to use the alpha channel later)
in this example, the black box and the white text fade in at the same time, but you weren't clear about how you wanted the timing or if you wanted it to fade out. Because the opacity is controlled by the the asset itself instead of through the overlay command (it was made in an image editor and when at max opacity, is actually 50%), you can use the fadein() to control it
base=AVISource("video.avi").trim(5106,5300)
black=ImageSource("50.png",pixel_type="RGB32")
temp2 = Subtitle(black, "Test Subtitle",250,125,0, 180,"Arial", 60 ,$FFFFFF, align=5, lsp=1)
overlay(base,black,mask=black.showalpha().fadein(3 0), 110,100, opacity=0.1)
a=last
overlay(a, temp2,mask=temp2.showalpha().fadein(30), 110,100)
The only reference I know of is
http://avisynth.org/mediawiki/Overlay
Note: as in that link, the levels of your clip or overlay might need to be adjusted if you are using PC vs. TV Levels with the coloryuv command . Since you used ConvertToYUY2() in your example (instead of specifying a PC matrix), I'm assuming your clip is TV levels.
Or you can "cheat" and adjust the opacity of the black clip by using the opacity parameter of the overlay command. If your AVI clip was TV levels (16-235), if you add opacity=0.1 to the black overlay, it will approximate what you had in your first example in terms of black opacity (since overlay and RGBA are all done in full range 0-255, and the 50% black clip was done using 0-255), instead of having to do the levels conversions - I changed the post above to reflect thatLast edited by poisondeathray; 29th Aug 2010 at 10:56.
-
Thanks so much for that.
I was hoping to fadein the box and subtitle at the same time, and then fade them out together as well.
I like the idea of doing a 50% transparent png instead of creating a blankclip. I'm in yuy2 space (only because that is what the original video is) so will convert to RGB32 just for this trim/overlay and then back again.
Thanks again for your help!
cheers
damo -
I was hoping to fadein the box and subtitle at the same time, and then fade them out together as well.
http://avisynth.org/mediawiki/Fade
e.g.
base=AVISource("video.avi").trim(5106,5300)
black=ImageSource("50.png",pixel_type="RGB32",0,80 )
temp2 = Subtitle(black, "Test Subtitle",250,125,0, 180,"Arial", 60 ,$FFFFFF, align=5, lsp=1)
overlay(base,black,mask=black.showalpha().fadeIO(2 0), 110,100, opacity=0.1)
a=last
overlay(a, temp2,mask=temp2.showalpha().fadeIO(20), 110,100)
Personally , I don't like converting to RGB and back to YV12 if I don't have to (quality loss) , but it's up to you .Last edited by poisondeathray; 29th Aug 2010 at 17:56.
-
Thank you so much!!!
All working now.
RGB vs YUY2? I've kept it in YUY2 as that is what it was originally encoded in. I'm chopping and rearranging the original clip. Would I be better off converting to RGB to start with and leaving it that way?
cheers
damo -
There is a bit of quality loss when you convert colorspaces (rounding errors). I can't see any advantage to converting to RGB and back to YUY2, if it looks ok now. Overlay() can overlay the RGBA overlay onto YUV sources , it's not a problem. Only if your final format goal was RGB or you are bringing this into another application that expects RGB (e.g. compositing programs, or some editors) would I consider converting the base clip to RGB (but if you were going to do that, you could just as easily add the overlay in those programs....)
-
Hi,
I do not open a new thread because what I want to do is very similar to the issue of doma79.
I wrote this following script whish is working fine. It makes appear an animated logo in the upper right corner of the video :
vid=DirectShowSource("video.wmv", 25.00, convertfps=true).ConvertToRGB32
logo=CoronaSequence("i*.bmp",sort=2,textmode=1).Co nvertToRGB32
# mask the grey background but leave the other colors unchanged
logo=ColorKeyMask(logo,$4d4d4d,$000000)
overlay(vid,logo,mask=logo.showalpha().fadein(30), 110,100, opacity=0.1)
# place the image into the upper right corner of the video
ovl=Layer(vid,logo,"add",255,370,0)
return ovl
base=AVISource("video.avi")
logo=ImageSource("image.jpg",pixel_type="RGB32",0, 80 )
overlay(base,logo,mask=logo.showalpha().fadeIO(20) , 110,100, opacity=0.8)
Thanks for helping. I apologize for my poor english.
Of course, I can move and open another thread. -
The 'overlay' command here is not used (its result is ignored) and can be removed from the script - the Layer command is what is doing the overlay.
I'd like the animated logo to fade in then fade out, after a while. Unfortunately I am not sure, opacity could work with CoronaSequence filter.
As I said, remove the 'overlay' line. In its place, put this:
logo = Mask(logo, logo.ShowAlpha().FadeIO(30)) -
Oups, of course the 'overlay' command is not used; I think this was a "scorrie" of a previous test.
Anyway, thanks for your answer; this is exactly what I wanted to do.
Maybe you could help me for the last step of my script. I'd like this sequence of animated logo to stop after 25 frames and restart every 30 seconds during the whole video. I have found this filter ApplyEvery.dll but I need firstly to order the logo animation to stop and disappear after 25 frames.
I hope that what I say makes sense for you.
Thanks Gavino ... -
How many frames are you currently getting from CoronaSequence?
If less than 25, use Loop() to repeat an appropriate number, otherwise use Trim() to reduce the length (or delete some source image files).
Obviously, you will also have to reduce the alpha fade in and out time (FadeIO) to something below 12 frames. -
Thanks Gavino,
here is my new script using loop :
Code:vid=DirectShowSource("video.wmv", 25.00, convertfps=true).ConvertToRGB32 logo=CoronaSequence("F:\Windows7 Documents\logo\i*.bmp",sort=2,textmode=1).ConvertToRGB32.ColorKeyMask($4d4d4d,$000000).fadeio(10).loop() ovl=Layer(vid,logo,"add",176,370,0) return ovl
What I failed to do, is to introduce a kind of "pause"between each loop. It means that I'd like my logo animation to start its sequence every 30 seconds. Here in this video, you can watch excatly what I mean : http://rutube.ru/tracks/50456631.html
ThanksLast edited by kaskaï; 12th May 2012 at 15:05.
-
I can't see anything on that site (perhaps because of my security settings, which I'm reluctant to change).
As I understand it, you want the logo sequence to last 25 frames and restart every 30 seconds. Is that right?
Loop() by default makes the clip repeat (almost) indefinitely.
But the idea was to use it to repeat the logo sequence for up to 25 frames - say you had 5 frames, then you would use Loop(5).
Then, as you suggested, use ApplyEvery to overlay that 25-frame logo sequence every 30 seconds.
Similar Threads
-
FadeIn/FadeOut (Avisynth) question
By Cherbette in forum EditingReplies: 5Last Post: 20th Jan 2012, 21:27 -
Avisyth and overlay transparent png looking strange
By lindylex in forum EditingReplies: 4Last Post: 15th Aug 2010, 17:23 -
Transparent logos, aegisub and AviSynth
By shorto in forum EditingReplies: 17Last Post: 20th Feb 2010, 19:35 -
Help with Avisynth overlay
By WAKA in forum Newbie / General discussionsReplies: 12Last Post: 14th Jul 2009, 12:37 -
AviSynth - JDL_ApplyRange() & FadeIn() Compatibility Issue?
By Typhoon859 in forum Video ConversionReplies: 18Last Post: 4th May 2009, 19:29