Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th November 2021, 02:45   #201  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, tried with v2.60 std, OK.
Code:
IsPlus = FindStr(VersionString.lcase,"avisynth+")!=0
(IsPlus) ? Import(".\Analyze5FX.avs") : GImport(".\Analyze5FX.avs")

x = LSMASHVideoSource(".\899.mp4")
x = x.crop(1124,24,-52,-636).Trim(30,100) # trimed for speed
mask = ImageSource(".\WieMHwJ.png",0,0)

# Mode 1 test

m0 = x.Analyze5FX(mask=mask, mode=1, show=0)
m1 = x.Analyze5FX(mask=mask, mode=1, show=1)
m2 = x.Analyze5FX(mask=mask, mode=1, show=2)
mu = Stackhorizontal(m0.AddBorders(0,0,2,0,$000000), m0)
md = Stackhorizontal(m1.AddBorders(0,0,2,0,$000000), m2)
Stackvertical(mu.AddBorders(0,0,0,2,$000000), md)
with Grunt[GScriptClip], GScript[If/While etc], RT_stats[other stuff] in 2.60 std plugins. [and LSMash]

Really going to bed now. [I hope].
[Same "no frame found to analyse", but no crash]

EDIT: And the entire script as I have it [with the DBase].
Code:
function Analyze5FX(clip clp, val "mask", int "Mode", int "Analyze5Th", string "Ignore", int "Show") {
    mask       = default (mask         , "")
    Mode       = default (Mode         , 1 )
    Analyze5Th = default (Analyze5Th   , 15)
    Ignore     = default (Ignore   , "none")
    Show       = default (Show         ,  0)

    Assert (!(Mode       < 1 || Mode       >   2), """"Mode" value must be between 1 and 2.""")
    Assert (!(Analyze5Th < 1 || Analyze5Th > 255), """"Analyze5Th" value must be between 1 and 255.""")
    Assert (!(Show       < 0 || Show       >   2), """"Show" value must be between 0 and 2.""")
    Assert ((Ignore == "top" || Ignore == "bottom" || Ignore == "left" || Ignore == "right" || Ignore == "none"), """"Ignore" string must be 'top', 'bottom', 'left', 'right' or 'none'.""")

    VW   = clp.Width
    VH   = clp.Height
    Th   = Analyze5Th
    mask = (IsClip(mask)) ? mask.ConvertToY8(matrix="PC.709").MTballoon2PX(2) : nop
    clpS = clp.ScriptClip("subtitle(string(current_frame))")

    # Construct a clip to check thresholds (for deblending analysis) #
    #================================================================#

   if(Mode == 1) {
        VFX2="""
            if(!mask.RT_YInRangeLocate(Baffle=1,lo=255,hi=255)) {
                RT_DBaseSetField(Analyze5DB,current_frame,0,2)
                Assert (FALSE, "Mask image is invalid.")                        # Not really a good place for Assert()
            }
            VW   = Last.Width
            VH   = Last.Height
            # Convert X,Y,W,H coords to L,T,-R,-B coords
            mL =  YIRL_X
            mT =  YIRL_Y
            mR = -VW + mL + YIRL_W
            mB = -VH + mT + YIRL_H
            Assert (!(mL < 8 && -1*mR < 8 || mT < 8 && -1*mB < 8), "Mask image or Loc is invalid.")    # Not really a good place for Assert()
            # Coords mod2 round up
            mL = mL + (mL % 2)
            mT = mT + (mT % 2)
            mR = mR - (mR % 2)
            mB = mB - (mB % 2)
            RT_DBaseSet(Analyze5DB,current_frame,1, mL,mT,mR,mB)                # Write VoodooFX style coords to DB
            # Crop 2x2 pxs area from above or below the logo and make a background from it
            mid = (VW-mL+mR)/2+mL
            mid = mid + (mid % 2)
            clp2x2 = (mT >= -1*mB) ? Last.crop(mid-2, mT-2, -1*(VW-mid), -VH+mT+2) : Last.crop(mid-2, VH+mB-2, -1*(VW-mid), mB+2)
            Return clp2x2.PointResize(VW, VH)                                   # Same size as input clip
        """
        Analyze5DB = ("~InpaintDelogo_Analyze5_"+RT_LocalTimeString+".DB").RT_GetFullPathName
        RT_DBaseAlloc(Analyze5DB,Mask.FrameCount,"iiiii")                       # Alloc DBase records, number of frames in mask clip
        clpB = clp.GScriptClip(VFX2, local=true, args="mask,Analyze5DB", after_frame=true)
        clpB.RT_ForceProcess                                                   # FORCE PROCESS ENTIRE CLIP

        Msk1 = mask.MTballoon2PX(2).mt_logic(mask, mode="xor")  # 2px wide mask around logo (+2px offset from the base mask)
        clp5 = clpB.Overlay(clp, mask=Msk1)

        # RT_FileDelete(Analyze5DB)

    } else {

        # Construct a clip to check thresholds (for Automask=1) #
        #=======================================================#

        cT = clp.crop(4, 4, -4, -1*(VH-6))
        cB = clp.crop(4, VH-6, -4, -4)
        cL = clp.crop(4, 4, -1*(VW-6), -4)
        cR = clp.crop(VW-6, 4, -4, -4)

        if(Ignore == "top") {
          cT = cB
        } else if (Ignore == "bottom") {
          cB = cT
        } else if (Ignore == "left") {
          cL = cR
        } else if (Ignore == "right") {
          cR = cL
        }

        wc = StackHorizontal(cr,cl).TurnLeft
        hc = StackVertical(ct,cb)

        if(wc.width > hc.width) {
          hc  = hc.PointResize(wc.width, hc.height)
          out = StackVertical(wc,hc)
          } else if(wc.width < hc.width) {
              wc  = wc.PointResize(hc.width, wc.height)
              out = StackVertical(wc,hc)
          } else {
              out = StackVertical(wc,hc)
          }
        clp5 = (Show == 2) ? out.PointResize(VW, VH) : out
    }

    # Delete frames above thresholds (that leaves us with the suitable frames for analysis) #
    #=======================================================================================#

    # Mod of Gavino's DeleteFrames() - https://forum.doom9.org/showthread.php?t=163107
    clp5
    fc  = FrameCount()
    res = BlankClip(clp, length=0)
    condition = "YPlaneMinMaxDifference >" +String(Th)+ " || UPlaneMinMaxDifference >" +String(Round(Th/2))+ " || VPlaneMinMaxDifference >" +String(Round(Th/2))
    current_frame = 0

    while (current_frame < fc) {
      while (Eval(condition) && current_frame < fc) {
        current_frame = current_frame+1
      }
      if (current_frame < fc) { # not at end
        start = current_frame # start of wanted section
        while (!Eval(condition) && current_frame < fc) {
          current_frame = current_frame+1
        }
        clpX = (Show == 1) ? clpS : (Show == 2) ? clp5 : clp   # 0: Original frames, 1: Original frames + frameNo, 2: Constructed clips (Mode=2 clip is upsized for show)
        res  = res + clpX.Trim(start, start-current_frame)
      }
    }
    Assert (!(res.FrameCount < 2), """No frames found to analyze, increase "Analyze5Th".""")
    return res
}
EDIT: With return clp5 just before your delete frames stuff, I get this

