VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Member
    Join Date
    Feb 2015
    Location
    Scotland
    Search PM
    Hi.

    I have a simple script that delays a video by a set amount of time but I was wondering, instead of showing a black frame for the delayed amount of time, is there a way of using the first frame of the delayed video instead? As you can see in the code below, the video is delayed 12.5 seconds. The video on the right starts at frame 625. From frame 1-624, there's a black screen. I'd like to use frame 1 of the right-hand video instead of a black one if possible.

    This is the text of the script:

    Code:
    clip1=DirectShowSource("C:\Users\irn-bru\Desktop\millerslide.mp4", audio=true).AddBorders(0, 0, 0, 0, color_black).LanczosResize(1280,720)
    clip2=DirectShowSource("C:\Users\irn-bru\Desktop\marquezslide.mp4", audio=false).AddBorders(0, 0, 2, 0, color_black).LanczosResize(1280,720)
    stackhorizontal(clip1, (delayvideo (clip2, 12.500)))
    
    function delayvideo(clip thiz, float seconds)
    {
    assert(seconds!=0, "delayvideo: invalid delay value")
    tF = abs(round(seconds*float(thiz.framerate)))
    delayed = seconds < 0 ? thiz.trim(tF-1,0) : blankclip(thiz, tF) ++ thiz
    return delayed
    }
    Any ideas?
    Thanks.

    EDIT:
    OK, I worked out I can do it by adding the Loop function and chopping the code down to this:

    Code:
    clip1=DirectShowSource("C:\Users\irn-bru\Desktop\millerslide.mp4", audio=true).AddBorders(0, 0, 0, 0, color_black).LanczosResize(1280,720)
    clip2=DirectShowSource("C:\Users\irn-bru\Desktop\marquezslide.mp4", audio=false).AddBorders(0, 0, 2, 0, color_black).LanczosResize(1280,720).Loop(624,1,1)
    stackhorizontal(clip1, clip2)
    ...but it'd still be nice if there was a solution incorporating the original code too though.
    Last edited by irn-bru; 27th Aug 2018 at 09:40.
    Quote Quote  
  2. Originally Posted by irn-bru View Post
    Hi.

    I have a simple script that delays a video by a set amount of time but I was wondering, instead of showing a black frame for the delayed amount of time, is there a way of using the first frame of the delayed video instead? As you can see in the code below, the video is delayed 12.5 seconds. The video on the right starts at frame 625. From frame 1-624, there's a black screen. I'd like to use frame 1 of the right-hand video instead of a black one if possible.

    This is the text of the script:

    Code:
    clip1=DirectShowSource("C:\Users\irn-bru\Desktop\millerslide.mp4", audio=true).AddBorders(0, 0, 0, 0, color_black).LanczosResize(1280,720)
    clip2=DirectShowSource("C:\Users\irn-bru\Desktop\marquezslide.mp4", audio=false).AddBorders(0, 0, 2, 0, color_black).LanczosResize(1280,720)
    stackhorizontal(clip1, (delayvideo (clip2, 12.500)))
    
    function delayvideo(clip thiz, float seconds)
    {
    assert(seconds!=0, "delayvideo: invalid delay value")
    tF = abs(round(seconds*float(thiz.framerate)))
    delayed = seconds < 0 ? thiz.trim(tF-1,0) : blankclip(thiz, tF) ++ thiz
    return delayed
    }
    Any ideas?
    Thanks.

    EDIT:
    OK, I worked out I can do it by adding the Loop function and chopping the code down to this:

    Code:
    clip1=DirectShowSource("C:\Users\irn-bru\Desktop\millerslide.mp4", audio=true).AddBorders(0, 0, 0, 0, color_black).LanczosResize(1280,720)
    clip2=DirectShowSource("C:\Users\irn-bru\Desktop\marquezslide.mp4", audio=false).AddBorders(0, 0, 2, 0, color_black).LanczosResize(1280,720).Loop(624,1,1)
    stackhorizontal(clip1, clip2)
    ...but it'd still be nice if there was a solution incorporating the original code too though.


    You can add a parameter in the function to control the frame that is looped. So in this example, frame 1 (but you can enter frame 10 or whatever you want repeated)


    Code:
    clip1=DirectShowSource("C:\Users\irn-bru\Desktop\millerslide.mp4", audio=true).AddBorders(0, 0, 0, 0, color_black).LanczosResize(1280,720)
    clip2=DirectShowSource("C:\Users\irn-bru\Desktop\marquezslide.mp4", audio=false).AddBorders(0, 0, 2, 0, color_black).LanczosResize(1280,720)
    stackhorizontal(clip1, (delayvideo (clip2, 12.500, 1)))
    
    function delayvideo(clip thiz, float seconds, int "loopframe")
    {
    loopframe  = Default(loopframe, 0)
    assert(seconds!=0, "delayvideo: invalid delay value")
    tF = abs(round(seconds*float(thiz.framerate)))
    delayed = seconds < 0 ? thiz.trim(tF-1,0) : thiz.trim(loopframe,-1).loop(tF) ++ thiz.trim(loopframe,0)
    return delayed
    }
    Quote Quote  
  3. Member
    Join Date
    Feb 2015
    Location
    Scotland
    Search PM
    Originally Posted by poisondeathray View Post
    You can add a parameter in the function to control the frame that is looped. So in this example, frame 1 (but you can enter frame 10 or whatever you want repeated)


    Code:
    clip1=DirectShowSource("C:\Users\irn-bru\Desktop\millerslide.mp4", audio=true).AddBorders(0, 0, 0, 0, color_black).LanczosResize(1280,720)
    clip2=DirectShowSource("C:\Users\irn-bru\Desktop\marquezslide.mp4", audio=false).AddBorders(0, 0, 2, 0, color_black).LanczosResize(1280,720)
    stackhorizontal(clip1, (delayvideo (clip2, 12.500, 1)))
    
    function delayvideo(clip thiz, float seconds, int "loopframe")
    {
    loopframe  = Default(loopframe, 0)
    assert(seconds!=0, "delayvideo: invalid delay value")
    tF = abs(round(seconds*float(thiz.framerate)))
    delayed = seconds < 0 ? thiz.trim(tF-1,0) : thiz.trim(loopframe,-1).loop(tF) ++ thiz.trim(loopframe,0)
    return delayed
    }
    Perfect, thank you, it's very much appreciated! That is exactly what I hoped for.
    Quote Quote  



Similar Threads

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