VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. I'm trying to find a way to run a combing detection algorithm through AviSynth. I know of two functions that could be used Decomb/IsCombed and TIVTC/IsCombedTIVTC. Has anyone experience with those functions and knows if one is more accurate than the other?

    Now I'd like to run this function on every frame and output a log that would say something like "combing from frame X to Y" every time combing is detected. The algorithm would be as follow

    Code:
    bool combingFound := false
    for-each frame in clip {
       if isCombed(frame) {
          if !combingFound {
             combingFound := true
             startFrame := frame
          }
       } else {
          if combingFound {
             combingFound := false
             writeLog("Combing from " + startFrame + " to " + frame)
          }
       }
    }
    I'm not sure how to write that in AviSynth unfortunately. I've also found this script

    Code:
    <input>
    global unused_ = blankclip(pixel_type="yv12", length=10).TFM()
    file="<temporary-file.log>"
    global sep="-"
    function IsMoving()
    {
      global b = (diff < 1.0) ? false : true
    }
    c = SelectRangeEvery(every=<every>,length=<length>)
    global clip = c
    c = WriteFile(c, file, "a", "sep", "b")
    c = FrameEvaluate(c, "global a = IsCombedTIVTC(clip, cthresh=9)")
    c = FrameEvaluate(c, "IsMoving")
    c = FrameEvaluate(c,"global diff = 0.50*YDifferenceFromPrevious(clip) + 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")
    crop(c,0,0,16,16)
    From http://avisynth.nl/index.php/Interlace_detection but I don't understand how to interpret the results. It looks like the log needs to be fed to something else for interpretation. I've tried using the standalone but I'm getting an error trying to run it on a script.
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    What are you trying to achieve what no one else before you ever tried? Don't reinvent the wheel, especially not with only little insight in all the possible reasons why they go more or less round. A really elaborate algorithm to detect interlacing or telecine will not only look at one frame separately, it would compare several fields instead.
    Quote Quote  
  3. Something as simple as

    Code:
    colon = ": "
    WriteFile("CombInfo.txt", "current_frame", "colon", "IsCombedTIVTC(last, cthresh=9)", flush=true)
    will give you a file with one line of text for each frame -- with frame number and true/false (true=combed, false=not). For example:

    Code:
    0: false
    1: false
    2: false
    3: true
    4: true
    5: false
    6: false
    Last edited by jagabo; 2nd Sep 2019 at 11:30.
    Quote Quote  
  4. Thank you jagabo, this will do the trick! I can easily write a script to parse those results.
    Quote Quote  



Similar Threads

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