VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    I'm trying to extend the duration of certain shots by using Loop. It seems the more times I use Loop, the more it throws off the timing of my previous cuts. Something is happening, anyway. I've been going in circles for hours re-defining where I want the cuts to be, and they keep shifting. Am I not using Loop correctly?

    Code:
    LoadPlugin("C:\DVD\DGDecode.dll")
    clip1 = MPEG2Source("C:\DVD\21\VTS_01_1.d2v")
    clip2 = MPEG2Source("C:\DVD\21 DC\VTS_01_1.d2v")
    clip2.Trim(0,5640)FadeOut(19) + clip1.Trim(2721,2887)Loop(34,2887,2887) + clip1.Trim(2898,2995) + clip2.Trim(5943,5986) + clip1.Trim(2998,3167)Loop(3,3167,3167) + clip1.Trim(3168,3266) + clip1.Trim(3268,4158) + clip1.Trim(4158,4589) + clip1.Trim(4592,5719)Loop(3,5719,5719) + clip1.Trim(5719
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    It could be as simple as needing to add all the "." (DOT) between command elements properly, but I would say create intermediate variables for each pre-loop segment, then create variables for those looped segments, then concatenate (command order is important here). That way you can see whether each command is executing properly. Also, you could do intermediate line-wise "Return" commands (with the remainders commented out) to visually cross-check each element.

    Scott
    Quote Quote  
  3. You know that the Loop command adds one less frame than you're saying, right? So Loop(34,2887,2887) adds 33 new copies of frame 2887 and the frame count increases by 33? Also, as Cornucopia says, make sure to put the dots between commands. The whole thing looks kind of convoluted to me, though. Rather than all those non-aligned splices with those commands I'd do it in a way it could be checked as I went along:

    A=clip2.Trim(0,5640).FadeOut(19)
    B=clip1.Trim(2721,2887).Loop(34,2887,2887)
    C=clip1.Trim(2898,2995)
    .
    .
    #Return B #to test out that each line does what you want
    A+B+C+......


    And Clip1 and Clip2 are the same, right? Anyway, I think I'm suggesting the same as Cornucopia - break it down so you can check for mistakes along the way
    Quote Quote  
  4. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Thanks, guys. Not having the dot before Loop is what was screwing me up.
    Manono, your "column" method for the script is much more organized and I much prefer it. Thanks!

    Originally Posted by manono View Post
    You know that the Loop command adds one less frame than you're saying, right? So Loop(34,2887,2887) adds 33 new copies of frame 2887 and the frame count increases by 33?
    I did not know that, thank you. Is this page incorrect?
    http://avisynth.nl/index.php/Loop

    It makes it sound like Loop(34,2887,2887) would repeat frame 2887 thirty-four times.
    Quote Quote  
  5. I don't know if it's wrong or not, but it's certainly unclear.

    You can easily test yourself to confirm (or disprove) what I say. Just add a loop to a script and check how many frames are added - the number you're looping or that number minus 1.
    Quote Quote  
  6. Originally Posted by lomaidala View Post
    It makes it sound like Loop(34,2887,2887) would repeat frame 2887 thirty-four times.
    The frame is shown 34 times. It was originally shown 1 time. So you're adding 33 more. This syntax gives the ability to remove frames with Loop(0,...) which is explained in the the wiki. They could have been more clear by saying "displayed a total of X times" instead of "repeated X times".
    Last edited by jagabo; 12th Oct 2015 at 18:19.
    Quote Quote  
  7. Member
    Join Date
    Sep 2008
    Location
    United States
    Search Comp PM
    Okay, thanks for clarifying.

    Originally Posted by manono View Post
    You can easily test yourself to confirm (or disprove) what I say. Just add a loop to a script and check how many frames are added - the number you're looping or that number minus 1.
    I actually already confirmed what you said was true before I posted--so if it means anything, I wasn't doubting you. It was more like I was questioning exactly what the wiki page meant.
    Quote Quote  
  8. Anonymous344
    Guest
    Call ShowFrameNumber() after you load your video, lomaidala.

    Code:
    MPEG2Source()
    ShowFrameNumber(scroll=true)
    That way, the frame-numbers that you see when you preview your script are always anchored to the original frames of your video. This makes it easier to see which frames are being repeated if your script involves numerous edits to the same video.

    Remember that the order in which you call Loop() and Trim() makes a difference.

    Code:
    Version()
    ShowFrameNumber(scroll=true)
    Loop(3,100,100)
    Trim(0,200)
    is not the same as

    Code:
    Version()
    ShowFrameNumber(scroll=true)
    Trim(0,200)
    Loop(3,100,100)

    because the former produces a 201-frame video, and the latter, a 204-frame one.

    Moreover, if you ever need to call Loop() multiple times, work backwards. In other words, loop the frames that occur later in the video before the frames that occur earlier on.
    Quote Quote  



Similar Threads

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