VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Is there a way to create a star wipe transition in avisynth?
    Quote Quote  
  2. I don't believe there's a star wipe, but VC Mohan has included a bunch of other kinds in his Transall filter:

    http://www.avisynth.nl/users/vcmohan/TransAll/index.html

    The transcrumple transition looks somewhat similar.

    Maybe someone will correct me or even write one for you.
    Quote Quote  
  3. I don't think there are premade ones specifically for "star wipe", (ie. wrapped into a dll or function) - but you can do pretty much any type of "wipe" or "reveal" transition of any shape using an alpha matte or luma matte

    But generating the animation for the matte layer from complete scratch in avisynth would be difficult (you would need at least an image or vector of your star shape (or whatever shape you want) , then you might be able to use animate() to scale it or animation position over time) . Vectors are better, because they are infinitely scalable without quality loss. Whereas doing it in avisynth it would be rasterized and the edges would look very ratty and bad at higher scaling factors. But you would use overlay() or mt_merge() using the matte layer to control the opacity. 100% black would show clip "A" , and 100% white would show clip "B"

    It's easier to make the matte layer animation in other programs . I can make one for you quickly . But I need to know the "type" of star transition. Is it a double outline star, 5 pointed simple star, single star, or multiple stars, or colored outlines etc.. Does it scale in the center from "nothing" for the reveal? Or does it come from a direction (e.g. left to right, top to bottom, or angle? like 36.5 degrees etc...spinning star, spiral star with path accumulation, etc... There are probably thousands of variations on "star transition"

    It should be possible to write a generic alpha matte function for avisynth, where it takes input parameters, a standard matte transition clip (black/white animation), and you can customize parameters like timing (number of frames in the transition) . Or for static shapes - direction.
    Quote Quote  
  4. And another place to look is dvd slideshow gui - I think it has over 250 transitions but I don't know if it has a "star wipe" specifically. I think most of them are avisynth driven, so you can dig around in the script


    If what I said about "alpha matte" doesn't make sense , it's like the example in this post - the white/black animation drives the reveal or wipe from A to B

    https://forum.videohelp.com/threads/381637-Tried-most-editors-but-still-looking-for-mo...ns#post2469825


    It's the same concept in avisynth or NLE's. The matte layer is called "mask" in avisynth for mt_merge() or overlay() . It can be a bit tricky, but if you remember that the mask layer that controls everything , including timing of the transition, that should keep everything straight. In a NLE, it's a bit easier for most people , because everything is graphically depicted, you get instant feedback, and can make timing adjustments or modifications easily
    Quote Quote  
  5. Make a white star on black, animate the size, use as Overlay mask. Like so:
    Code:
    ## EXAMPLE BACKGROUND (CLIP BEING WIPED OFF)
    ColorbarsHD(width=640, height=400)
    Amplify(0)
    Trim(0, length=300)
    B = Last 
    
    ## EXAMPLE OVERLAY (CLIP BEING WIPED ON)
    ColorYUV(showyuv=true)
    BilinearResize(B.Width, B.Height)
    Trim(128, length=1).Loop(FrameCount)
    O = Last 
    
    ## MASK CLIP
    ## ("Pow" is to make zoom faster as it gets larger)
    ## ("6.5 * Height" just fills the screen -> depending on aspect ratio)
    maxsize = Pow(6.5*Height, 1.0/6.0) 
    
    ## ("120" = wipe duration about 2 sec.)
    Animate(0, 120, "animfilter", 
    \   0.0, maxsize
    \ )
    M = Last.ColorYUV(levels="TV->PC")
    
    B.Overlay(O, mask=M)
    return Last
    
    ###########
    function animfilter(clip C, float fontsize)
    {
        fontsize = Pow(fontsize, 6.0)
        return (fontsize<0.7) ? C
        \ : C.Subtitle("«", font="Wingdings", 
        \           size=fontsize, 
        \           x=-1, y=(0.5*C.Height)+(0.5*fontsize), 
        \           text_color=$ffffff)
    }
    Image
    [Attachment 44971 - Click to enlarge]
    Last edited by raffriff42; 22nd Mar 2018 at 18:34. Reason: reverted previous edit
    Quote Quote  
  6. nice example rr42 .... wingdings! very creative
    Quote Quote  
  7. Thanks for the suggestions! Would something like this be possible? I guess it's not exactly a star wipe. It looks like it has fuzzy/semi-transparent edges.

    Image
    [Attachment 44987 - Click to enlarge]
    Last edited by videeo; 21st Mar 2018 at 21:12.
    Quote Quote  
  8. Originally Posted by videeo View Post
    Thanks for the suggestions! Would something like this be possible? I guess it's not exactly a star wipe. It looks like it has fuzzy/semi-transparent edges.

    Yes, you can blur the mask edges in avisynth to get "semi transparency" or "fuzzy edges"

    You should just be able to animate the scale up a rotated letter "x" from some font with rr42's method . You can embellish with motion blur




    Or you can make it quite easily in other programs and use it as an overlay
    Image
    [Attachment 44990 - Click to enlarge]



    I exported this mp4 and used it as an overlay in avisynth. I cheated here, I just used x264 in rgb mode. Using itself as the alpha channel (because it's black/white) . Normally you would use a standard RGBA format like lagarith, or a png sequence , or qt animation codec. And you would have to if the animation wasn't black/white or you'd have to render out a separate alpha channel to use. Eitherway the other options would be much larger than the "cheat" method

    You can do various manipulations, reposition, change colors, add "glow" (overlay in "add" blend mode , with opacity tweaking), change timing etc... all in avisynth

    This is the avs I used for the gif . YT deadpool trailer as the background. You just scale and manipulate the overlay using itself as the mask . I changed timing by discarding frames (the full animation is 1920x1080, 30 frames , 30fps, thus 1 sec)

    Code:
    LSmashVideoSource("Deadpool Official Trailer #1 (2016) - Ryan Reynolds Movie HD - YouTube 1080.mp4")
    trim(1417,1446)
    crop(0,142,0,-142,true)
    bicubicresize(432,180)
    bg=last
    
    a=bg.trim(0,14)
    b=bg.trim(15,0)
    
    ovr=ffvideosource("rgb.mp4").selecteven().assumefps(24000,1001).bicubicresize(640,360)
    
    overlay(b,ovr, mask=ovr, x=-10, y=-100, mode="blend", opacity=1)
    c=last
    
    a+c
    selecteven()
    Image Attached Files
    Quote Quote  
  9. Good stuff, poisondeathray. I was just adding a softness option above, check it out.
    EDIT, scratch that - here's the new code packaged into a user function.
    One caveat, I get rare, random access errors (the output in VirtualDub freezes) and can't find the cause
    Code:
    ## EXAMPLE BACKGROUND (CLIP BEING WIPED OFF)
    ColorbarsHD(width=640, height=400)
    Amplify(0)
    Trim(0, length=300)
    B = Last 
    
    ## EXAMPLE OVERLAY (CLIP BEING WIPED ON)
    ColorYUV(showyuv=true)
    BilinearResize(B.Width, B.Height)
    Trim(128, length=1).Loop(FrameCount)
    O = Last 
    
    StarWipe(B, O, 120, 0.0)
    
    return Last
    
    ##################################
    ### old school star wipe
    ##
    ## @ dur - number of frame to complete the wipe
    ##         (note there are some "dead" frames on both ends)
    ## @ soft - amount of edge softness; range 0 to about 5
    ##
    function StarWipe(clip B, clip O, int dur, float soft)
    {   
        B
        dur     = Min(Max(1, dur), 300)
        soft    = Max(0.0, soft)
        maxsize = Pow(6.5*Height, 1.0/6.0) 
    
        BlankClip(Last, 
        \   width=CalcWidth(128, mod=2), 
        \   height=128,
        \   pixel_type="YV12")
    
        M = Animate(0, dur, "_StarWipeAnim", 
        \   0.0,     soft/32.0, 
        \   maxsize, soft
        \ ).BilinearResize(B.Width, B.Height)
    
        B.Overlay(O, mask=M.ColorYUV(levels="TV->PC"))
        return Last
    
        ###########
        function _StarWipeAnim(clip C, float fontsize, float softness)
        {
            fontsize = (fontsize<1.1) ? 0.0 : Pow(fontsize, 6.0)
            fontsize = Min(Max(0.0, fontsize), 1000.0)
            softness = fontsize / 100.0 * softness
            softness = Min(Max(0, softness), 0.5*C.Height)
            R = (fontsize<0.7) ? C
            \ : C.Subtitle("«", font="Wingdings", 
            \           size=fontsize, 
            \           x=-1, y=(0.5*C.Height)+(0.5*fontsize), 
            \           text_color=$ffffff)
            R = (softness<0.01) ? R
            \ : R.QGaussBlur(softness)
            return R
        }
    }
    
    ## the following is taken from my utilities script
    # https://raw.githubusercontent.com/raffriff42/AvisynthPlusUtilities/master/Utils-r41.avsi
    
    ##################################################
    ### quick Gaussian blur
    ##
    function QGaussBlur(clip C, float radx, float "rady")
    {
        radx = Max(1.0, radx)            
        rady = Max(1.0, Default(rady, radx))
        return (radx<0.1 && rady<0.1) ? C
        \ : C.BilinearResize(
        \        Max(16, m4(Float(C.Width)/(radx+1.0))), 
        \        Max(16, m4(FLoat(C.Height)/(rady+1.0))))
        \    .Blur(0.3) [*  *]
        \    .GaussResize(
        \        C.Width, C.Height, p=19)
        ## p=19: softest w/o visible 'blockiness' 
    }
    
    ##################################
    ### MOD-4-and-at-least-16 helper function
    ## (round to nearest)
    ## @ Didée
    function m4(float f) 
    {
        (f<16) ? 16 : Int(Round(f/4.0)*4)
    }
    Last edited by raffriff42; 22nd Mar 2018 at 18:44.
    Quote Quote  
  10. Originally Posted by raffriff42 View Post
    EDIT, scratch that - here's the new code packaged into a user function.
    One caveat, I get rare, random access errors (the output in VirtualDub freezes) and can't find the cause
    v2 works for me rr42. No access errors. But it should be mentioned that it also requires CalcWidth, also part of the Utils-r41.avsi; and avisynth+

    But that was in avspmod. It looks correct there. I'm getting weird results in vdfm . I can see the "star" and the character to the left, the "clock". Both scaling..... WEIRD ?!? In vdub classic x64 and vdfm/vdub2 x64 and mpchc x64. Maybe some system issues....



    How about a generic clip wipe function, with alpha channel? where you can load an external clip and have the function do the animation scaling and overlay part with the same dur (duration) parameter? I can see a common scenario with something like a transparent png, or logo etc... not even necessarily a "video" file. That would open up many possibilities beyond a "star" or font/wingding types

    Scaling down is better than scaling up for the edge quality issues. So maybe an option for a "larger" logo or png or video , and you can reverse the transition ? just some ideas
    Last edited by poisondeathray; 23rd Mar 2018 at 20:33.
    Quote Quote  
  11. Thanks poisondeathray, there are some subtle issues here. I'm tracking down the crashing, it's happening in Avisynth+ only, at the BilinearResize line.

    Maybe an image mask would be better, yes. I used the font because it gives a nice antialiased edge at all sizes (when it works), but as you mention, there might be system issues; seeing part of another character is really weird.

    It's more trouble than it's worth TBH, for such a rarely-used effect (I've used a star wipe maybe twice in my life), when even inexpensive editing programs can do it.

    By the way here's a related thread on wipe transitions:
    https://forum.videohelp.com/threads/387798-Add-transition-to-overlay-in-AviSynth
    Quote Quote  
  12. Thanks for the overlay suggestion. I made a few frames in photoshop and made a 9 frame video as the overlay and it looks pretty good. By default does it use black/grayscale for the alpha channel?
    Quote Quote  
  13. Originally Posted by videeo View Post
    Thanks for the overlay suggestion. I made a few frames in photoshop and made a 9 frame video as the overlay and it looks pretty good. By default does it use black/grayscale for the alpha channel?
    Yes.

    You can use showalpha() for the mask clip if you have embedded alpha (RGBA)

    eg.
    Code:
    overlay(background, foreground, mask=maskclip.showalpha() )

    or you can load the black/white/greyscale clip or image sequence separately as the mask
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!