Some error message on frame. [too small to read]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th November 2021 at 03:04.
StainlessS is offline   Reply With Quote
Old 11th November 2021, 03:09   #202  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
That image doesn't look correct. This is how it looks on avs+:



EDIT:
Both tops are just original frames, the bottom left is original frame + original FrameNo, the bottom right is constructed clip (with defaults should be almost one solid color).

EDIT2:
Just noticed that it's "before your delete frames stuff", clp5 should be constructed clip (shouldn't be actual logo in there, just some different color instead at worst, that's why there are no frames on res output)

Last edited by VoodooFX; 11th November 2021 at 04:00.
VoodooFX is offline   Reply With Quote
Old 11th November 2021, 04:07   #203  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, I've figured out something I forgot a long time ago [I guess I avoid it automatically, but forgot why I do it].

Using GScript [v2.60 std], Scriptclip (or other runtime stuff), is NOT parsed withing GScript, it uses ScriptClip parsing from v2.60 std, so it dont work
when GImport-ing scripts that uses If/for/while etc withing runtimes script.
You need a function external to scriptclip, but within a Gscript parsed region.

This dont work
Code:
GScript("""
    Function Test26_A(clip c) {
        c
        SSS="
            if(current_frame % 2 ==0) { # <<<<<<<< Error at curly brace, scriptclip dont know what it is
                Subtitle(String(current_frame,"+Chr(34)+"%.0f]"+Chr(34)+"))
            }
            return last
        "
        return Scriptclip(SSS)
    }
""")

blankclip
test26_A()
but this works fine
Code:
GScript("""
    Function _LOW_Test26_B(clip c) {
        c
        if(current_frame % 2 == 0) {
            Subtitle(String(current_frame,"%.0f]"))
        }
        return last
    }
""")

Function Test26_B(clip c) {
    return c.Scriptclip("_LOW_Test26_B")
}


blankclip
test26_B
Or this if GImport-ed under v2.60 std
Code:
Function _LOW_Test26_B(clip c) {
    c
    if(current_frame % 2 == 0) {
        Subtitle(String(current_frame,"%.0f]"))
    }
    return last
}

Function Test26_B(clip c) {
    return c.Scriptclip("_LOW_Test26_B")
}

blankclip
test26_B
_LOW_Test26_B is parsed by Gscript, but called from within v2.60 std Scriptclip.

Also this if GImport-ed
Code:
Function Test26_B(clip c) {
    Function _LOW_Test26_B(clip c) {
        c
        if(current_frame % 2 == 0) {
            Subtitle(String(current_frame,"%.0f]"))
        }
        return last
    }
    return c.Scriptclip("_LOW_Test26_B")
}

blankclip
test26_B
EDIT: the parts in red above [and prev code block] should not be GImported, should be in client script.

defo going to bed now.

The Multi-Instance scripts developed by Martin53 and Gavino, use above style calls with simple single line scriptclip and GScript enabled function.
[I use that style a lot]

Maybe should defo be going onto wiki, cos I'm bound to forget why again.

