VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or buy Replay Video Capture or PlayON and record Netflix, HBO, etc! :)
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    I'm trying to create an AviSynth script that replaces one shot in a video using one image.

    How do I animate the position of the image so that it gradually moves down until it disappears offscreen? The image is also a uniquely shaped cut-out, so that it shows the video behind it along the edges of the frame.

    Does anyone have a script example or tutorial I could take a look at?
    Quote Quote  
  2. There are examples given on the animate page

    http://avisynth.nl/index.php/Animate



    It's also much easier to do in a video editor - you can control the speed /timing non linear movements much more easily. eg What if you want the speed to ramp up or down? Very difficult in avisynth - it's just linear interpolation
    Quote Quote  
  3. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    There are examples given on the animate page

    http://avisynth.nl/index.php/Animate
    Is it the Scrolling "Version" video example? I can't get the image to move. It shows up in the video, but there is a partial white border between it and the video behind it, and the video behind it is frozen on one frame.

    Here's my script:

    Code:
    LoadPlugin("C:\DVD\DGDecode.dll")
    clip1 = MPEG2Source("C:\DVD\01\VTS_01_1.d2v")
    clip2 = MPEG2Source("C:\DVD\24\VTS_01_1.d2v")
    ovl5 = ImageSource("C:\Images\01.png", pixel_type="RGB32", start=0, end=77, fps=clip1.framerate)
    Animate(0, 77, "Crop", 
    \  ovl5,   0, 0, 64, 32, 
    \  ovl5, 316, 0, 64, 32)
    alpha_mask = ovl5.ShowAlpha()
    ovl5 = ovl5.ConvertToYV12()
    clip2.Trim(0,9) + clip2.Trim(0,2708)FadeOut(19) + clip1.Trim(2720,20002) + clip1.Trim(20003,20080).Overlay(ovl5) + clip1.Trim(20081,0)
    Originally Posted by poisondeathray View Post
    It's also much easier to do in a video editor
    I want to use AviSynth so I can upload my scripts for people to download, so they can apply the same video edit to their DVD if they want.
    Quote Quote  
  4. If there is a partial white border, it might be your alpha channel isn't clean, or antialiasing, or your mask isn't using "full range", or it might be premultiplied alpha instead of straight, or color space issues


    Not to discourage you, but it would be easier for other people to use a video editor. Much more control, easier and better for this type of task. Even if they wanted to use avisynth, they don't have your assets so how could they replicate it ?

    If you wanted to post examples or "templates" for other people, you should include source material, for example sample images or videos to play with, maybe even a gif preview or video preview - so they can see how it works and play with the code.

    Anyways what do you think is supposed to be happening here? Do you have a static image with embedded alpha channel as an overlay panning ? (ie. an animated transparent overlay or a static image?) . I didn't look at your code closely but it looks like your overlay syntax is problematic - Overlay(ovl5) doesn't specify an overlay clip. You have an alpha mask, but don't use it.

    The way most people would do this in avisynth (or any panning motion) is animate the resize. Because resize has an offset crop value
    http://avisynth.nl/index.php/Resize

    Here is a hard example, with all assets

    Code:
    baseclip=BlankClip(length=100, width=640, height=480, fps=24, color=color_green).ShowFrameNumber()
    
    arrow=ImageSource("1.png", start=0, end=99, fps=24,  pixel_type="RGB32")
    
    anim_arrow=Animate(arrow, 0, 47, "Spline36Resize",   640,480,0,0,0,0, 640,480,0,-480,0,-480)
    
    Overlay(baseclip, anim_arrow, mask=anim_arrow.showalpha())
    Gif preview (it's resized and trimmed, timing is also diffrerent)
    Name:  arrow.gif
Views: 621
Size:  115.4 KB

    Note the animate ends at 47, but the arrow is "off" at 43, because the layer is 640,480 with the origin at 0,0 (the arrow isn't at 0,0, the layer is at 0,0) . I didn't bother timing it to specific frames

    There are probably several different ways you could do this in avisynth, all of them 10x more difficult to do than in an editor you you would just drag the arrow, start and end, adjust the velocity curve (keyframe interpolation). Avisynth is great for some tasks. Other tasks... not so much. This type of task falls into the "not so much" category . What if you wanted the arrow to speed up, or slow down? Ease in/out. Or curve and bend and point at an object? Very difficult to manipulate real animation in avisynth.
    Image Attached Thumbnails Click image for larger version

Name:	1.png
Views:	164
Size:	3.3 KB
ID:	33616  

    Last edited by poisondeathray; 11th Sep 2015 at 19:12.
    Quote Quote  
  5. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Not to discourage you, but it would be easier for other people to use a video editor. Much more control, easier and better for this type of task. Even if they wanted to use avisynth, they don't have your assets so how could they replicate it ?
    But how would they be able to replicate exactly what I'm doing in a video editor? I want it to be as easy and automatic as possible for people to use. What could be easier than me instructing them to load my script? Is there a video editor that would load and automatically apply the kind of video editing I'm doing? Uploading the assets is part of the plan for my project as well--just a few images.

    Originally Posted by poisondeathray View Post
    Anyways what do you think is supposed to be happening here? Do you have a static image with embedded alpha channel as an overlay panning ? (ie. an animated transparent overlay or a static image?)
    I have a static image that works just like your arrow PNG.

    Originally Posted by poisondeathray View Post
    I didn't look at your code closely but it looks like your overlay syntax is problematic - Overlay(ovl5) doesn't specify an overlay clip. You have an alpha mask, but don't use it.
    Ah, thanks. I forgot to use the alpha mask. I think that's why my PNG was showing up weird with the border behind it.
    I'm not sure what you mean about ovl5 though. I thought this was the clip over which I specified the overlay: 20003,20080.

    Thanks again. Everything works great. Here's my result for the record:
    Code:
    LoadPlugin("C:\DVD\DGDecode.dll")
    clip1 = MPEG2Source("C:\DVD\01\VTS_01_1.d2v")
    clip2 = MPEG2Source("C:\DVD\24\VTS_01_1.d2v")
    ovl5 = ImageSource("C:\Images\01.png", pixel_type="RGB32", start=0, end=78, fps=clip1.framerate)
    ovl5 = Animate(ovl5, 48, 78, "Spline36Resize",   720,480,0,0,0,0, 720,480,0,-480,0,-480)
    alpha_mask = ovl5.ShowAlpha()
    clip2.Trim(0,9) + clip2.Trim(0,2708)FadeOut(19) + clip1.Trim(2720,20002) + clip1.Trim(20003,20080).Overlay(ovl5, mask=alpha_mask) + clip1.Trim(20081,0)
    Quote Quote  
  6. Originally Posted by lomaidala View Post
    But how would they be able to replicate exactly what I'm doing in a video editor? I want it to be as easy and automatic as possible for people to use. What could be easier than me instructing them to load my script? Is there a video editor that would load and automatically apply the kind of video editing I'm doing? Uploading the assets is part of the plan for my project as well--just a few images.


    You would upload the project file with the assets. e.g. you can use a free editor like aviutl .

    aviutl can load avs scripts too (but not "live" editing of scripts, sort of like vdub. The .avs script "looks" like uncompressed video to aviutl). So you can combine avisynth with a video editor

    The point of examples, is to learn from them, adapt them so you can apply to your own projects. But making changes , such as changing animation timing, or customizing the motion, changing assets, adding multiple layers etc.. those types of edits regarding any type of animation of layers are much easier to do in a video editor . To put it bluntly - control over animating layers is terrible in avisynth . A GUI is easier to use for most people for these types of tasks. Yes, avisynth excels at other types of tasks, but not for animation
    Quote Quote  



Similar Threads