VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Hi. I'm editing a TV show which is in mkv format. These two commands work OK individually:
    Code:
    loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)
    trim(57054,57423).fadeout0(35).SmoothFPS2(int(framerate*2), 1).AssumeFPS(framerate).Amplify(0)
    but, put together as:
    Code:
    loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)++trim(57054,57423).fadeout0(35).SmoothFPS2(int(framerate*2), 1).AssumeFPS(framerate).Amplify(0)
    I get an error: 'The video stream cannot be opened.' Can anyone suggest what the issue is? Thank you.
    Last edited by pooksahib; 12th Aug 2019 at 05:15.
    Quote Quote  
  2. The second script is working here. Frame 57054 of the input clip is repeated 80 times with a fade in. Then frames 57054 through 57423 are frame rate doubled and faded at the end. A total of 820 frames.

    Code:
    BlankClip(length=60000)
    ConvertToYV12()
    ShowFrameNumber()
    
    loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)++trim(57054,57423).fadeout0(35).SmoothFPS2(int(framerate*2), 1).AssumeFPS(framerate).Amplify(0)
    Post your whole script.
    Quote Quote  
  3. Hi jagabo. Here's the script:
    Code:
    function SmoothFPS2(clip source, int num, int den) {
    super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4)
    backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
    forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
    backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
    forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
    MBlockFps(source, super, backward_3, forward_3, num, den, mode=0)
    } 
    global MeGUI_darx = 16
    global MeGUI_dary = 9
    LoadPlugin("E:\Free\MeGUI\tools\lsmash\LSMASHSource.dll")
    a=LWLibavVideoSource("E:\10 Cats S18E03.mkv")
    b=LWLibavaudioSource("E:\10 Cats S18E03.mkv")
    audiodub(a,b)
    Spline36Resize(800,448) # Spline36 (Neutral)
    
    v=loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)
    w=trim(57054,57423).SmoothFPS2(int(framerate*2), 1).AssumeFPS(framerate).Amplify(0).fadeout0(35)
    x=loop(750,127424,127424).trim(127424,127424+749).amplify(0).fadein0(50).fadeout0(35)
    y=loop(750,127670,127670).trim(127670,127670+749).amplify(0).fadein0(50).fadeout0(50)
    a=trim(3266,5931).fadein0(100).fadeout0(35)++trim(6660,16433).fadein0(50).fadeout0(35)++trim(28856,38169).fadein0(50).fadeout0(35)++trim(51522,59175).fadein0(50).fout(80)
    b=loop(650,59175,59175).trim(59175,59175+649).amplify(0).fadeout0(35)++trim(75380,81347).fadein0(50).fadeout0(35)++trim(84822,86007).fadein0(50).fout(80)
    a++b++loop(650,86007,86007).trim(86007,86007+649).amplify(0).fadeout0(35)++trim(103164,109801).fadein0(50).fadeout0(35)++trim(126144,128765).fadein0(50).fadeout0(35)++v++w++x++y
    The video I'm working on can be had here:
    https://drive.google.com/file/d/1qO6-Wajjtb2QJs94pEO7z8mCgDOnc0K4/view
    It's 50fps which seems to be the source of the problem but I'm sure I've successfully used the slo-mo function on such vids before...

    Thanks for taking a look. You may find my scripting a tad inelegant!
    Quote Quote  
  4. I assumed fout() is short for fadeout() and changed it accordingly. I downloaded your clip and changed the source lines to match the clip name. The only error I get is for the last line, the framerate of clip w (25609/513) doesn't match the others (49970/1001). I changed the line that builds w to:

    Code:
    w=trim(57054,57423).SmoothFPS2(int(framerate*2), 1).AssumeFPS(frameratenumerator, frameratedenominator).Amplify(0).fadeout0(35)
    And the script works. My full script:

    Code:
    function SmoothFPS2(clip source, int num, int den) {
    super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4)
    backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
    forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
    backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
    forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
    MBlockFps(source, super, backward_3, forward_3, num, den, mode=0)
    } 
    
    global MeGUI_darx = 16
    global MeGUI_dary = 9
    #LoadPlugin("E:\Free\MeGUI\tools\lsmash\LSMASHSource.dll")
    a=LWLibavVideoSource("D:\Downloads\8.Out.Of.10.Cats.Does.Countdown.S18E03.720p.HDTV.x264-LiNKLE.mkv")
    b=LWLibavaudioSource("D:\Downloads\8.Out.Of.10.Cats.Does.Countdown.S18E03.720p.HDTV.x264-LiNKLE.mkv")
    audiodub(a,b)
    Spline36Resize(800,448) # Spline36 (Neutral)
    
    v=loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)
    w=trim(57054,57423).SmoothFPS2(int(framerate*2), 1).AssumeFPS(frameratenumerator, frameratedenominator).Amplify(0).fadeout0(35)
    x=loop(750,127424,127424).trim(127424,127424+749).amplify(0).fadein0(50).fadeout0(35)
    y=loop(750,127670,127670).trim(127670,127670+749).amplify(0).fadein0(50).fadeout0(50)
    a=trim(3266,5931).fadein0(100).fadeout0(35)++trim(6660,16433).fadein0(50).fadeout0(35)++trim(28856,38169).fadein0(50).fadeout0(35)++trim(51522,59175).fadein0(50).fadeout(80)
    b=loop(650,59175,59175).trim(59175,59175+649).amplify(0).fadeout0(35)++trim(75380,81347).fadein0(50).fadeout0(35)++trim(84822,86007).fadein0(50).fadeout(80)
    a++b++loop(650,86007,86007).trim(86007,86007+649).amplify(0).fadeout0(35)++trim(103164,109801).fadein0(50).fadeout0(35)++trim(126144,128765).fadein0(50).fadeout0(35)++v++w++x++y
    Quote Quote  
  5. Excellent, thank you so much. Never had a problem with the slo-mo command before so it's good to know what to do if it happens again.

    'fout' (and 'fin') are commands I use to fade the audio only. This is what's in my avisynth plugin folder:

    function fin(clip input, int "num_frames")
    {
    num_frames = Default(num_frames,150)
    FadeIn0(input,num_frames)
    return AudioDub(input,last)
    }

    function fout(clip input, int "num_frames")
    {
    num_frames = Default(num_frames,200)
    FadeOut0(input,num_frames)
    return AudioDub(input,last)
    }

    Thanks again.
    Quote Quote  
  6. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    Be careful about concatenating functions this way. You may get different results even when they work at all without errors. Always keep in mind that there is always an implicit clip variable as an intermediate result of a clip filter function, often available as an implicit last clip variable. A line break is not at all equal to a Splice function (shortened to + or ++). So why not use an explicit clip variable?

    Look closely at the code in your first two-line script: The first line produces an 80 frames clip containing a fade of a looped still frame. The second line would try to trim a 369 frames clip out of that one, not out of the original source clip. It seems you did not want to simplify your code in this way. But I can imagine it was not your intention anyway.

    What would the second one-line script do? Would it concatenate the intermediate clip from the beginning of the line to the ++, and the clip after the ++ to the rest? Or would it concatenate a fade of the intermediate result of the amplify result, and a trim out of the amplify result, to filter this result with the following functions? Has the dot priority or the splice? I would avoid such ambiguous notations. Using the [Un]alignedSplice(clip1, clip2) syntax is a lot less ambiguous. And assigning intermediate results to variables is best readable, to humans as well as to the script interpreter.
    Quote Quote  
  7. Hallo, LigH.de, and thanks for the reply. Unfortunately, I don't fully understand what you're saying - especially the remark that a 'trim' command would try to use the previous 'loop' command as its source... The plan for that section of the script was to make a short scene that faded in although not a traditional fadein - I wanted every frame to have the same depth of colour. So my script for that is (ignoring the slo-mo):
    Code:
    loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)++trim(57054,57423)
    What would you have done?
    Quote Quote  
  8. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    Writing scripts short and condensed is fine as long as you are sure you are doing it the same way the interpreter understands it. I would not be sure at your level of condensing.

    What does your one-liner do? Which operator has precedence, the ++ or the concatenating dots?

    a) o.p. for ++ will make trim() refer to the source clip
    Code:
    source = AnySource(anyFile)
    return source.loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79) ++ source.trim(57054,57423)
    or

    b) o.p. for the dots will make trim() refer to the result of amplify(0)
    Code:
    source = AnySource(anyFile)
    intro = source.loop(80,57054,57054).trim(57054,57054+79).amplify(0)
    return intro.fadein0(79) ++ intro.trim(57054,57423)
    I would not be sure when using the ++ syntax. Using the Splice() function syntax would be unambiguous, the parameter separating comma has the operator precedence for sure.

    Code:
    source = AnySource(anyFile)
    intro = source.loop(80,57054,57054).trim(57054,57054+79).amplify(0).fadein0(79)
    return AlignedSplice(intro, source.trim(57054,57423))
    You should prefer using explicit clip variables for intermediate results with a separate meaning. The interpreter will handle it without speed loss, and humans will thank you for additional readability.
    Quote Quote  



Similar Threads

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