EDIT: VX, the error occurs at first curly brace, need external lo level function for VFX2.
Code:
        VFX2="""
            if(!mask.RT_YInRangeLocate(Baffle=1,lo=255,hi=255)) { # <<<<<<<<
                RT_DBaseSetField(Analyze5DB,current_frame,0,2)
                Assert (FALSE, "Mask image is invalid.")                        # Not really a good place for Assert()
            }
So like this [but still not like your images - yet]
Code:
function Analyze5FX(clip clp, val "mask", int "Mode", int "Analyze5Th", string "Ignore", int "Show") {
    Function _VFX2(clip c,clip mask) {
        c
        if(!mask.RT_YInRangeLocate(Baffle=1,lo=255,hi=255)) {
            Assert (FALSE, "Mask image is invalid.")                        # Not really a good place for Assert()
        }
        VW   = Last.Width
        VH   = Last.Height
        # Convert X,Y,W,H coords to L,T,-R,-B coords
        mL =  YIRL_X
        mT =  YIRL_Y
        mR = -VW + mL + YIRL_W
        mB = -VH + mT + YIRL_H
        if(mL < 8 && -1*mR < 8 || mT < 8 && -1*mB < 8) {
            Assert (FALSE, "Mask image or Loc is invalid.")    # Not really a good place for Assert()
        }
        # Coords mod2 round up
        mL = mL + (mL % 2)
        mT = mT + (mT % 2)
        mR = mR - (mR % 2)
        mB = mB - (mB % 2)
        # Crop 2x2 pxs area from above or below the logo and make a background from it
        mid = (VW-mL+mR)/2+mL
        mid = mid + (mid % 2)
        clp2x2 = (mT >= -1*mB) ? Last.crop(mid-2, mT-2, -1*(VW-mid), -VH+mT+2) : Last.crop(mid-2, VH+mB-2, -1*(VW-mid), mB+2)
        Return clp2x2.PointResize(VW, VH)                                   # Same size as input clip
    }
    mask       = default (mask         , "")
    Mode       = default (Mode         , 1 )
    Analyze5Th = default (Analyze5Th   , 15)
    Ignore     = default (Ignore   , "none")
    Show       = default (Show         ,  0)

    Assert (!(Mode       < 1 || Mode       >   2), """"Mode" value must be between 1 and 2.""")
    Assert (!(Analyze5Th < 1 || Analyze5Th > 255), """"Analyze5Th" value must be between 1 and 255.""")
    Assert (!(Show       < 0 || Show       >   2), """"Show" value must be between 0 and 2.""")
    Assert ((Ignore == "top" || Ignore == "bottom" || Ignore == "left" || Ignore == "right" || Ignore == "none"), """"Ignore" string must be 'top', 'bottom', 'left', 'right' or 'none'.""")

    VW   = clp.Width
    VH   = clp.Height
    Th   = Analyze5Th
    mask = (IsClip(mask)) ? mask.ConvertToY8(matrix="PC.709").MTballoon2PX(2) : nop
    clpS = clp.ScriptClip("subtitle(string(current_frame))")

    # Construct a clip to check thresholds (for deblending analysis) #
    #================================================================#

   if(Mode == 1) {
        ARGS="mask"
        clpB = clp.GScriptClip("_VFX2("+args+")", local=true, args=ARGS, after_frame=true)

        Msk1 = mask.MTballoon2PX(2).mt_logic(mask, mode="xor")  # 2px wide mask around logo (+2px offset from the base mask)
        clp5 = clpB.Overlay(clp, mask=Msk1)

    } else {

        # Construct a clip to check thresholds (for Automask=1) #
        #=======================================================#

        cT = clp.crop(4, 4, -4, -1*(VH-6))
        cB = clp.crop(4, VH-6, -4, -4)
        cL = clp.crop(4, 4, -1*(VW-6), -4)
        cR = clp.crop(VW-6, 4, -4, -4)

        if(Ignore == "top") {
          cT = cB
        } else if (Ignore == "bottom") {
          cB = cT
        } else if (Ignore == "left") {
          cL = cR
        } else if (Ignore == "right") {
          cR = cL
        }

        wc = StackHorizontal(cr,cl).TurnLeft
        hc = StackVertical(ct,cb)

        if(wc.width > hc.width) {
          hc  = hc.PointResize(wc.width, hc.height)
          out = StackVertical(wc,hc)
          } else if(wc.width < hc.width) {
              wc  = wc.PointResize(hc.width, wc.height)
              out = StackVertical(wc,hc)
          } else {
              out = StackVertical(wc,hc)
          }
        clp5 = (Show == 2) ? out.PointResize(VW, VH) : out
    }

    # Delete frames above thresholds (that leaves us with the suitable frames for analysis) #
    #=======================================================================================#
#return clp5

    # Mod of Gavino's DeleteFrames() - https://forum.doom9.org/showthread.php?t=163107
    clp5
    fc  = FrameCount()
    res = BlankClip(clp, length=0)
    condition = "YPlaneMinMaxDifference >" +String(Th)+ " || UPlaneMinMaxDifference >" +String(Round(Th/2))+ " || VPlaneMinMaxDifference >" +String(Round(Th/2))
    current_frame = 0

    while (current_frame < fc) {
      while (Eval(condition) && current_frame < fc) {
        current_frame = current_frame+1
      }
      if (current_frame < fc) { # not at end
        start = current_frame # start of wanted section
        while (!Eval(condition) && current_frame < fc) {
          current_frame = current_frame+1
        }
        clpX = (Show == 1) ? clpS : (Show == 2) ? clp5 : clp   # 0: Original frames, 1: Original frames + frameNo, 2: Constructed clips (Mode=2 clip is upsized for show)
        res  = res + clpX.Trim(start, start-current_frame)
      }
    }
    Assert (!(res.FrameCount < 2), """No frames found to analyze, increase "Analyze5Th".""")
    return res
}
Client
Code:
IsPlus = FindStr(VersionString.lcase,"avisynth+")!=0
(IsPlus) ? Import(".\Analyze5FX.avs") : GImport(".\Analyze5FX.avs")

x = LSMASHVideoSource(".\899.mp4")
x = x.crop(1124,24,-52,-636).Trim(30,100) # trimed for speed
mask = ImageSource(".\WieMHwJ.png",0,0)
x=x.BilinearResize(x.width*4,x.height*4)
mask=mask.BilinearResize(mask.width*4,mask.height*4)


# Mode 1 test

m0 = x.Analyze5FX(mask=mask, mode=1, show=0)
m1 = x.Analyze5FX(mask=mask, mode=1, show=1)
m2 = x.Analyze5FX(mask=mask, mode=1, show=2)
mu = Stackhorizontal(m0.AddBorders(0,0,2,0,$000000), m0)
md = Stackhorizontal(m1.AddBorders(0,0,2,0,$000000), m2)
Stackvertical(mu.AddBorders(0,0,0,2,$000000), md)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th November 2021 at 04:55.
StainlessS is offline   Reply With Quote
Old 11th November 2021, 08:33   #204  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by StainlessS View Post
if(current_frame % 2 ==0) { # <<<<<<<< Error at curly brace, scriptclip dont know what it is
Ha, told ya that error is at the first curly bracket.

Quote:
Originally Posted by StainlessS View Post
the parts in red above [and prev code block] should not be GImported, should be in client script.
That's a dealbreaker, but the first working example works. Here is version with less Inception:

User script:
Code:
GImport("c:\Analyze5FX.avs")
GImport("c:\InpaintDelogo.avs")
x = LSMASHVideoSource("D:\899.mp4")
x = x.crop(1124,24,-52,-636).Trim(30,100) # trimed for speed 
mask = ImageSource("D:\mask.bmp",0,0)

# Mode 1 test
m0 = x.Analyze5FX(mask=mask, mode=1, show=0)
m1 = x.Analyze5FX(mask=mask, mode=1, show=1)
m2 = x.Analyze5FX(mask=mask, mode=1, show=2)
mu = Stackhorizontal(m0.AddBorders(0,0,2,0,$000000), m0)
md = Stackhorizontal(m1.AddBorders(0,0,2,0,$000000), m2)
Stackvertical(mu.AddBorders(0,0,0,2,$000000), md)
Analyze5FX.avs:
Code:
Function VFX2(clip mask, string Analyze5DB) {
    Status = (mask.RT_YInRangeLocate(Baffle=1,lo=255,hi=255)) ? 1 : 2
    if(Status==1) {
        RT_DBaseSet(Analyze5DB,0,Status,YIRL_X,YIRL_Y,YIRL_W,YIRL_H)
    } else {
        RT_DBaseSetField(Analyze5DB,0,0,Status)
    }
    return Last
}


function Analyze5FX(clip clp, val "mask", int "Mode", int "Analyze5Th", string "Ignore", int "Show") {
    mask       = default (mask         , "")
    Mode       = default (Mode         , 1 )
    Analyze5Th = default (Analyze5Th   , 15)
    Ignore     = default (Ignore   , "none")
    Show       = default (Show         ,  0)

    Assert (!(Mode       < 1 || Mode       >   2), """"Mode" value must be between 1 and 2.""")
    Assert (!(Analyze5Th < 1 || Analyze5Th > 255), """"Analyze5Th" value must be between 1 and 255.""")
    Assert (!(Show       < 0 || Show       >   2), """"Show" value must be between 0 and 2.""")
    Assert ((Ignore == "top" || Ignore == "bottom" || Ignore == "left" || Ignore == "right" || Ignore == "none"), """"Ignore" string must be 'top', 'bottom', 'left', 'right' or 'none'.""")

    VW   = clp.Width
    VH   = clp.Height
    Th   = Analyze5Th
    mask = (IsClip(mask)) ? mask.ConvertToY8(matrix="PC.709").MTballoon2PX(2) : nop
    clpS = clp.ScriptClip("subtitle(string(current_frame))")

    # Construct a clip to check thresholds (for deblending analysis) #
    #================================================================#

    if(Mode == 1) {
        # Get coords of the logo mask
        Analyze5DB = ("~InpaintDelogo_Analyze5_"+RT_LocalTimeString+".DB").RT_GetFullPathName
        RT_DBaseAlloc(Analyze5DB,1,"iiiii")
        ARGS="Analyze5DB"
        Parse = mask.ScriptClip("VFX2("+args+")", local=true, args=ARGS, after_frame=true)
        Parse.RT_YankChain(n=0)

        Assert (!(RT_DBaseGetField(Analyze5DB,0,0) == 2), "Mask image is invalid.")
        mX = RT_DBaseGetField(Analyze5DB,0,1)
        mY = RT_DBaseGetField(Analyze5DB,0,2)
        mW = RT_DBaseGetField(Analyze5DB,0,3)
        mH = RT_DBaseGetField(Analyze5DB,0,4)
        RT_FileDelete(Analyze5DB)

        # Convert X,Y,W,H coords to L,T,-R,-B coords
        mL = mX
        mT = mY
        mR = -VW + mW + mX
        mB = -VH + mY + mH
        Assert (!(mL < 8 && -1*mR < 8 || mT < 8 && -1*mB < 8), "Mask image or Loc is invalid.")

        # Coords mod2 round up
        mL = mL + (mL % 2)
        mT = mT + (mT % 2)
        mR = mR - (mR % 2)
        mB = mB - (mB % 2)

        # Crop 2x2 pxs area from above or below the logo and make a background from it
        mid = (VW-mL+mR)/2+mL
        mid = mid + (mid % 2)
        clp2x2 = (mT >= -1*mB) ? clp.crop(mid-2, mT-2, -1*(VW-mid), -VH+mT+2) : clp.crop(mid-2, VH+mB-2, -1*(VW-mid), mB+2)
        clpB = clp2x2.PointResize(VW, VH)

        Msk1 = mask.MTballoon2PX(2).mt_logic(mask, mode="xor")  # 2px wide mask around logo (+2px offset from the base mask)
        clp5 = clpB.Overlay(clp, mask=Msk1)

    } else {

        # Construct a clip to check thresholds (for Automask=1) #
        #=======================================================#

        cT = clp.crop(4, 4, -4, -1*(VH-6))
        cB = clp.crop(4, VH-6, -4, -4)
        cL = clp.crop(4, 4, -1*(VW-6), -4)
        cR = clp.crop(VW-6, 4, -4, -4)

        if(Ignore == "top") {
          cT = cB
        } else if (Ignore == "bottom") {
          cB = cT
        } else if (Ignore == "left") {
          cL = cR
        } else if (Ignore == "right") {
          cR = cL
        }

        wc = StackHorizontal(cr,cl).TurnLeft
        hc = StackVertical(ct,cb)

        if(wc.width > hc.width) {
          hc  = hc.PointResize(wc.width, hc.height)
          out = StackVertical(wc,hc)
          } else if(wc.width < hc.width) {
              wc  = wc.PointResize(hc.width, wc.height)
              out = StackVertical(wc,hc)
          } else {
              out = StackVertical(wc,hc)
          }
        clp5 = (Show == 2) ? out.PointResize(VW, VH) : out
    }

    # Delete frames above thresholds (that leaves us with the suitable frames for analysis) #
    #=======================================================================================#

    # Mod of Gavino's DeleteFrames() - https://forum.doom9.org/showthread.php?t=163107
    clp5
    fc  = FrameCount()
    res = BlankClip(clp, length=0)
    condition = "YPlaneMinMaxDifference >" +String(Th)+ " || UPlaneMinMaxDifference >" +String(Round(Th/2))+ " || VPlaneMinMaxDifference >" +String(Round(Th/2))
    current_frame = 0

    while (current_frame < fc) {
      while (Eval(condition) && current_frame < fc) {
        current_frame = current_frame+1
      }
      if (current_frame < fc) { # not at end
        start = current_frame # start of wanted section
        while (!Eval(condition) && current_frame < fc) {
          current_frame = current_frame+1
        }
        clpX = (Show == 1) ? clpS : (Show == 2) ? clp5 : clp   # 0: Original frames, 1: Original frames + frameNo, 2: Constructed clips (Mode=2 clip is upsized for show)
        res  = res + clpX.Trim(start, start-current_frame)
      }
    }
    Assert (!(res.FrameCount < 2), """No frames found to analyze, increase "Analyze5Th".""")
    return res
 }
Now same needs to be done with the subs extractor thingy and it should be compatible with Avs 2.6 again (just no autoloading there).

EDIT:
Just remembered one thing I didn't understand, if you feed RGB24 clip to that frame deleting block it gave me some error.
condition needs to be changed to condition = "RPlaneMinMaxDifference >" +String(Th), should work with mode=2 (no need for mask there).

EDIT2:
Removed "Double GScript" stuff from Analyze5FX.avs.

Last edited by VoodooFX; 17th November 2021 at 00:34.
VoodooFX is offline   Reply With Quote
Old 11th November 2021, 14:03   #205  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Ha, told ya that error is at the first curly bracket.
Clever clogs.

Quote:
That's a dealbreaker, but the first working example works.
I just meant that you dont [usually] put your entire script including eg Avisource("...") in Plugins, nor do you Import nor GImport an entire script,
so you would not add your "User script" to the GImport script. [that was intended for everybody, not just a capable coder like yourself].

Gotta get some milk [mine sour].

EDIT: I just noticed that you've stolen a CopyRight'ed image of mine for your avatar.
Quote:
Originally Posted by StainlessS View Post
Still not got the damn thing working properley, on last try (using more like the original patch code), it was prodcuing something quite akin
to the mandelbrot stuff, looks well weird.


If there had been a logo in above images, they would certainly have been eliminated.
Had I done above patterns deliberately, I would have been quite proud if it.
That is very naughty of you, my legal brief will be in contact shortly. [EDIT: 'Brief', Brit slang for solicitor/lawyer or more specifically barrister]
Its no wonder that you're a "Banned User".
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th November 2021 at 14:51.
StainlessS is offline   Reply With Quote
Old 11th November 2021, 20:31   #206  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by StainlessS View Post
you've stolen a CopyRight'ed image of mine for your avatar.
Yeap, I'm infamous for stealing the Mandelbrot's abstract art from the museums.
I guess that's why they banned me. There is an old murican proverb: Ban me once, shame on... shame on you, the banned can't be banned again.

Anyway, here you go:
Code:
# Version 1.46 : 2021/11/11.  Support for AviSynth v2.6 [with the StainlessS's help].
And there is a "small" price to pay. [I would blame StainlessS]
Code:
Notes for AviSynth v2.6 users:
#  "InpaintDelogo.avsi" needs to be renamed to "InpaintDelogo.avs",
#  and loaded manually in AviSynth script with: GImport("C:\AviSynth 2.5\plugins\InpaintDelogo.avs")
#  Subs extraction is up to 600% slower than with AviSynth+!
EDIT:
OH gosh, oh tinboy, YOU [we] broke something in AvsPmod... definitely something weird is going on... I need to get that can of beer now...

Last edited by VoodooFX; 11th November 2021 at 21:00.
VoodooFX is offline   Reply With Quote
Old 11th November 2021, 21:09   #207  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Code:
GScript("""
    Function VFX1_GScript(clip c, string FrameDB, int CropW, int CropH) {
        c
        n = current_frame
        Status = RT_DBaseGetField(FrameDB,n,0)
        if(Status == 0) {  # Unknown Status
            Status = crop(CropW,CropH,-1*CropW,-1*CropH).AverageLuma.Sign
            if(Status == 1) { RT_DBaseSet(FrameDB,n,Status) }
        }
        Return Last
    }
