VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Hi. I often use this command at the beginning of a scene edit:
    Code:
    loop(250,9999,9999).trim(9999,9999+249).amplify(0).fadein0(25)
    Is it possible to make a 'function' of the loop part so that I can simplify my scripts something like this:

    Code:
    rpt(999,250,25)
    meaning, repeat frame 999 250 times with a 25 frame fadein. If possible, 'Amplify(0)' would be incorporated into the function.

    Grateful thanks for any thoughts you may have.
    Last edited by pooksahib; 8th Feb 2020 at 07:36. Reason: grammar
    Quote Quote  
  2. You may eventually get a relevant reply here, but you might get more in-depth replies at Doom9, which has an entire section dedicated to Avisynth.
    Quote Quote  
  3. Thanks, abolibibelot. I've been trying to get my head around functions by reading this page:
    http://avisynth.nl/index.php/User_defined_script_functions
    but it's proving to be beyond someone like myself who came to computers later in life. I'll hang around here for a while as I've had enormous help from members of this forum in the past.
    Quote Quote  
  4. assuming I didn't overlook something:
    Code:
    function rpt(clip input, int frame, int times, int fadeIn)  
    {
       clip = clip.loop(times,frame,frame).trim(frame,frame+times-1).amplify(0).fadein0(fadeIn)
       return clip
    }
    should do the trick.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Hallo, Selur und Vielen Dank for that. Very kind of you to take the time. I've tried using
    Code:
    rpt(999,250,25)
    on an existing script but I get an error message saying the video stream cannot be opened. Am I 'calling' the function correctly?
    Quote Quote  
  6. fixed:
    Code:
    function rpt(clip input, int frame, int times, int fadeIn)  
    {
        input.loop(times,frame,frame).trim(frame,frame+times-1).amplify(0).fadein0(fadeIn)
    }
    Quote Quote  
  7. Superb, jagabo, thank you so much. It looks simple but I just can't 'read' that programming. I did, however, write a function to do a loop with a fadeOUT. That was easy...

    Thanks again, and to you, too, Selur.
    Quote Quote  
  8. doh overlooked that I renamed the clip to input so
    Code:
    function rpt(clip input, int frame, int times, int fadeIn)  
    {
       input =  input.loop(times,frame,frame).trim(frame,frame+times-1).amplify(0).fadein0(fadeIn)
       return input
    }
    also should work.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

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