VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 11 of 11
Thread

Threaded View

  1. I want to sync 2 video, but one has some blank/black frames in the middle for a pause, while the other just jumps to the next part of the episode.

    I want to add solid black frames in to fill it in with silence to match up with the other source.

    If this is possible, how would I do this with avisynth, whats the script command?
    Quote Quote  
  2. As a function:

    Code:
    function InsertBlank(clip v, int position, int duration)
    {
        # position and duration are frame numbers
        blank = BlankClip(v, length=duration) # create black clip with same properties as existing clip
        v.Trim(0,position-1) ++ blank ++ v.Trim(position,0)
    }
    Call with

    Code:
    named_clip = WhateverSourceWithAudio()
    named_clip = InsertBlank(named_clip, 10000, 50) # insert 50 blank frames at frame 10000
    Quote Quote  
  3. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    This is easier to do visually in an NLE like Premiere.
    I have a project in Premiere right now, with this issue, and a few others.
    Quote Quote  
  4. Originally Posted by lordsmurf View Post
    This is easier to do visually in an NLE like Premiere.
    That's using an elephant gun on a mouse as it's a trivial exercise in AviSynth. VDub serves as the visual and script confirmation. jagabo has already shown several ways to do it. Me, I'd do it like so:


    A=Trim(Last,0,1000)###1000=last frame before black frame insertion
    B=BlankClip(Last,Length=10)###Insert 10 black frames with same characteristics (including silent audio) as rest of video
    C=Trim(Last,1001,0)### resume video after insertion of black frames
    A++B++C###AlignedSplice
    Last edited by manono; 2nd Jun 2019 at 14:10.
    Quote Quote  
  5. Thanks Jagabo!

    Before I saw your reply, I also came up with the idea to copy black frames from other parts of the episode with trim and place them where I needed in the video. It seems to work for what I was looking for.
    Quote Quote  
  6. Originally Posted by killerteengohan View Post
    Thanks Jagabo!

    Before I saw your reply, I also came up with the idea to copy black frames from other parts of the episode with trim and place them where I needed in the video. It seems to work for what I was looking for.
    Or, if the video doesn't have any black frames, you can make black frames from existing frames by adjusting levels, gain, offset, etc. For example ColorYUV(gain_y=-256, off_y=16, cont_u=-256, cont_v=-256) will create a pure (limited range) black clip.
    Quote Quote  
  7. Another way to insert a delay into a clip is to use Loop to repeat a frame (or a sequence of frames) multiple times. For example:

    Code:
    Loop(51, 1000, 1000)
    will display frames 1000 through 1000 (ie, just frame 1000) a total of 51 times, the original 1 plus 50 copies. Note that the audio is also repeated so this can be annoying.
    Quote Quote  
  8. Originally Posted by jagabo View Post
    Another way to insert a delay into a clip is to use Loop to repeat a frame (or a sequence of frames) multiple times. For example:

    Code:
    Loop(51, 1000, 1000)
    will display frames 1000 through 1000 (ie, just frame 1000) a total of 51 times, the original 1 plus 50 copies. Note that the audio is also repeated so this can be annoying.
    I never heard of or knew about that before. That is a nice new thing to learn about. Thanks! It can actually save me some time when I don't feel like counting frames.
    Quote Quote  
  9. Now, supposing I take that black frame, open it in paint, and add a title. How do I add this to the beginning of a clip, and make it last for a few seconds before the video begins?
    Quote Quote  
  10. Here's one way:

    AssumeFPS(23.976)
    Title=ImageSource("Title.bmp",End=99,fps=23.976).C onvertToYV12()
    Title+Last


    You might not need the AssumeFPS line, depending on your framerate, but you'll probably need to set one in the ImageSource line. The default is 24fps. Figure out how many frames for your length at your framerate. This adds 100 frames (Avisynth counting begins with zero) at 23.976fps or just over 4 seconds of title. This doesn't include the audio. If you need silent audio, read up on ImageSource on the AviSynth site. As they both have to be in the same colorspace to join, I added the ConvertTo command.
    Quote Quote  
  11. Assuming the main video is already loaded as "last", YV12, no audio, and the image is already the right dimensions:
    Code:
    title = ImageSource("filename.ext",  start=0, end=int(last.framerate*3.00), fps=last.framerate).ConvertToYV12() # note: 3 seconds
    title+last
    Quote Quote  



Similar Threads