Newbie here. I'm trying to use Avisynth to basically overlay one video (pip) on top of another video (base) at a certain time point (in the base). So I've been trying to fade the pip into the base using Overlay and Fade and I'm not getting it to work. The problem I'm having is the fade-in part. The pip isn't completely transparent to begin with, and when it's suppose to fade-in it doesn't really do so...all I see is a small portion of the pip fade-in...while 90% of the pip doesn't show at all. All the examples I've found seems so straight forward - what am I doing wrong? Thanks in advance.
Code:base = AviSource("base.avi") base = base.ConvertToYUY2() base = base.ConvertToRGB32() pip = AviSource("pip.avi") pip = pip.Loop(Round(8*FrameRate(base)), 0, 0) pip_xpos = Width(base)/2 - Width(pip)/2 pip_ypos = Height(base)/2 - Height(pip)/2 pip_fade = pip.ConvertToRGB32() pip_fade = pip_fade.FadeIO(5) Overlay(base, pip_fade, mode="blend", mask=showalpha(pip_fade), x=pip_xpos, y=pip_ypos)
+ Reply to Thread
Results 1 to 14 of 14
-
Last edited by jelythefish; 5th Apr 2013 at 11:11.
-
I took some screen caps. The first image captures the first frame of the pip (standalone). The second image (cropped) captures the output of the Avisynth script (first frame). Maybe I'm doing something fundamentally wrong. I'm editing my script (test.avs) and all I'm doing is double clicking that file (after saving) and Windows Media Player pops up and shows the second image below.
-
Try opening your script in VirtualDub.
I tried your script with a couple random AVI files and got a small video (though only a singel frame of the video) fading in at the middle of a larger video. Which is, I believe, what you intended to do.Last edited by jagabo; 5th Apr 2013 at 12:10.
-
Same problem with virtualdub - does this have anything to do with the ColorKeyMask? Should I try something else besides Avisynth? Thanks for the help by the way jagabo.
-
Work through your script stepwise to see where it works and where it doesn't.
E.g.:
Line1 -> OK
Line1+2 -> OK
Line1,2,3 -> OK
Line1,2,3,4 -> Bad - Then you know your 4th line is the problem (and possibly why). Of course, Vdub will usually give you an "AVISynth error on Line4" message.
Even more description/information, please...
Scott -
I'm confused at what you're trying to do
Describe what "pip.avi" is, what it's supposed to show - is it the screenshot above? Was it prepared with alpha channel (transparency) ? ConvertToRGB32 will add an alpha channel ,but it's a "dummy" alpha channel, not a real one that you use. You're using showalpha for the alpha channel mask in the overlay , there will be nothing to show if it doesn't have an alpha
base = base.ConvertToYUY2()
base = base.ConvertToRGB32()
Can you describe in more detail what you want to do, what the video is, and how you want the PIP portion to appear . For example, is the PIP portion supposed to be black (I see a console window, with text "hello world"). Is the background supposed to be black, or transparent with another video showing through?Last edited by poisondeathray; 5th Apr 2013 at 12:53.
-
Any chance the overlay is bigger than the base? Never mind. I thought overlay would barf if the overlay was larger than the base. But it doesn't. Though this might version dependent. So check anyway.
-
The pip isn't completely transparent to begin with, and when it's suppose to fade-in it doesn't really do so
Timing of fade-in - what are the frame counts and frame rates for the base.avi and pip.avi ? -
pip.avi is a screen capture video of a terminal screen...I run a program that outputs to standard out, the program last for like 7 seconds or something. I used virtualdub for the screen capture, and it was not prepared with alpha channel (transparency).
The base video is about a 5 min tutorial like video and the pip is suppose to show a demo of an example. All I need is for the pip to fade in and fade out at the right time. The pip video is just a terminal window with black background. I capture other parts of the pip if that helps. -
First thing is first, as Scott recommended, make sure you can even open a basic overlay script, to rule out avisynth install problems, then go step by step. I don't know how you got that 2nd screenshot. You don't need showalpha() channel for this, unless your overlay has been prepared with alpha channel
Timing problems might be due to clip length or fps, please answer those questions . When did you want the PIP insert to fade in? What frame ?
When you use overlay, the overlay will start at frame zero. You can't control the timing this way. Lets say you want to fade in to start at 10 seconds, not frame zero . The workarounds this are to either divide up sections of the base video using trims() , then alignedsplice to rejoin them; or replaceframessimple() and apply the overlay to those segments that way, or prepare the PIP with an alpha channel and fades, the same length and fps of the video
I made some sample test videos
base.avi , xvid, 640x360, 0 to 479 = 480 frames, 23.976 fps
pip.avi, xvid , 360x152, 0 to 120 = 121 frames, 23.976 fps
Example1
Code:base=AVISource("base.avi") pip=AVISource("pip.avi").fadeio(5) overlay(base, pip)
Code:base=AVISource("base.avi") pip=AVISource("pip.avi").fadeio(5) base trim(100,0) overlay(last, pip) partb=last base.trim(0,99) ++ partb
Last edited by poisondeathray; 5th Apr 2013 at 14:27.
-
thanks for the help poison ... I will have try this tonight...right now I got baby watchin duties.
-
Sorry for the long delay. Baby's been kicking my butt over the weekend.
I had inline comments but decided to nix my original post when I got your code part...long story short, I got the output that you described with your sample code. Hopefully I learned something from your examples, I'll post if I'm successful or further frustrated. -
Thanks for everyone for the help - I essentially got the output I wanted using poison's sample code as a guide. Thanks again (whoo-hoo)
Similar Threads
-
AVISynth Overlay Image Help
By smike in forum EditingReplies: 11Last Post: 17th Sep 2012, 11:04 -
AviSynth Overlay and Trim Help
By NMeade in forum Newbie / General discussionsReplies: 20Last Post: 1st Apr 2012, 07:53 -
Using AVISynth to overlay PNG subtitles?
By csdesigns in forum SubtitleReplies: 8Last Post: 3rd Feb 2012, 11:36 -
AviSynth Audio Overlay
By legocrazy1 in forum EditingReplies: 7Last Post: 14th Jul 2010, 10:01 -
Help with Avisynth overlay
By WAKA in forum Newbie / General discussionsReplies: 12Last Post: 14th Jul 2009, 12:37