""")
Nah, Nah, Nah !!!, I might as well talk to the wall.
When you GImport(), you dont need the GScript thingy, Instead of, not as well as.
[Dont know what effect doubling up on Gscript thingy will have, cant be good]

Nice George Dubya clip, says it all really

EDIT:
Also, you can just put the script [avs or avsi] in AvsInit GIMPORT folder, does auto load for scripts [with GSCript("...") wrappers REMOVED].
AvsInit:- https://forum.doom9.org/showthread.p...hlight=AvsInit
Not sure, maybe Real.Finder has a similar functioning setup.

EDIT:
Test script
Code:
blankClip
ScriptClip("""RT_Subtitle("%d]",current_frame)""")
And Debug output from AvsInit:
Code:
00000348    20:27:00    AvsInit:
00000349    20:27:00    AvsInit: Auto load plugins script ENTRY
00000350    20:27:00    AvsInit:
00000351    20:27:00    AvsInit_ShowInfo:
00000352    20:27:00    AvsInit_ShowInfo: AvsInit_Version     = 1.10
00000353    20:27:00    AvsInit_ShowInfo: GScript Available   = AVS+
00000354    20:27:00    AvsInit_ShowInfo: RT_Stats Version    = 2.00Beta13
00000355    20:27:00    AvsInit_ShowInfo: SysInfo Version     = 0.127000
00000356    20:27:00    AvsInit_ShowInfo: SysInfo.dll DIR     = C:\VideoTools\AvisynthRepository\AVSPLUS370_x86\plugins
00000357    20:27:00    AvsInit_ShowInfo: VersionString       = AviSynth+ 3.7.1 (r3482, master, i386)
00000358    20:27:00    AvsInit_ShowInfo: SetMemoryMax        = 1024
00000359    20:27:00    AvsInit_ShowInfo: Avisynth Bitness    = 32
00000360    20:27:00    AvsInit_ShowInfo: WorkingDir          = C:\VideoTools\AvisynthRepository\AVSPLUS370_x86\plugins\
00000361    20:27:00    AvsInit_ShowInfo: ProcessName         = C:\NON-INSTALL\VDUB\VDUB2\VirtualDub.exe
00000362    20:27:00    AvsInit_ShowInfo: ParentProcessName   = PSPad.exe
00000363    20:27:00    AvsInit_ShowInfo: OSVersionString     = Windows 10 (x64) (Build 18363)
00000364    20:27:00    AvsInit_ShowInfo: OSVersionNumber     = 10.000000
00000365    20:27:00    AvsInit_ShowInfo: OS Bitness          = 64
00000366    20:27:00    AvsInit_ShowInfo: CPUName             = Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz / Coffee Lake (Core i7)
00000367    20:27:00    AvsInit_ShowInfo: Cores               = 06:12 (Phy:Log)
00000368    20:27:00    AvsInit_ShowInfo: CPU Extensions      = MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, FMA3, RDSEED, ADX, AVX, AVX2
00000369    20:27:00    AvsInit_ShowInfo: Total Memory        = 32621MB
00000370    20:27:00    AvsInit_ShowInfo: Avail Memory        = 29677MB'
00000371    20:27:00    AvsInit_ShowInfo: Screen Res          = 1920x1080
00000372    20:27:00    AvsInit_ShowInfo: Screen BitsPerPixel = 32
00000373    20:27:00    AvsInit_ShowInfo: Time                = Thursday 11 November 2021 20:27:00[GMT Standard Time]
00000374    20:27:00    AvsInit_ShowInfo: User TEMP Dir       = C:\Users\steve\AppData\Local\Temp
00000375    20:27:00    AvsInit_ShowInfo: ComSpec             = C:\Windows\system32\cmd.exe
00000376    20:27:00    AvsInit_ShowInfo: Computer Name       = OMEN-W10P5
00000377    20:27:00    AvsInit_ShowInfo: User Name           = steve
00000378    20:27:00    AvsInit_ShowInfo:
00000379    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\DBSC.avsi
00000380    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\dither.avsi
00000381    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\Favc.avsi
00000382    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\InpaintDelogo.avsi
00000383    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\JohnFPS.avsi
00000384    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\McDegrain.avsi
00000385    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\Misc.avsi
00000386    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\RoboSplice.avsi
00000387    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\SetMTMode.avsi
00000388    20:27:00    AvsInit_DImport:     Importing ... C:\VideoTools\AvisynthRepository\GIMPORT\SpotLess.avsi
00000389    20:27:00    AvsInit_DImport:         IMPORTED 10 scripts from 'C:\VideoTools\AvisynthRepository\GIMPORT'
00000390    20:27:00    AvsInit_DImport:         IMPORTED 0 scripts from 'C:\VideoTools\AvisynthRepository\AVSPLUS370_x86\plugins\GIMPORT'
00000391    20:27:00    AvsInit_DLoadConditional: STARTING DLL SCAN on C:\VideoTools\AvisynthRepository\MACHINE
00000392    20:27:00    AvsInit_DLoadConditional: DePan.dll                        LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000393    20:27:00    AvsInit_DLoadConditional: DePanEstimate.dll                LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000394    20:27:00    AvsInit_DLoadConditional: dfttest.dll                      LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000395    20:27:00    AvsInit_DLoadConditional: DGDecodeNV.dll                   LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000396    20:27:00    AvsInit_DLoadConditional: FFMS2.dll                        LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000397    20:27:00    AvsInit_DLoadConditional: LSMASHSource.dll                 LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000398    20:27:00    AvsInit_DLoadConditional: masktools2.dll                   LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000399    20:27:00    AvsInit_DLoadConditional: MedianBlur2.dll                  LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000400    20:27:00    AvsInit_DLoadConditional: mvtools2.dll                     LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000401    20:27:00    AvsInit_DLoadConditional: nnedi3.dll                       LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000402    20:27:00    AvsInit_DLoadConditional: RemoveDirt.dll                   LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000403    20:27:00    AvsInit_DLoadConditional: TIVTC.dll                        LoadPlugin OK from 2_WIN7_0\2_AVS26x86\0_CPP
00000404    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\DePan.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000405    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\DePanEstimate.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000406    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\dfttest.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000407    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\ffms2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000408    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\masktools2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000409    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\MedianBlur2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000410    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\mvtools2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000411    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\nnedi3.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000412    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\2_AVS26x86\0_CPP\TIVTC.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000413    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\1_AVS26Stdx86\0_CPP\ffms2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000414    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\1_AVS26Stdx86\0_CPP\masktools2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000415    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\1_AVS26Stdx86\0_CPP\mvtools2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000416    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\1_AVS26Stdx86\0_CPP\nnedi3.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000417    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\1_AVS26Stdx86\0_CPP\RemoveDirt.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000418    20:27:00    AvsInit_DLoadConditional: DGDecode.dll                     LoadPlugin OK from 0_XP\0_AVS25x86\0_CPP
00000419    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\0_AVS25x86\0_CPP\ffms2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000420    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\0_AVS25x86\0_CPP\LSMASHSource.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000421    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\0_AVS25x86\0_CPP\masktools2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000422    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\0_AVS25x86\0_CPP\mvtools2.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000423    20:27:00    AvsInit_DLoadConditional: !!! Skipping File 0_XP\0_AVS25x86\0_CPP\RemoveDirt.dll, already loaded from 2_WIN7_0\2_AVS26x86\0_CPP
00000424    20:27:00    AvsInit_DLoadConditional: STARTING SCRIPT SCAN on C:\VideoTools\AvisynthRepository\MACHINE
00000425    20:27:00    AvsInit_DLoadConditional:   13 dll's   LOADED : 19 dll's   SKIPPED : 0 dll's   FAILED
00000426    20:27:00    AvsInit_DLoadConditional:   0 scripts LOADED : 0 Scripts SKIPPED : 0 scripts FAILED
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th November 2021 at 22:45.
StainlessS is offline   Reply With Quote
Old 11th November 2021, 21:37   #208  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by StainlessS View Post
When you GImport(), you dont need the GScript thingy.
That's another problem I guess, now AvsPmod just doesn't start, AvS+ and no GImport there, it just crash at start when trying to autoload InpaintDelogo.avsi. If you rename avsi to avs, start AvsPmod and rename avs back, then AvsPmod loads script and the script works OK... weird... need to investigate.

Last edited by VoodooFX; 21st November 2021 at 13:55.
VoodooFX is offline   Reply With Quote
Old 11th November 2021, 21:53   #209  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
[after remove the GScript("...") thingy]
You can just put eg "InPaintDelogo_AutoLoader.avsi" into your plugins, something like

InPaintDelogo_AutoLoader.avsi
Code:
IsPlus = FindStr(VersionString.lcase,"avisynth+")!=0
(IsPlus) ? Import("SOMEPATH\Analyze5FX.avs") : GImport("SOMEPATH\Analyze5FX.avs")  # where SOMEPATH might be ".\VoodooFX" or other.
Its not rocket science.

For AvsInit(), just drop the InPaintDelogo.avsi into one of the GIMPORT folders [has one for each version of Avisynth, but most might use the all Avisynth versions GIMPORT folder].

EDIT:
Quote:
Subs extraction is up to 600% slower than with AviSynth+!
There has gotta be something weird happening there [maybe the double Gscript/GImport thing], not a lot of difference between
Gscript and AVS+ Gscript extensions usually.

EDIT: When I say "has one for each version of Avisynth", I use and intend use with Groucho2004 "Universal Avisynth Installer":- https://forum.doom9.org/showthread.php?t=172124
which allows easy switch to one of multiple versions of avisynth [1 x86, and 1 x64, simultaneous installed].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th November 2021 at 22:56.
StainlessS is offline   Reply With Quote
Old 11th November 2021, 22:39   #210  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
AvsPmod crash at start is fixed:

Quote:
# Version 1.47 : 2021/11/11. Fixed: "Double Gscript".
Same slow on v2.6, but hey now with the AvsInit ad:
Code:
#   Notes for AviSynth v2.6 users:
#  Requirement: GScript ( http://avisynth.nl/index.php/GScript ).
#  "InpaintDelogo.avsi" needs to be renamed to "InpaintDelogo.avs",
#  and loaded manually in AviSynth script with: GImport("C:\AviSynth 2.5\plugins\InpaintDelogo.avs"),
#  or use AvsInit for autoloading ( https://forum.doom9.org/showthread.php?t=176749 ).
#  Subs extraction is up to 600% slower than with AviSynth+!

Last edited by VoodooFX; 11th November 2021 at 23:23.
VoodooFX is offline   Reply With Quote
Old 11th November 2021, 22:56   #211  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by StainlessS View Post
There has gotta be something weird happening there [maybe the double Gscript/GImport thing], not a lot of difference between
Gscript and AVS+ Gscript extensions usually.
I get (v1.47, no double Gscript):
Code:
Extract test:         5s in AvS+, 32s in AvS v2.6.
Mask + Extract test: 55s in AvS+, 80s in AvS v2.6.
Files:
https://we.tl/t-942gjNbEso
Code:
GImport("c:\InpaintDelogo.avs") # For v2.6
ImgDir  = "d:\IMAGES\" 

# Extract test:
LWLibavVideoSource("d:\subs_anime_mask.mkv")
SubsMask2Img(ImgDir=ImgDir)

#~ # Mask + Extract test:
#~ LWLibavVideoSource("d:\subs_anime.mkv")
#~ InpaintDelogo(Loc="0,0,-0,-0",
#~ \ oPP=0,
#~ \ DynMask=4, DynTune=220, DynMask4H=60, KillNoise=-5,
#~ \ Show=4, Extract=1, ImgDir=ImgDir)

Last edited by VoodooFX; 14th November 2021 at 00:19.
VoodooFX is offline   Reply With Quote
Old 14th November 2021, 20:01   #212  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 346
I’m not sure that I understand what the purpose of “Dynamic mask” is. Is it intended to mask a changing logo, within a specified Loc="x,x,-x,-x", and within a single video or can it chase an identical logo that is applied to multiple videos, but in slightly different coordinates …or both?

Perhaps this will be clearer if I explain by way of an example of what I want:

I have 100 episodes of a show. The same sized logo appears in each show. However, that logo, while having fixed coordinates within each episode, may be in slightly different coordinates from one episode to another. I would like to have InpaintDelogo find the logo, within a defined Loc="x,x,-x,-x", and apply the mask wherever that logo appears in the defined Loc="x,x,-x,-x". This Loc="x,x,-x,-x" will have the same coordinates for each episode.
Danette is offline   Reply With Quote
Old 14th November 2021, 22:06   #213  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by Danette View Post
I’m not sure that I understand what the purpose of “Dynamic mask” is. Is it intended to mask a changing logo, within a specified Loc="x,x,-x,-x", and within a single video or can it chase an identical logo that is applied to multiple videos, but in slightly different coordinates …or both?
“Dynamic mask” is a whole B/W mask clip in Y8, same frame length as video and same dimensions as Loc area, "object" can change there every frame, you can supply such mask from external plugin or use some internal methods.
I don't know any identical object recognition plugin for Avisynth, wonkey_monkey mentioned that he has some experimental plugin, but that's it. (EDIT: There is some AvisythTrackin plugin)
There are few internal DynMask methods to do the dynamic masks for some specific objects like bright-nontransparent logos (like subtitles). (EDIT: There is StainlessS's DetSub plugin)

From your description you would need to use a one frame/image mask, if it changes location in another video then you need to create another image mask for that video. If you don't know how to create a mask in Photoshop then you can use "Automask" parameter and its sub-parameters to do it for you.
(EDIT: If logo is non-transparent and moves just one pixel, then with Inflate=2 you probably can do all videos with same mask)

Post some screens of that logo/mask/script and I can advice further on the matter. There is "Show=1" parameter so you could post screen of that too.

Last edited by VoodooFX; 18th November 2021 at 10:54.
VoodooFX is offline   Reply With Quote
Old 14th November 2021, 23:58   #214  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 346
Thanks. I guess we’ll have to wait for AI.

I think you have an exact understanding of my intent, so I’ll do what I used to do with VDub DeLogo which is, as you said, creating new masks whenever an adjustment is needed for a new episode. I can do this, easily, with PhotoImpact. However, I will be using InpaintDelogo, as I’ve convinced myself that it is far better than VDub DeLogo. I was just hoping that a non-manual adjustment capability was buried in there somewhere.

The Inflate=2 won’t be enough. If Inflate=x had the option to go up to about 20 pixels, then I could adapt to that. If it did inflate that much, even better would be inflating by one, or more, of the 4 coordinates. Generally, these logos only drift horizontally, so top and bottom inflation is not needed.
Danette is offline   Reply With Quote
Old 15th November 2021, 00:55   #215  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by Danette View Post
Thanks. I guess we’ll have to wait for AI.
AI is not necessary for same object recognition.

Quote:
Originally Posted by Danette View Post
I will be using InpaintDelogo, as I’ve convinced myself that it is far better than VDub DeLogo.
If there were anything better in VDub'd Delogo then I would have included option for it.

Quote:
Originally Posted by Danette View Post
Generally, these logos only drift horizontally, so top and bottom inflation is not needed.
Then it is just few seconds to move it few pixels in the image editors. Inflate just expands a base mask the few pixels to cover possible artifacts at the edges.

Last edited by VoodooFX; 15th November 2021 at 01:04.
VoodooFX is offline   Reply With Quote
Old 18th November 2021, 02:44   #216  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 346
I am now attempting to apply InpaintDelogo(mask="xxxx.bmp", Loc="xxx,xxx,-xxx,-xxx",Mode="Inpaint") to remove the first logo, but have run into a problem. How do I specify that a mask be applied to one or more ranges of frames in a video? For example; if I want to remove the logo that is present between frames 10870 and 11870 and then also between frames 13000 and 14000. This was simple with VDub Delogo, but I cannot find the method for InpaintDelogo.
Danette is offline   Reply With Quote
Old 18th November 2021, 04:05   #217  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by Danette View Post
I want to remove the logo that is present between frames 10870 and 11870 and then also between frames 13000 and 14000.
Use Trim. Here a basic example how it's done:

Code:
o=DGDecode_mpeg2source("D:\clip.d2v")

# Deinterlace before delogo:
c=o.QTGMC().SelectEven()

# Split video with Trim() & delogo on some ranges:
t1=c.Trim(0, 10869)
t2=c.Trim(10870, 11870).InpaintDelogo()
t3=c.Trim(11871, 12999)
t4=c.Trim(13000, 14000).InpaintDelogo()
t5=c.Trim(14001, 999999)

# Then join video back:
t1+t2+t3+t4+t5

Last edited by VoodooFX; 18th November 2021 at 04:10.
VoodooFX is offline   Reply With Quote
Old 18th November 2021, 05:31   #218  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 346
Ugh! I had considered that. That’s fine for one logo and one or two segments in a couple of videos, but if I have 3-4 logos, all in 1-20 different frame segments in a single video, that’s quite an unwieldy mess of script. I could be looking at 20-30 lines, or more, of trim script. Then, multiply that by a couple hundred videos. VDub’s Delogo starts to look really good as the optimal choice, despite somewhat inferior logo removal.

I appreciate your help, but InpaintDelogo does not seem to be a good choice for situations such as mine.
Danette is offline   Reply With Quote
Old 18th November 2021, 09:59   #219  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 997
Quote:
Originally Posted by Danette View Post
Ugh! I had considered that. Thatís fine for one logo and one or two segments in a couple of videos, but if I have 3-4 logos, all in 1-20 different frame segments in a single video, thatís quite an unwieldy mess of script.
Then you need to learn a bit more about AviSynth.

Dealing with lots of ranges and logos with ClipClop:
Code:
V1 = InpaintDelogo( mask="D:\logo1.bmp")
V2 = InpaintDelogo( mask="D:\logo2.bmp")
V3 = InpaintDelogo( mask="D:\logo3.bmp")

Ranges="""  # Various ranges for various logos
1 0,500; 1 3400,3800; 1 4000,4444
2 2020,2500
3 1100,1900
"""

ClipClop(Last,V1,V2,V3,scmd=Ranges,show=false)
Or ClipClop with nicknames:
Code:
V1 = InpaintDelogo( mask="D:\logo1.bmp")
V2 = InpaintDelogo( mask="D:\logo2.bmp")
V3 = InpaintDelogo( mask="D:\logo3.bmp")

NickNames ="""  # Psuedonyms for clips (clip index number)
Logo1 = 1
Logo2 = 2
Logo3 = 3
"""

Ranges="""  # Various ranges for various logos
Logo1 0,500
Logo3 1100,1900
Logo2 2020,2500
Logo1 3400,3800
Logo1 4000,4444
"""

ClipClop(Last,V1,V2,V3,scmd=Ranges,nickname=NickNames,show=false)
Or RemapFrames:
Code:
V1 = InpaintDelogo( mask="D:\logo1.bmp")
V2 = InpaintDelogo( mask="D:\logo2.bmp")
V3 = InpaintDelogo( mask="D:\logo3.bmp")

ReplaceFramesSimple(Last,V1,Mappings="[0 500] [3400 3800] [4000 4444]")
ReplaceFramesSimple(Last,V2,Mappings="[2020 2500]")
ReplaceFramesSimple(Last,V3,Mappings="[1100 1900]")
VoodooFX is offline   Reply With Quote
Old 18th November 2021, 14:01   #220  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 346
Quote:
Originally Posted by VoodooFX View Post
Then you need to learn a bit more about AviSynth.
You are making an understatement ...I need to learn a lot more about Avisynth!

Thanks for the lesson. Odd that my searching didn't find any of that approach. I will work with that script to see how well it works for my situation. It looks like it should do the job.
Danette is offline   Reply With Quote
Reply

Tags
delogo, hardsubs, ocr, remove, watermark

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.