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:
Any ideas?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 }
Thanks.
EDIT:
OK, I worked out I can do it by adding the Loop function and chopping the code down to this:
...but it'd still be nice if there was a solution incorporating the original code too though.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)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 3 of 3
Thread
-
Last edited by irn-bru; 27th Aug 2018 at 09:40.
-
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 }
-
Similar Threads
-
AviSynth - Color Space Frame Timing
By lomaidala in forum EditingReplies: 31Last Post: 7th Mar 2018, 04:53 -
[avisynth] how to double frame rate?
By marcorocchini in forum Newbie / General discussionsReplies: 6Last Post: 11th Feb 2016, 19:02 -
avidemux black frame
By jalea148 in forum Newbie / General discussionsReplies: 0Last Post: 26th Jul 2015, 07:26 -
Is there a way to add a variable to a frame using AVISynth?
By ndjamena in forum RestorationReplies: 6Last Post: 10th Jun 2014, 11:56 -
AviSynth- Playing audio from previous frame.
By smike in forum Video ConversionReplies: 13Last Post: 12th Apr 2014, 14:08