VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. I'm sure this is a stupid question. Is

    TFM().TDecimate()

    The same as

    TFM()
    TDecimate()


    I see both on here often. I'm assuming you can use a "." instead of a line break? Am I understanding this wrong?
    Quote Quote  
  2. No.
    dot basically means that what is before the dot it the first parameter for what comes after the dot.
    To make more sense of this you need to be aware of that Avisynth uses an implicit 'last' variable.
    (if it was simply a replacement for a new line, something like ...TFM()... should work)

    so:
    TFM()
    <> last = TFM(last)
    <> last = last.TFM()

    TFM().TDecimate()
    <> last = TFM(last)
    last = Decimate(last)
    <> TFM()
    Decimate()


    so writing
    filter1().filter2().filter3()
    is the same as applying
    last = filter1(last)
    last = filter2(last)
    last = filter3(last)
    or
    filter1()
    filter2()
    filter3()

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by LaserBones View Post
    I'm sure this is a stupid question. Is

    TFM().TDecimate()

    The same as

    TFM()
    TDecimate()


    I see both on here often. I'm assuming you can use a "." instead of a line break?
    Yes.
    Quote Quote  
  4. The period pipes the data from the filter on the left to the filter on the right (corrected), without naming it. Otherwise the name "last" is assumed for inputs and outputs. The final result is the same within your simple examples but the mechanism is slightly different. There are cases where there is a difference.
    Last edited by jagabo; 12th Sep 2023 at 19:20.
    Quote Quote  
  5. Originally Posted by jagabo View Post
    The period pipes the data from the filter on the left to the filter on the left, without naming it. Otherwise the name "last" is assumed for inputs and outputs. The final result is the same within your simple examples but the mechanism is slightly different. There are cases where there is a difference.
    Thanks for the explanation! I'm assuming you meant filter on left to filter on right?
    Quote Quote  
  6. Oops. Yes, from the filter on the left to the filter on the right.
    Quote Quote  
  7. Sometimes it's practical to chain functions together with dots, especially when there's more than one video in a script (or the filtering needs to change for some sections). For example:

    Code:
    Vid = last
    
    Clip1 = Vid.SomeFilter().AnotherFilter().OneMoreFunction()
    Clip2 = Vid.SomeFilter().AnotherFilter(DoThis=false).OneMoreFunction(Something=true)
    
    Clip1.Trim(0,999) + Clip2.Trim(1000,1087) + Clip1.Trim(1088,0)
    And just to be pedantic about your original question, you can still use line breaks when chaining functions with dots if you need to make the script more readable.

    Code:
    Vid = last
    
    Clip1 = Vid\
    .SomeFilter()\
    .AnotherFilter()\
    .OneMoreFunction()
    
    Clip2 = Vid\
    .SomeFilter()\
    .AnotherFilter(DoThis=false)\
    .OneMoreFunction(Something=true)
    
    Clip1.Trim(0,999) + Clip2.Trim(1000,1087) + Clip1.Trim(1088,0)
    Quote Quote  



Similar Threads

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