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 2nd January 2017, 20:08   #161  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
Quote:
Would it be hard to modify the InPaintFunc script so it doesn't convert the whole frame to RGB?
I'll take a look, not promising anything.

Quote:
The weird green frames of which you speak.... are they something you've experienced in the output video? I've only ever seen them when using debug=true
It looks like I was wrong about DeblendLogo(), looks like weird green stuff is purely down to maybe filter ordering or something, I've added a couple of
bits to the script to set chroma=128 in a couple of mt_ calls, fixes the debug output and less worrying to look at. I might actually use this script now.
RM_logo.avs v0.6
Code:
# rm_logo() Version 0.6 -- 02.01.2016.
#  v0.6, fixed weird green frames in Debug=true mode, StainlessS.
#
# Script to help in the removal of channel logos or other distracting objects
#
# Required filters:
# AVSInpaint: Ver 2008-01-06
#             Discussion & Code : http://forum.doom9.org/showthread.php?t=133682
# ExInpaint:  Ver 0.1+
#             Code http://avisynth.org.ru/exinpaint/exinpaint.html
# mt_masktools: Ver 2.0.32+
#               Code http://manao4.free.fr/masktools-v2.0a32.zip
# removegrain: Ver 1.0 (8/2005)
#              Code  http://www.removegrain.de.tf
# fft3dfilter: Ver 2.1.1 or later
#              Code http://avisynth.org.ru/fft3dfilter/fft3dfilter.html
# ttempsmoothf Ver 0.9.4 or later
#              Code http://bengal.missouri.edu/~kes25c/
# medianblur Ver 0.8.4
#            Code http://www.avisynth.org/tsp/medianblur084.zip
#
function rm_logo( clip clp, string "logomask", string "loc",float "par", string "mode",int "percent",int "deblendfalloff",\
                  int "AlphaToRepair", float "RepairRadius", float "InpaintRadius", float "InpaintSharpness",\
                  float "InpaintPreBlur", float "InpaintPostBlur", string "cutsize", bool "lmask", int "pp", bool "debug", \
                  int "cutwidth", int "cutheight") {
    logomask         = default( logomask,           "" ) # file location of the logo, the must be masked in pure white
    loc              = default( loc,                "" ) # where is the logo, TR, TL, BR, BL for top right, top left, bottom right, bottom left
    cutsize          = default( cutsize,       "small" ) # how big a cut to make, small, medium, large
    cutwidth         = default( cutwidth,            0 ) # how wide a cut to make in pixels, -1 for full width of frame
    cutheight        = default( cutheight,           0 ) # how tall a cut to make in pixels, -1 for full height of frame
    par              = default( par,               1.0 ) # pixel aspect ratio
    mode             = default( mode,           "both" ) # deblend, inpaint or both
    percent          = default( percent,            25 ) # how much of the clip to analyse in creating color&alpha masks, more is better but slower
    deblendfalloff   = default( deblendfalloff,      5 ) # graidient fallout from logo mask
    AlphaToRepair    = default( AlphaToRepair,     130 ) # what is the luma value of the solid part of the logo
    RepairRadius     = default( RepairRadius,      1.0 ) # used to expand the mask for none alpha ie solid areas
    InpaintRadius    = default( InpaintRadius,     6.0 ) # radius around a damaged pixel from where values are taken when the pixel  is inpainted. Bigger values prevent
                                                         # inpainting in the wrong direction, but also create more blur
    InpaintSharpness = default( InpaintSharpness, 25.0 ) # Higher values can prevent blurring caused by high Radius values.
    InpaintPreBlur   = default( InpaintPreBlur,    1.5 ) # Standard deviation of the blur which is applied to the image before the structure tensor is computed. Higher values
                                                         # help connecting isophotes which have been cut by the inpainting region, but also increase CPU usage. PreBlur=0.0
                                                         # disables pre-blurring.
    InpaintPostBlur  = default( InpaintPostBlur,   5.0 ) # standard deviation of the blur which is applied to the structure tensors before they are used to determine the
                                                         # inpainting direction. Higher values help gather more directional information when there are only few valid pixels
                                                         # available, but increases CPU usage
    lmask            = default( lmask,            true ) # apply post process through a repair mask
    PP               = default( PP,                  1 ) # Post process function 0,1,2 to help reduce damage left behind by logo removal
    debug            = default( debug,           false ) # show mask to help in tunning the output

    # set up some values that we need to run
    clp_width   = width( clp )
    clp_height  = height( clp )
    RGB         = isRGB( clp )
    RGB32       = isRGB32( clp )
    RGB24       = isRGB24( clp )
    par         = ( par!= 1.0 ) ? float( clp_height ) / float( clp_width ) * par : 1.0
    percent     = ( percent < 0) ? 25 : (percent > 100) ? 100 : percent

    # Get the always fun input error checking done
    assert        ( logomask != "" , "You have to define a logomask")
    assert        ( loc      != "" , "You must provide a value for Loc UL,UR,LL,LR")
    assert        ( loc == "TR" || loc == "TL" || loc == "BR" || loc == "BL"  , "Loc must be one of TR, TL, BR, BL")
    assert        ( mode == "both" || mode == "inpaint" || mode == "deblend", "Specified mode doesn't exist.")

    # Get our crop locations based on the passed location
    loc         = UCase( loc )
    cutsize     = UCase( cutsize )
    multi       = ( cutsize == "SMALL" ) ? 2.25 : ( cutsize == "MEDIUM" ) ? 2.15 : 2
    chunk       = ( clp_height > 720 ) ? 2.9 : 3
    cutwidth    = ( cutwidth == 0 || cutwidth == -1 ) ? cutwidth : m4(cutwidth)
    cutheight   = ( cutheight == 0 || cutheight == -1 ) ? cutheight : m4(cutheight)

    a           = ( Rightstr( loc, 1 ) == "L" ) ? 0 : (cutwidth  == 0 ) ?  m4( (clp_width  / chunk )  * multi ) : (cutwidth  == -1 ) ? 0 :  (clp_width  - cutwidth)
    b           = ( Leftstr( loc, 1 )  == "T" ) ? 0 : (cutheight == 0 ) ?  m4( (clp_height / chunk )  * multi ) : (cutheight == -1 ) ? 0 :  (clp_height - cutheight)
    c           = ( Rightstr( loc, 1 ) == "R" ) ? 0 : (cutwidth  == 0)  ? -m4( (clp_width  / chunk )  * multi ) : (cutwidth  == -1 ) ? 0 : -(clp_width  - cutwidth)
    d           = ( Leftstr( loc, 1 )  == "B" ) ? 0 : (cutheight == 0 ) ? -m4( (clp_height / chunk )  * multi ) : (cutheight == -1 ) ? 0 : -(clp_height - cutheight)
    cropped     = clp.crop(a,b,c,d)

    # Anaylse the entire clip or a percentage for speed.
    snipSize    = round( framecount( cropped ) / (framecount( cropped ) * (percent / 100.0) ))
    analyse     = ( percent != 100 ) ? cropped.SelectRangeEvery( snipSize, 1 ) : cropped

    # Read in our logo mask, prepare it and crop out the corner of interest
    logo_mask   = imagesource(logomask,start=0,end=1)
    logo_mask   = logo_mask.crop(a,b,c,d)
    logo_mask   = logo_mask.ConvertToYV12(Matrix="PC.601")
    logo_mask   = logo_mask.DistanceFunction(255/deblendfalloff,PixelAspect=par).Greyscale

    # Clean the analyse clip to improve results
    analyse = (IsYV12(analyse)) ? analyse : analyse.ConvertToYV12
    analyse = analyse.TTempSmoothF(maxr=2,lthresh=256,cthresh=256,scthresh=255).converttoRGB24()
    input   = ( RGB24 == true ) ? cropped : cropped.converttoRGB24()

    # seperate out the directory and logo names so we can save a unique ebmp file
    sl           = logomask.revstr().findstr("\") - 1
    Assert((sl   >= 0),"specify a fully qualified directory and logomask name to use")
    logo_name    = (sl < 0  ) ? "" : rightstr(logomask,sl) # name and extension
    s2           = logo_name.findstr(".") - 1 # find the length of the extension
    logo_name    = leftstr(logo_name,s2) # just the name !
    Analyse_Name = logo_name + loc + string(percent) + "AnalyzeResult%06d.ebmp"

    # Time to run the analysis on the logo, we want the color map and alpha map out of the file.
    try {
      # Analyze is a bit slow so we only do it once and store the result in a file, check if it exists or if it has changed
      ImageSource(Analyse_Name,0,0)
      (Interleave( AssumeFPS(input.FrameRate), input.Trim(0,-2).AnalyzeLogo(logo_mask) ).FrameCount > 3) ? last : last
    }
    catch( dummy ) {
      # Nice catch, we are here since we need to perform our logo analysis as none already exists
      analyse.AnalyzeLogo(logo_mask)

      # The analysis is complete, save a frame (all frames are the same)
      Trim( 0, -1 )
      ImageWriter( logo_name + loc + string(percent) + "AnalyzeResult", 0, 1, "ebmp" )
    }

    # The color map is the top half of the Analyze result, The alpha channel is in the bottom half
    AssumeFPS(analyse.FrameRate)
    LogoColor = Crop(0,0,0,last.Height/2)
    LogoAlpha = Crop(0,last.Height/2,0,0).ConvertToYV12(Matrix="PC.601")

    # Create a Deblend mask, this is a mask that falls off the marked logo area, we use this to blend the delogoed area back into the clip
    DeblendMask = logo_mask.DistanceFunction( 255.0 / DeblendFalloff, PixelAspect=par )

    # Create a repair mask for pixels that cannot be deblended
    LogoAlpha.Invert.mt_lut(expr="x " + " " + string(alphatorepair) + " " + "< 255 0 ?").mt_expand.mt_inflate(chroma="-128") # ssS, added (chroma="-128")
    RepairMask = ( RepairRadius > 0.1 ) ? DistanceFunction( 84.0 / RepairRadius, PixelAspect=par ) : last

    # InpaintLogo and DeblendLogo based on user preferance
    deblend    = ( mode == "both" ) ? input.DeblendLogo(LogoColor,LogoAlpha) \
               : ( mode == "deblend" ) ? input.DeblendLogo(logoColor,logoAlpha) : input

    repaired   = ( mode == "both" ) ? deblend.InpaintLogo(RepairMask, Radius=InpaintRadius, Sharpness=InpaintSharpness, \
                                      PreBlur=InpaintPreBlur, PostBlur=InpaintPostBlur, PixelAspect=par) \
               : ( mode == "inpaint" ) ? deblend.InpaintLogo(RepairMask,Radius=InpaintRadius, Sharpness=InpaintSharpness, PreBlur=InpaintPreBlur,\
                                         PostBlur=InpaintPostBlur, PixelAspect=par) : deblend

    #repaired = ExInpaint (repaired.converttorgb32, repairmask.converttorgb32, color=$ffffff,xsize=5, ysize=3, radius=36)

    output = Layer(input.ConvertToRGB32, repaired.ConvertToRGB32.Mask(DeblendMask.ConvertToRGB32(Matrix="PC.601")))
    output = output.converttoyv12

    # post processing of the results if requested
    postmask = LogoAlpha.Invert.mt_lut(expr="x " + " " + string(alphatorepair) + " " + "< 255 0 ?").mt_expand.mt_inflate(chroma="-128") # ssS, added (chroma="-128")
    postmask = postmask.DistanceFunction( 64.0 / RepairRadius, PixelAspect=par )

    #postmask = (pp > 0 && lmask) ? repairmask.DistanceFunction( 512.0 / DeblendFalloff, PixelAspect=par ) : blankclip(output,color=$000000)
    post = ( PP == 1 ) ? output.minblur(1,uv=3).medianblur(3,0,0).removegrain(11)  \
         : ( pp == 2 ) ? output.fft3dfilter(sigma=16,sigma2=12,sigma3=8,sigma4=4,bt=3,bw=16,bh=16,ow=8,oh=8,plane=4) \
         : ( pp == 3 ) ? output.mt_convolution("1 8 28 56 76 56 28 8 1","1 8 28 56 76 56 28 8 1",y=3,v=2,u=2) \
         : output
    output = ( pp > 0 ) ? mt_merge(output,post,postmask) : output

    aa = debug ? stackhorizontal(logo_mask.ConvertToYV12.subtitle("logo mask"),logocolor.ConvertToYV12.subtitle("Logo Color"),logoalpha.ConvertToYV12.subtitle("Logo Alpha")) : nop
    bb = debug ? stackhorizontal(deblendmask.ConvertToYV12.subtitle("Deblend Mask"),repairmask.ConvertToYV12.subtitle("Repair Mask"),postmask.ConvertToYV12.subtitle("Post Mask")) : nop
    cc = debug ? stackhorizontal(cropped.ConvertToYV12.subtitle("Original"),repaired.ConvertToYV12.subtitle("Repaired"),output.ConvertToYV12.subtitle("Post")) : nop

    # Almost done, lets blend in our repair
    output = (RGB == true) ? (RGB24 == true) ? output : output.converttoRGB32() : output.converttoYV12()
    final   = clp.overlay(output,a, b)

    RETURN debug ? stackvertical(aa,bb,cc) : final
}

FUNCTION MinBlur(clip input, int r, int "uv") {
    # Nifty Gauss/Median combination
    # Taken from MCBob.avs:
    uv   = default(uv,3)

    # process chroma if uv==3, otherwise just luma
    uv2  = (uv==2) ? 1  : uv
    rg4  = (uv==3) ? 4  : -1
    rg11 = (uv==3) ? 11 : -1
    rg20 = (uv==3) ? 20 : -1
    medf = (uv==3) ? 1  : -200

    # make our blur clips, r controls amount
    RG11D = (r==1) ? mt_makediff(input,input.removegrain(11, rg11),U=uv2,V=uv2)
    \    : (r==2) ? mt_makediff(input,input.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
    \    :          mt_makediff(input,input.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
    RG4D  = (r==1) ? mt_makediff(input,input.removegrain(4,rg4),U=uv2,V=uv2)
    \    : (r==2) ? mt_makediff(input,input.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
    \    :          mt_makediff(input,input.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
    DD    = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
    RETURN (input.mt_makediff(DD,U=uv,V=uv))
}

FUNCTION m4(float x) {RETURN( x<16?16:int(round(x/4.0)*4)) }
2 Mods Marked in Blue.

EDIT: If you spot any more green frames in Debug, shout out and give args and I'll take another look, there are other calls to MT_
that do not have chroma setting set.
__________________
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; 2nd January 2017 at 20:14.
StainlessS is offline   Reply With Quote
Old 2nd January 2017, 21:19   #162  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 257
After all I've done so far, I'm feeling very discouraged. The results are terrible. Here's an 8-sec sample of my encoded output:
http://www.tomsgoodfiles.com/2016-12...BAD-RESULT.avi

If you download and play it (I use VLC), the removal is worse (more distracting) than seeing the original logo-and-text.

My initial suspicion is that it's the inpainting. (AlphaToRepair, after testing various values, was the default of 130.) While it got rid of the stray colors, it apparently stole too much from other areas.

I ran through my 9000 frame sample using RmLogo's debug rather thoroughly, I thought. I guess one really has to look at a whole-frame view and fully rendered and watch it at live speed. Maybe deblend-only, while it would leave very visible artifacts, would be much less distracting that the monstrosity I just shared.

On the upside, maybe I just invented a new special effect.

Could you all (whoever is inclined) download my 8-sec sample, view it (at normal speed, which will be 60fps), and give your thoughts about what should be done differently?
TCmullet is offline   Reply With Quote
Old 2nd January 2017, 21:44   #163  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 257
Quote:
Originally Posted by StainlessS View Post
2 Mods Marked in Blue.
So are you saying that the 2 bugs (which you've corrected) are a problem ONLY on the debug image output and not the regular image output?
TCmullet is offline   Reply With Quote
Old 2nd January 2017, 21:53   #164  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
Hopefully, Yes.

EDIT: Calling/not calling DeblendLogo(), altered what would end up in unprocessed chroma channels.
__________________
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; 2nd January 2017 at 23:00.
StainlessS is offline   Reply With Quote
Old 3rd January 2017, 00:50   #165  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 257
Quote:
Originally Posted by hello_hello View Post
You might want to try the AVS Cutter for adding Trims to scripts. There's a standalone version or a version built into MeGUI that lets you set multiple trims using a preview. It might save a bit of tedious copying and pasting of frame numbers, even if navigating is a bit slower.
Thanks for the idea. But I spent 45 min. trying to get AVSCutter to do anything. There are so many bugs and flaws in that program, I don't know how anyone uses it.

Then I found AVSFilmCutter. It looks promising, but also wasted 45 min. (or more) learning/experimenting. Got a couple of scenes specified, but could not save it. This program is very user unfriendly. He avoids menus and buttons, relying on me to right-click all the time. It's like you have to memorize half the manual before getting started. One should be able to look around on any one screen and find buttons or menu choices to go forward. His seemingly wellwritten manual is woefully inadequate at the lowest level. Of course being unchanged for 10 years may have something to do with it. I don't know why Videohelp has stuff like this out there when it's so broken. For now, I'm glad I can use control keys in Vdub and Notepad very quickly. But I'd still be open to trying something that would speed my gathering of frame ranges.
TCmullet is offline   Reply With Quote
Old 3rd January 2017, 02:22   #166  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
You could perhaps give this a try.
Get VDubMod or VirtualDubFilterMod (suggested, some versions of VDubMod are broken for this method).
Load AVS (will not work with AVI), Mark ranges and delete them in VDMod.
HOME key marks start of range to delete, END key marks Last Frame to delete + 1, ie is exclusive [mark the frame after the last one to delete].
Then press DELETE key to delete the range.
When all ranges deleted, open up the script editor [tools menu], and press CTRL/I to insert the remaining ranges after all deletions.
You can press CTRL/S to save the script.
May end up with something like below.

Code:
Avisource("D:\V\XMen2.avi")
__END__  # End script above this line, all below is ignored by Avisynth. Move cursor below here before pressing CTRL/I.

Trim(0,9999) ++ Trim(10100,10249) ++ Trim(11200,192448)
Then do a simple search and replace Trim -> myRmLogo,
and either delete the '++' stuff or if you have some text editor that can replace '++' with a NewLine that would be better. (failing that replace "++" with "" and insert newlines yourself or dont bother, should not affect script.

EDIT: If all logos are exactly the same you could just leave the " ++ Trim()"'s, and put an myRmLogo() at the end and comment out the __END__ thing,
but somewhere in docs for either rm_logo or InPaintFunc, it says that long clips will produce less effective delogo-ing.
EDIT: Cant comment further, no idea what your myRmLogo() does.
EDIT: Could instead replace "++ Trim" -> "myRmLogo".
EDIT: Seems PSPad allows to Find/Replace Escape sequences and control codes, who Knew.
__________________
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; 3rd January 2017 at 04:52.
StainlessS is offline   Reply With Quote
Old 3rd January 2017, 05:06   #167  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 257
I gave the code for function myRmLogo in post #151. (It's really pretty simple. And the logic to allow for start and end frames = 0 was supplied by one of you guys who improved a function of mine, which is the one I cloned from to derive myRmLogo.)

Cool idea to use the script from a Virtualdub version and massage to make series of trims. It looks like this is a form of the .vdscript that can be saved from vanilla Virtualdub:

VirtualDub.subset.AddRange(41,4511);
VirtualDub.subset.AddRange(5908,238442);

But according to you, a mod version composes it much closer to our target syntax. Will look into those mod versions. (I've heard of them for years, but never needed to both getting any.)
TCmullet is offline   Reply With Quote
Old 3rd January 2017, 05:28   #168  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
OK, you can just just forget Find/Replace, and add your single call to RM_Logo after the CTRL/I inserted trims, (commenting out the __END__).
Easy Peasy

EDIT: VirtualDubFilterMod here:- http://forum.doom9.org/showthread.php?t=172021
and description of Script editor here:- http://forum.doom9.org/showthread.ph...15#post1772115
__________________
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; 3rd January 2017 at 05:32.
StainlessS is offline   Reply With Quote
Old 3rd January 2017, 05:56   #169  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
I thought the standalone AVS Cutter was pretty much the same as the one built into MeGUI, but I tried it and obviously it's not. The standalone version seems to be capable of a lot more but I haven't played with it enough yet.

MeGUI's AVS Cutter is designed to enable you to effectively edit as you encode. You can specify start and end points with or without transitions and that's about it. On the plus side, it's very easy to use. I often use it to set multiple trims and then add the required filtering later. It's not much different to specifying edit points in VirtualDub, except the preview's better.



After adding the cuts specified in the above screenshot to a script, you'd have the following. I added the de-logoing manually in blue.

__film = last
__t0 = __film.trim(0, 2364)
__t1 = __film.trim(2365, 4174).rm_logo()
__t2 = __film.trim(4175, 7056)
__t3 = __film.trim(7057, 9531).rm_logo()
__t4 = __film.trim(9532, 12966)
__t5 = __film.trim(12967, 15220)
__t0 ++ __t1 ++ __t2 ++ __t3 ++ __t4 ++ __t5

Because it's purpose is to allow you to edit, the AVS Cutter can also save a "cuts file". The cuts file can be loaded into MeGUI's audio section and the audio will be re-encoded to match the video, or there's an audio cutter under the Tools menu for splitting and appending the audio to match without re-encoding it. If you're not adding the cuts to edit as such, you don't need to worry about any of that. There's no "RGB Only" limitation.

MeGUI's AVS Cutter could really use a text box for adding things to each cut. ie each line would show the start frame, the end frame and a text area for adding filtering to that particular section. That way you could add the filtering as you go rather than have to go back and do it later. I can't remember if I've ever added that to the feature request list. I'll check and do so later if I haven't.

There's also AvsPMod. Some people swear by it although I find the preview slows down too much when using a lot of filtering, so with multiple trims with different filtering it gets frustrating.

Unless the logo changes, for long clips I just add the logo removal as required via trims (ie between ad breaks) and the analysis just runs using the first trim with logo removal specified. At the end of the trim the ebmp file is written and any de-logoing to follow would use the same ebmp image. If you analyse 100% of the first section and it's a reasonable length, that's generally enough, but you could create a copy of the bitmap with a different name for each section requiring logo removal so each section is analysed individually.... if you're keen.

Last edited by hello_hello; 4th January 2017 at 09:21.
hello_hello is offline   Reply With Quote
Old 3rd January 2017, 06:30   #170  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
Quote:
Originally Posted by TCmullet View Post
After all I've done so far, I'm feeling very discouraged. The results are terrible. Here's an 8-sec sample of my encoded output:
http://www.tomsgoodfiles.com/2016-12...BAD-RESULT.avi

If you download and play it (I use VLC), the removal is worse (more distracting) than seeing the original logo-and-text.
What you're seeing is perfectly normal but usually the background behind the logo isn't constantly "busy" as it is with your clip, so the delogoed area doesn't wobble relentlessly like that. Plus it's probably a larger area than the average logo. You might have to make more of a compromise between deblending and inpainting to cut down on the wobble, even if it leaves more of the logo behind. Now and then I settle for deblending even if it's only half removing the logo because it's less annoying.

I tried InPaintFunc briefly on your sample but the result wasn't any better.
hello_hello is offline   Reply With Quote
Old 3rd January 2017, 06:34   #171  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
StainlessS,

Thanks for the updates to the InPaintFunc and RMLogo scripts. I'm probably just being lazy but whenever I see the word "function" in a script my eyes start to glaze over, so I probably wouldn't/couldn't have worked out how to update InPaintFunc myself. I wonder why it wasn't created to only process the logo section of the frame the first place.
I'll play with RMLogo a little later too and report back regarding the green-ness of frames in debug mode.

Thanks again!

Last edited by hello_hello; 3rd January 2017 at 06:43.
hello_hello is offline   Reply With Quote
Old 3rd January 2017, 15:43   #172  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
Quote:
I wonder why it wasn't created to only process the logo section of the frame the first place.
Its probably a teeny bit slower due to Overlay.
I have done a bit more, but may never be posted. Modified to accept +ve width and Height in loc as well as -ve (width,height relative).
Support for v2.6 colorspaces but still delogo's in RGB, Layer supports only YUY2, RGB32, SpatialSoften YUY2 only, GeneralConvolution RGB32 only, sigh.
Implemented via StackHorizontal/Vertical rather than OverLay/Layer, no increase in speed.
I guess Reuf Toc did the best that he could, given what colorspace compatible filters are available (even now).

Is there any eg Yv12 (or ideally YV24) compatible filter arrangement for GeneralConvolution, any idea ? (image processing is not my strong point).

EDIT: For mainly this
Code:
function dirtyblur(clip clp, int "mode") {
    mode = default (mode, 1)

    o    = (mode == 1) ? clp.blur(1.58).GeneralConvolution (matrix="40 75 40 75 100 75 40 75 40").blur(1.58).blur(1.58).blur(1.58) :
    \                    clp.converttoYUY2.temporalsoften(1,64,64,mode=2,scenechange=6).spatialsoften(2,255,255).converttoRGB32

    return o
}
__________________
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; 3rd January 2017 at 15:53.
StainlessS is offline   Reply With Quote
Old 3rd January 2017, 22:10   #173  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
Quote:
Originally Posted by StainlessS View Post
Is there any eg Yv12 (or ideally YV24) compatible filter arrangement for GeneralConvolution, any idea ? (image processing is not my strong point).
I have no idea. Sorry.

I played with your updated InPainFunc and RM_Logo scripts a little. I didn't notice any problems with either and you seem to have cured the RM_Logo green frame problem in debug mode.

Thanks for that.
hello_hello is offline   Reply With Quote
Old 3rd January 2017, 23:56   #174  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
Thanx, HH, for your consideration, we do try, perhaps not hard enough.
__________________
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; 4th January 2017 at 13:53.
StainlessS is offline   Reply With Quote
Old 4th January 2017, 09:18   #175  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
Quote:
Originally Posted by TCmullet View Post
Thanks for the idea. But I spent 45 min. trying to get AVSCutter to do anything. There are so many bugs and flaws in that program, I don't know how anyone uses it.
I submitted a feature request to make MeGUI's AVS Cutter more useful for applying filtering today. Zathor mightn't be interested in implementing it, and these days I don't think he has a lot of spare time anyway, but you never know if you don't ask.
https://sourceforge.net/p/megui/feature-requests/607/

I came across AVSEdit Plus today. I must have missed the thread originally, so I thought I'd give it a try. There's some nice ideas there, but for me being able to add different filtering to sections of a script with a preview would be my primary motivation for using an Avisynth GUI. I don't think any of them make it as easy as it could/should be, including AVSEdit Plus. Unless I missed something....
hello_hello is offline   Reply With Quote
Old 12th January 2017, 13:26   #176  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,502
Quote:
I don't think any of them make it as easy as it could/should be, including AVSEdit Plus. Unless I missed something....
HH, have you actually tried VirtualdubFilterMod, it is really very good and I myself use almost nothing else (apart from PSPad for more general
script editing and things like replacing TABS with SPACES and stuff like that). Give it a go if you have not already.

VirtualdubFilterMod:- https://forum.doom9.org/showthread.php?t=172021

EDIT: Available Keyboard functions in brief:- https://forum.doom9.org/showthread.p...15#post1772115
__________________
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; 12th January 2017 at 13:29.
StainlessS is offline   Reply With Quote
Old 13th January 2017, 23:22   #177  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 257
Back to RM_Logo... A situation has come up which I haven't seen any reference to. I have an interlaced video. The earlier ones of mine were not. I remember with Delogo (in VirtualDub), there is an "interlaced" switch. Furthermore, somewhere it was said that you should do Delogo Vdub filter BEFORE any other processing, which I assume would include any kind of deinterlacing, IVTC, etc.

I find no reference to interlaced video in these rm_logo discussions. But it occurred to me that it is very likely that NO inpainting should be done on interlaced source (mode="both"). I don't know much about inpainting, but knowing simply that it pulls pixels from nearby makes me think it would wreak havoc on an interlaced frame where there is much motion between the fields. Am I on the right track??

I was going to use "deblend" only, but just a little bit of inpainting (Alphatorepair around 100) cleans it up better. Yet I worry that footage where interlacing shows might get really messed up.
TCmullet is offline   Reply With Quote
Old 14th January 2017, 07:56   #178  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
I'm not sure I've de-logoed interlaced video before, but I had a look at the RMLogo and InPaintFunc scripts, and neither of them have any options regarding interlaced video I could see, so I imagine you'd need to de-interlace first.

The VirtualDub plugin handles interlaced video by splitting the frames into fields, de-logoing them separately, then it puts them back together again. For someone who isn't me and knows what they're doing, it'd no doubt be possible to add the same ability to the RMLogo script.

I've ITV'd before removing logos on ocassion. My main motivation there would have been to reduce the number of frames requiring logo removal to speed it up. I'm not sure there's a reason why that's a bad idea. Many times for progressive video if I'm downscaling I've done so before the logo removal. Technically it mightn't be ideal, but it doesn't seem to make much difference. If you're double frame rate de-interlacing I guess that means you'd have twice the number of frames to de-logo if you de interlace first. Bummer.....

Actually, thinking about it, I wonder if converting the video to RGB first with ConvertToRGB(interlaced=true), running the logo removal on it as though it's progressive, then converting it back to YUV with ConvertToYV12(interlaced=true) would be sufficient. I'm not sure why that wouldn't be okay. If so, it'd just be a matter of adding an option to the script for specifying if the source is interlaced so the conversion to RGB and back is done correctly. Someone more clever than me might be able to offer a more informed opinion on that one.

Last edited by hello_hello; 14th January 2017 at 08:05.
hello_hello is offline   Reply With Quote
Old 14th January 2017, 08:02   #179  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,558
Quote:
Originally Posted by StainlessS View Post
HH, have you actually tried VirtualdubFilterMod, it is really very good and I myself use almost nothing else (apart from PSPad for more general
script editing and things like replacing TABS with SPACES and stuff like that). Give it a go if you have not already.
I hadn't tried it before, but I just had a quick play and it certainly seems to have the potential to make life easier. I'll make an effort to get to know it better in the near future.

Cheers.
hello_hello is offline   Reply With Quote
Old 14th January 2018, 07:43   #180  |  Link
pcroland
Registered User
 
Join Date: Mar 2014
Location: Hungary
Posts: 49
Hi!

I tried some delogo scripts (DeLogo, rm_logo, X-Logo) but none of them worked.

I'm trying to get StainlessS's rm_logo (0.6) to work now.

This is the error that I get:
https://vgy.me/wt4aW5.png

If I don't load the AviSynth_C.dll this is what I get:
https://vgy.me/LvRVM3.png

What should I do? Is there an up to date plugin that actually works and doesn't need tons of other plugins?
pcroland is offline   Reply With Quote
Reply

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 22:31.


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