View Full Version : Remove Logos Again
Spuds
17th February 2008, 04:03
After I made changes to the delogo script I promised myself I would not work on any other delogo functions BUT the avsinpaint (http://forum.doom9.org/showthread.php?p=1101283#post1101283)function just called me back. :devil:
In the Avsinpaint thread Reuf Toc made a very nice script (wish I could code that nice !) but I wanted to add my own twists that I learned from modding the delogo script and experimenting with avsinpaint. So I did some combining and adding and the result is rm_logo.
Basic usage is as follows:
1) Get a clip with a logo that you want removed.
2) Save a frame from that clip and edit it in your favorite graphics program, paint the logo pure white and everything else black. Save it as a logo.bmp (any name you want)
3) Make a avs script such as:
LOADCPLUGIN("AVSINPAINT.DLL")
Import("rm_logo.avs")
avisource("videowithlogo.avi")
rm_logo(last,logomask=logo.bmp",loc="br",par=4.0/3.0,mode="both",percent=20,pp=1)
Basic things you must supply.
logomask -- the name of the black and white bmp you created
loc -- TR, TL, BR, BL this is the location of the logo on the video, top right, top left, bottom right, bottom left. There is also a tweak you can supply here called cutsize set it to small medium or large. It refines the size of the corner cut somewhat. If you have to much video and not enough logo in a cut you can get less optimal results, you want the logo to fill the cut (within reason).
par -- pixel aspect, no harm if you don't specify it, it just helps grow masks correctly in all directions.
mode -- how to remove the logo, deblend (for purely transparent logos. inpaint for purely solid logos and both for logos with both.
percent -- The percent of total frames to use in computing the masks, the more the better and the slower.
pp -- Post Process, 1,2 or 3. Apply some additional post processing of the removed area to further hide the logo and artifacts.
The first time the script runs expect it to take a little time, it has to compute the color and alpha masks so it will appear to lock up on you for a min or two while its doing this. Once done it will save a analysis bmp file so it will be responsive from then on.
There are other things to tweak, look in the script for more information.
Script in the next post.
Spuds
17th February 2008, 04:04
# rm_logo() Version 0.5 -- 23.04.08
#
# 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
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
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)) }
Adub
17th February 2008, 05:08
*cracks fingers*
Looks like I now have two logo removal functions to add to the wiki.
Will post a link when done.
Note: Typo on line 18. Should say "MedianBlur", not "MediumBlur".
Oh, and finished with the wiki page. Have a look:
http://avisynth.org/mediawiki/Rm_logo
Feel free to upload any new versions there, where they will always be accessible. (Plus, easier to search for.)
K0zi
18th February 2008, 19:45
I've created logomask, but there's something wrong with cropping:
Crop: YUV images can only be cropped by even numbers (left side).
(...\rm_logo.avs, line 63)
Reuf Toc
19th February 2008, 02:08
Change lines
a = ( Rightstr( loc, 1 ) == "L" ) ? 0 : round( ( clp_width / 3 ) * multi )
b = ( leftstr( loc, 1 ) == "T" ) ? 0 : round( ( clp_height / 3 ) * multi )
c = ( Rightstr( loc, 1 ) == "R" ) ? 0 : -round( ( clp_width / 3 ) * multi )
d = ( leftstr( loc, 1 ) == "B" ) ? 0 : -round( ( clp_height / 3 ) * multi )
to
a = ( Rightstr( loc, 1 ) == "L" ) ? 0 : round( ( clp_width / 6 ) * multi )*2
b = ( leftstr( loc, 1 ) == "T" ) ? 0 : round( ( clp_height / 6 ) * multi )*2
c = ( Rightstr( loc, 1 ) == "R" ) ? 0 : -round( ( clp_width / 6 ) * multi )*2
d = ( leftstr( loc, 1 ) == "B" ) ? 0 : -round( ( clp_height / 6 ) * multi )*2
should solve your problem
Spuds
20th February 2008, 03:25
@K0zi -- I updated the script in post #2 (as well as the wiki) it should take of the issue. If it does not what Reuf Toc posted will work very well.
The changes in this version are fixing the above error, adding some basic input checking and validating the color space is valid for certain functions.
Ranguvar
21st February 2008, 02:51
Woot! Thanks man. I gave up on removing a logo from some HD NASA footage I capped a while back, now I can do it. The only semi-easy solution I could find before was through VFW (ick).
R3Z
21st February 2008, 04:38
Can you pretty please provide an example (picture) of this filter in action ?
Cheers,
R3
Adub
21st February 2008, 04:53
I will provide an image sample of the filter in progress this weekend if I have time. I was planning on doing it anyways, as I to am curious of how it will work.
K0zi
21st February 2008, 18:33
Version 0.1 with corrected cropping works. Version 0.2 doesn't work:
ConvertToYV12: invalid "matrix" parameter (RGB data only)
(...\rm_logo_v2.avs, line 104)
Example, v0.1 on default settings, logomask was made in hurry, just to see if it works:
source vs. rm_logo:
http://img88.imageshack.us/img88/1052/rmlogosrckv1.th.png (http://img88.imageshack.us/my.php?image=rmlogosrckv1.png) http://img102.imageshack.us/img102/3362/rmlogocu3.th.png (http://img102.imageshack.us/my.php?image=rmlogocu3.png)
leecoq
21st February 2008, 21:41
can you post the script ?
the crop numbers etc...
Ranguvar
21st February 2008, 23:55
I just get an error saying there's no function "DistanceFunction" :p
At this line (#84): logo_mask = logo_mask.DistanceFunction(255/deblendfalloff,PixelAspect=par).Greyscale
I'm pretty sure I have all the required filters?
EDIT: Alright, sorry, fixed that. I had to load AviSynth_C.dll and then load AVSInpaint.dll externally with LoadCPlugin. Now waiting to see if it works... LOL, if it is indeed working, this puppy takes forever with 1080p footage xD
Ranguvar
22nd February 2008, 15:38
Yep, I get the invalid matrix parameter too.
Spuds
26th February 2008, 17:57
I get the invalid matrix parameter Sorry about that, I've posted a new version 0.3 that should fix that.
takes forever with 1080p footage Oh yeah, of course almost anything else does as well. The best bet to speed that up is use the percent parameter to reduce what it has to analyze on the first pass. Thinking about it some more I can add some checking on the size of the input and change the corner cut size appropriately, should help with 1080 input. I'll work on a 0.4 version :)
In the 0.3 version I added a debug=true option, it will output some screens to help see what the script is doing as well as see what the parameters are changing. Here is an example:
rm_logo(last,logomask=videos+"cbs2.bmp",loc="br",par=4.0/3.0,mode="both",percent=30,debug=true)
http://img246.imageshack.us/img246/2597/rmexampleyf8.th.png (http://img246.imageshack.us/my.php?image=rmexampleyf8.png)
Let me know if you find other problems that need to be addressed and I'll put them in the 0.4 with 1080 improvements.
K0zi
4th March 2008, 10:39
Is it possible to remove more than one logo? (screens above)
If I use this function twice in the script, I guess it'll use the same analyze-results file every time:confused:
Spuds
5th March 2008, 05:33
@K0zi
I posted a 0.4 version, this one saves the analysis.bmp file with a unique name based off the logo name, its location and percentage. This should avoid conflicts if you want to call it twice or more in a single script.
This version also has a small change to help with wide screen clips, by allowing it to cut a smaller area for the analysis.
K0zi
5th March 2008, 21:20
:thanks:
McCauley
31st March 2008, 22:01
Hi Spuds,
just wanted to say thank you for this nice script.
I haven't finished testing it, but it seems to be really effective.
Would it be possible to add MV based image restoration to the function?
It could be something like compute the vectors of the 2 previous and following frames with a radius of the clip height/10 around the logo only in the second pass. When a block moves towards the vector and "disappears" it could be layered over the logo, or be mixed with with the Inpainting. (I hope you understand what i mean). With this limited MV fetching the script shouldn't become unusably slow.
It would also really useful, if the function could do a check if the logo is present. On many sources the logo disapears periodically (due to commercial cuts or whatever). This should be doable with Masktools (?!). If no logo is present the frame will not be taken intoaccount for the first pass and won't be delogoed in the second. Keep in mind that logos reappear (and dissapear) smoothly most times, so it should be thresholded.
Another killer feature to add could be a function to remove hardcoded subs. With masking, Inpainting and MV based restoration it should be doable, but i'm no expert. To prevent the function from removing words in the movie (cast, director etc.) the processed are could be limited to the middle of the bottom, so one must specifiy how much the processed area expands from the middle of the last line in the x and y axis.
But perhaps this should be a separate function.
I really hope i can contribute a few lines of code in the future, but atm, i can only make suggestions what could be improved based on my very limited understanding of avisynth's syntax and it's PlugIns.
Looking forward to some further development. :-)
Regards
McCauley
McCauley
5th April 2008, 20:14
Hi,
it's me again :-)
General hint: It's really important that the logo is present in every analyzed frame (check before!).See below.
Should the pure white logo be very precise or should it be a few pixels bolder than the station logo(like in Didée's delogo Function)?
Keep in mind that there is always some ringing around the logo.
When processing with a clip with sharp black bars, the analyzed area has a soft transition after applying the script. I guess that is caused by the yv12/rgb/yv12 conversion ?!
I fixed that with
overlay(last,src.crop(0,0,-1116,-1050))
not very elegant but it did the trick.
cutsize -- Why not just use the center of the logo and expand the cutsize from that? If the logo is not very big, but closer to center of the frame one clould skip analysing the border areas, since they are uzeless anyway
pp -- Post Process, 1,2 or 3. Apply some additional post processing of the removed area to further hide the logo
and artifacts. What do they in particular?! with my clips changing pp didn't do anything (or almost nothing). Do they only make diffrerence with inpainting? The logos i removed where deblending only. A simple blur(~.3) sometimes does the magic.
I refined the description a bit, maybe you want to add it to your first post:
1) Get a clip with a logo that you want removed.
Prepare your clip for the analysis pass:
check if the logo is at its place from the beginning to the end, often it appears first after a few seconds or even minutes after the movie/series has started (use trim or more advanced functions for that).
Sometimes the logo disappears due to commercial cuts or whatever, to check for that insert "selectevery(300)" (values between 100 and 500 should be appriate, the lower the value, the more frames you have to check!)
at the end of your script, skipp through them to see if the logo is present in every frame. if not you have you have to trim it out manually to get optimal results for the analysis pass.
You can also exclude the credits to save time, because they won't improve the analysis pass. A black background is not very useful to get any alpha information.
2) Save a frame from that clip and edit it in your favorite graphics program, paint the logo pure white and everything else black. Save it as a logo.bmp (any name you want).
To make it easy for yourself you should choose a frame frome the credits, or where the logo has a dark background. That helps with the painting if you're not so experienced with image processing.
3) Make a avs script such as:
#rm_logo(last,logomask=logo.bmp",loc="br",par=4.0/3.0,mode="both",percent=20,pp=1)
If youre using AVSP, i advise you to check the parameters and the prepared clip (see point 1) very carefully, and then remove the # from your script, i hit the preview button more than once and my system was
stuck due to the analysis pass with suboptimal settings. BEFORE you run the analysis you MUST save the script, otherwise the analysis detects a "change" in the script's name and will run again, when loading it into VDub or any other GUI.
After the analysis pass is finished you can remove the trim command(s) and optimize your script with deblocking, denoising, resizing, sharpening or whatever you want to apply, put the filters after the rm_logo call, since this is now your source.
percent -- The percent of total frames to use in computing the masks, the more the better and the slower.
Values above 50% shoulnd't be useful in any case, except maybe with very, very short clips.
The first time the script runs expect it to take a little time, it has to compute the color and alpha masks so it will appear to lock up on you while its doing this.
Depending on the size of your clip and the percentage of anaylysis you set, i can take some time. Up to 2 hours or more for 1080p footage on a C2D!
Regards
McCauley
Spuds
6th April 2008, 02:37
@McCauley
Thanks for all the suggestions on improvements, there are some very good ideas that I'll tinker around with to see what improvements we can get and if there is a way to implement them so they work correctly (ie logo present or not).
When processing with a clip with sharp black bars Do you have an example clip that you can upload somewhere so I can take a look at this, sounds like something is wrong with one of the conversions, probably a color range thing.
Post Process ... What do they in particular? You will notice improvements mostly for logos that you had to inpaint since that will remove the logo but leave a less 'damaged' area behind. These functions just try to blend the delogoed zone back into the frame so its more difficult to find.
Thanks for all the documentation updates, I'll update the readme and wiki with the improvements, I think you listed most of the gotchas with the delogoing process, fun huh :)
Should the pure white logo be very precise or should it be a few pixels bolder than the station logo You can be a little over the edges and it wil not hurt anything, so be close but no need to be exact. The function grows the mask internally to help blend it anyway.
Again thanks for the help and suggestions!
cobo
6th April 2008, 23:39
Avisynth gives me the message: "Analyze: Mask is empty" and cites lines 104 and 109 Of rm_logo.avs. I can't figure out what the problem is.
Spuds
7th April 2008, 20:24
I would check one of the following in order ....
1) It could not find the mask file (wrong path or filename in the function call)
2) The mask was not defined with a pure white color
3) The cut was done in the wrong area of the frame so the logo and therefore the mask were blank
Comatose
10th April 2008, 19:33
Can somebody post a mask and a logo for reference please?
Spuds
11th April 2008, 04:42
Take a close look at post #14 ... in particular the original in the lower left and the mask in the upper left. These are post "cliping" but should help you understand what is required.
If I can find the original clips from that post I'll put a link to them up as well.
manono
5th May 2008, 19:13
Hi-
I'm having a problem that maybe someone can help with. Is there a max size for a logo? I'm having unremoved pieces remaining with this project. Here's the script:
Crop(2,6,-12,-14)
LanczosResize(512,384)
rm_logo(logomask="LogoSmall.bmp",loc="BL",par=1.0/1.0,mode="Inpaint",percent=50,pp=2,Cutsize="Large")
And a series of pics.
Before: http://img141.imageshack.us/img141/7373/beforeml2.th.png (http://img141.imageshack.us/my.php?image=beforeml2.png)
After: http://img141.imageshack.us/img141/7987/afterbe1.th.png (http://img141.imageshack.us/my.php?image=afterbe1.png)
Debug: http://img141.imageshack.us/img141/6237/debugzf2.th.png (http://img141.imageshack.us/my.php?image=debugzf2.png)
The Mask: http://img147.imageshack.us/img147/6609/logosmallwq7.th.png (http://img147.imageshack.us/my.php?image=logosmallwq7.png)
I'm making the Mask.bmp (called here LogoSmall.bmp) on the cropped and resized video. Is there any way to extend the delogoed area to the right, or specify the area to be delogoed? Except for this problem, it does a pretty decent job on solid logos (in this case a song title I'd like to remove).
thetoof
5th May 2008, 19:45
Maybe you could split the logo in 2 and make 2 calls with different .bmp
Reuf Toc
5th May 2008, 20:46
You can also try InpaintFunc and enter your own parameters for "loc" to isolate the logo :
http://avisynth.org/mediawiki/InpaintFunc
Another solution is to hack spud's function to allow this feature (shouldn't be to difficult since InpaintFunc and RM_Logo are almost identical)
manono
5th May 2008, 21:25
Thanks for the responses.
thetoof, I saw yours first and it seems reasonable. Split the video in 2 at a strategic place, run 2 instances of RM_Logo and then reassemble the pieces. Then I decided I shouldn't have to do that. This thing is slow enough as it is, for the Inpaint part of it. There should be an easy way to modify the function to handle a wider logo than normal. But I didn't much want to go messing around with it myself, and still hope Spuds will come along and show me how.
Thanks, Reuf Toc. I'll try out the competition which, as you say, seems to allow locating the logo to be removed very precisely.
Wildly guessing, but it seems to be a bug in the function. Note that the actually processing ends at the very same location where the frame is cut-off for the 'debug' output.
Also, since only a part of the frame is processed and merged-in later on (that's why a "location" has to be specified), I'd expect that the dimensions of the logomask should be evaluated & used somewhere - but there's no evidence of that to be found in the script.
@manono
The way the function was written was that it made predefined cutsizes for the logo based on the position and size attributes. Its a rather dumb approach but generally sufficient for most logos. In your case the logo was wider then any of the presets so it was truncated.
I updated the function to rev 0.5 and posted it on the wiki. It has two new parameters, cutwidth and cutheight. You can set them to -1 (cutwidth=-1) for a full width cut, good for ticker tapes etc, or to a specific width (cutwidth=325) to increase or decrease the built in cut sizes. You can use debug=true and a short clip to fine tune what the values should be.
@Didée ... the function just uses a full frame sized logomask and cuts the mask and video to size based on the input (ie corner of interest). Today the mask and video must be the same size. I could do a cut size based of a mask size (if the mask was not equal to the frame size), that would be slick.
manono
7th May 2008, 06:35
Thanks, Spuds. It seems to work now:
http://img166.imageshack.us/img166/4149/afterfixedly7.th.png (http://img166.imageshack.us/my.php?image=afterfixedly7.png)
rm_logo(logomask="E:\2 Songs\Chap33\LogoSmall.bmp",loc="BL",par=1.0/1.0,mode="Inpaint",percent=50,pp=2,Cutsize="Large",cutwidth=348,CutHeight=280)
The new version also seems to require the full pathname for the BMP, rather than just the name of the BMP, as before.
sidewinder711
30th June 2008, 00:25
I do have an opaque video divided into 2 parts. On the top is a colored ball (green-blue) and below are some letters in white. Using the "inpaint"-mod, I'm nicely able to get rid of the letters.
Regarding the ball there is a problem that some part of the colors are left over (of course, inside the area of the ball, but changing its shape throughout the movie).
My code:
rm_logo(logomask="e:\test\AVSInpaint\america-maske3.png",loc="BR",par=1.0/1.0,mode="Inpaint",percent=50,pp=2,debug=true)
I tried pp from 1-3 but the results are the same. Are there any other possibilities to get rid of it ?
McCauley
31st July 2008, 22:27
Hi Spuds,
i wanted to ask if you implement some sort of deringing into your script?
I dealt with two logos the last time and both of them were alpha only.
The problem with these logos is that the always cause ringing around their edges which doesn't seem to be treated at at all by your function (pp=0,1 or doesn't change anything)
I "fixed" it with:
overlay(last,last.Crop(1486, 84, -124, -958).blur(0.30).fft3dgpu(sigma=1.7,bt=4).AddGrain(4,hcorr=0.3,vcorr=0.3),x=1486,y=84)
not very elegant, nor really pretty, but it looks better than before...
Do you have any idea how to improve the output?
Regards
McCauley
PS: Have you found the issue with the black border in the clip i sent you?
wolli0501
6th October 2008, 12:27
Hi all,
my Problem is then i start the following script with VDM .VDM give no answer(see jpeg) he does´nt work.Has anyone an idea what is wrong.
Sorry for my bad English
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\FFT3dfilter.dll")
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\removegrain.dll")
LoadCPlugin("B:\Programme\AviSynth 2.5\plugins\avsinpaint.dll")
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\exinpaint.dll")
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\masktools2\mt_masktools.dll")
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\ttempsmooth.dll")
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\medianblur.dll")
LoadPlugin("B:\Programme\AviSynth 2.5\plugins\FFT3dGPU.dll")
Import("j:\gk\rm_logo.avs")
DGDecode_mpeg2source("J:\GK\Blade Trinity.d2v")
Load_Stdcall_Plugin("B:\Programme\megui\tools\yadif\yadif.dll")
Yadif(order=-1)
crop( 2, 120, -2, -120)
rm_logo(last,logomask="j:\gk\logo.bmp",loc="TR",par=4.0/3.0,mode="both",percent=20,pp=1)
#FluxSmoothST(7,7) # Medium Noise
#Spline16Resize(704,320) # Spline16 (Neutral)
manono
6th October 2008, 13:11
Hello and welcome to the forum,
How long did you wait? It can take a very long time just to get the script to open when using the Both or InPaint Modes, perhaps as long as the movie itself. And if you think it takes a long time to open, wait until you see how long it takes to encode.
To see if it is doing a good job on the logo, you might consider trimming off 500 or 1000 frames and checking the results before then applying RM_Logo to the entire movie.
Also, why are you deinterlacing a movie with Yadif?
wolli0501
6th October 2008, 13:33
Hi
I take yadif because Megui Analyse take ít.
Ok I will test a short clip thank you.
Wolli
manono
6th October 2008, 13:36
I take yadif because Megui Analyse take ít.
If you ask me (and I know you aren't), that's a bad reason to deinterlace a movie.
wolli0501
6th October 2008, 13:45
If you ask me (and I know you aren't), that's a bad reason to deinterlace a movie.
Really?
Do have a good alternative?
manono
6th October 2008, 16:34
Do have a good alternative?
My eyes. Why don't you upload a small sample of the source for us to have a look. Use the [ and ] buttons of DGIndex to isolate a small section with movement, upload it to a 3rd party hosting site such as MediaFire, and give us the link.
wolli0501
9th October 2008, 02:04
Hi all
i have a question, is it possible to create an mask like as in Dideé ´s delkogo p.e. 120,60 for the analyse? Or maybe is ist enough for the analyse then i use trim p.e Trim1,15000)
Greats
Wolli:)
sotrry for my bad english
Leinad4Mind
14th April 2010, 18:11
Hi there, i'm trying to use this function, but it gave me error on avsp:
Crop: Destination width is 0 or less.
(rm_logo.avsi, line 85)
(remove logo.avs, line 23)
here is my code:
LOADCPLUGIN("C:\Program Files\AviSynth 2.5\plugins\AVSInpaint.dll")
MPEG2Source("C:\Users\Leinad4Mind\Desktop\Anime_TS_(1440x1080_MPEG2).d2v", info=3, cpu=0, idct=6)
mt("TFM()",threads=2) #Deinterlace
#Remove all comercial frames
mt("Loop(0,5418,7215)",threads=2)
mt("Loop(0,20133,22829)",threads=2)
mt("Loop(0,44500,45846)",threads=2)
#Remove all frames without the logo for better analysis
mt("Loop(0,5387,5422)",threads=2)
mt("Loop(0,20066,20101)",threads=2)
mt("Loop(0,43947,44433)",threads=2)
mt("Loop(0,44210,44223)",threads=2)
#TEST with 100 frames only
mt("Loop(0,100,44210)",threads=2)
#Crop and Resize
mt("crop(2, 0, -4, 0)",threads=2)
lanczos4resize(1280,720)
#Remove Logo
rm_logo(last,logomask="C:\Users\Leinad4Mind\Pictures\24BitsLogo.bmp",loc="TR", \
par=16.0/9.0,mode="both",percent=30,pp=2,Cutsize="Large")
I'm using the 24BitsLogo.bmp you can see in the attachments. And other question, can I use Test1? or Even Test2?
Best Regards!
Guest
14th April 2010, 19:12
For your crop error, do this:
#Crop and Resize
mt("crop(2, 0, -4, -0)",threads=2)
lanczos4resize(1280,720)
Notice the change in the last parameter to Crop.
Gavino
14th April 2010, 19:25
...
mt("Loop(0,100,44210)",threads=2)
#Crop and Resize
mt("crop(2, 0, -4, 0)",threads=2)
I don't know about the rm_logo problem, but it's pointless using mt with functions like loop and crop, which take virtually zero time to execute(*). You just add the overhead of using mt, with no savings from multithreading.
(*)Loop doesn't process any pixels, it just decides which frames to include. Crop just changes a pointer to the frame dimensions, without copying any pixel data.
For your crop error, do this:
mt("crop(2, 0, -4, -0)",threads=2)
No, -0 is still 0, there's no difference.
The error msg is reported coming from a Crop inside rm_logo.avsi.
Leinad4Mind
14th April 2010, 19:49
I've seen that rm_logo is basically the InpaintFunc. So I have test this, without sucess :( (It gaves me the SAME error):
LOADCPLUGIN("C:\Program Files\AviSynth 2.5\plugins\AVSInpaint.dll")
MPEG2Source("C:\Users\Leinad4Mind\Desktop\Anime_TS_(1440x1080_MPEG2).d2v", info=3, cpu=0, idct=6)
mt("TFM()",threads=2) #deinterlace
#Remove all comercial frames
Loop(0,5418,7215)
Loop(0,20133,22829)
Loop(0,44500,45846)
#Remove all frames without the logo for better analysis
Loop(0,5387,5422)
Loop(0,20066,20101)
Loop(0,43947,44433)
Loop(0,44210,44223)
#TEST with 100 frames only
Loop(0,100,44210)
#Crop and Resize
crop(2, 0, -4, -0)
lanczos4resize(1280,720)
#Remove Logo
#rm_logo(last, logomask="C:\Users\Leinad4Mind\Pictures\24BitsLogo.bmp",loc="TR", \
par=16.0/9.0,mode="both",percent=30,pp=2,Cutsize="Large")
InpaintFunc(last, mask="C:\Users\Leinad4Mind\Pictures\24BitsLogo.bmp", loc="TR", \
AR=16.0/9.0, mode="Inpaint", speed=10, ppmode=3, pp=75)
EDIT: I have tried this kind of crop, without sucesso too:
crop(2, 2, 1436, 1078)
lanczos4resize(1280,720)
Gavino
14th April 2010, 23:05
I have tried this kind of crop, without sucesso too: ...
As I said, I don't think the problem is the Crop in your script.
What line does the error message refer to (and what is on that line) now that you've changed it?
Reuf Toc
15th April 2010, 20:36
I've found the problem (it was so obvious that it took me some time).
The problem here is your logomask. It must be the same resolution than your clip (ie 1280x720)
The cropping values are calculated from your clip and then the cropping is applied on the mask. Since the cropping values are far more higher than the mask resolution, it make sense that avisynth report an error.
Keiyakusha
27th April 2010, 02:15
Hi! Here (http://imgur.com/4K8Cc.png) is the mask. The video has the same size.
I'm calling rm_logo like that: rm_logo(last,logomask="E:\1.bmp",loc="BR",mode="both",cutsize="medium",percent=100)
however not sure if i'm doing it right, so far this function never worked for me...
Input video is yv12, avisynth 2.6, all plugins (the latest versions) are present.
So with this I'm getting an error:
Avisynth open failure: GetPlaneHeightSubsampling not available on Y8 pixel type.
rm_logo.avsi line 86
Any tips?
EDIT: Oops, it seems my bmp was grayscale and it needs to be RGB. It works now!
dansrfe
24th June 2010, 01:32
I'm getting the "Crop: Destination width is 0 or less" pointing to line 269 in InpaintFunc.avs. The mask image is a 24-bit bmp with the same resolution as the input clip.
dansrfe
24th June 2010, 19:16
Anyone?
Frank K Abbott
24th June 2010, 21:00
Yeah, I used to have the same problem too. never figured it out though :(
Reuf Toc
24th June 2010, 21:36
I'm getting the "Crop: Destination width is 0 or less" pointing to line 269 in InpaintFunc.avs. The mask image is a 24-bit bmp with the same resolution as the input clip.
If you post a picture of your source, the mask and the script you are using, I could check it. Without I can't do nothing except speculate...
dansrfe
24th June 2010, 22:51
Source (after cropping) (http://img267.imageshack.us/img267/2127/source.png)
Mask (http://img690.imageshack.us/img690/5717/16292559.png)
Script:
import("F:\inpaintfunc.avs")
Load_Stdcall_Plugin("F:\avsplugins\avsinpaint.dll")
MPEG2Source("F:\dvd.d2v", cpu=0)
Crop(0,96,-0,-98)
Inpaintfunc(mode="inpaint",loc="tc",mask="C:\a.bmp",AR=360.0/143.0)
Reuf Toc
25th June 2010, 00:13
Oups, my fault, bug in the calculation of "loc" value.
New version uploaded on the wiki here (http://avisynth.org/mediawiki/upload/6/61/InpaintFunc.avs)
dansrfe
25th June 2010, 00:38
AvsP hangs up when using it. I removed the loc paramter in my script and it says it needs the loc paramter so that's the only reason why it's hanging probably.
dansrfe
25th June 2010, 06:53
anything?
Reuf Toc
25th June 2010, 15:11
The latence between the script opening and the display in avsp is normal. During this time, AVSInpaint, the plugin used in this function, compute a mask used later in inpainting process.
If you don't change speed or loc value, this mask is only computed one time. The computation of the mask can take a long long time (sometime hours) so be patient !
manono
26th June 2010, 04:07
Right, so to test what the output might look like, I trim off 500-1000 frames or so to have a look, before doing the entire thing.
dansrfe
26th June 2010, 04:20
Source (after cropping) (http://img267.imageshack.us/img267/2127/source.png)
Mask (http://img690.imageshack.us/img690/5717/16292559.png)
After Mask (http://img580.imageshack.us/img580/8618/aftermask.png)
The mask isn't completely removing the logo and it also has this dark grey look afterwards. I wonder what's going on.
Reuf Toc
26th June 2010, 12:06
You need to make your mask a little wider than your logo. I supose this is due to the compression artefacts on the edge of the logo that make inpainting going wrong...
Source (http://img267.imageshack.us/img267/2127/source.png)
Mask (http://img706.imageshack.us/img706/5717/16292559.png)
Result (http://img715.imageshack.us/img715/5292/resultt.png)
And a new version of InpaintFunc is available on the wiki, here (http://avisynth.org/mediawiki/upload/6/61/InpaintFunc.avs), I've spotted another bug in loc calculation, and the previous correction I've done wasn't safe (cropping value could be non mod2)
dansrfe
26th June 2010, 16:55
Wow. I must say this works nicely now with your new mask. But how do I fix the warping type effect in the logo area when it inpaints? What PP option should I select to sort of "stabalize" that area? Again, this is awesome :). Thanks!
Reuf Toc
28th June 2010, 16:50
Wow. I must say this works nicely now with your new mask. But how do I fix the warping type effect in the logo area when it inpaints? What PP option should I select to sort of "stabalize" that area? Again, this is awesome :). Thanks!
Warping is difficult to fix. You can't with my post-processing. But enabling it can't harm, most people use ppmode 2 and pp strength of 100.
The only way to attenuate the warping effect is to tweak the "radius", "sharpness", "preblur" and "postblur" parameters...
BTW a new version of InpaintFunc (http://avisynth.org/mediawiki/upload/6/61/InpaintFunc.avs)is online (bug in creation of .ebmp file).
pbristow
1st July 2010, 18:12
Oops! Wrong thread. Moving it now.
:confused:
BaseballFury
27th April 2011, 19:58
Hello,
I have been using the DeLogo Script a few times in the past. I did get good results, but for some reason it could not delete the "orfeins HD" logo very well.
Now I stumbled upon this thread and that removed cbs logo on page 1 gave me new hope.
So I tried the script... I really liked that everything is done in just one step, only 1 mask is needed, but unfortunately the result is pretty much the same (compared to DeLogo).
http://img709.imageshack.us/img709/9103/rmlogo.th.png (http://img709.imageshack.us/i/rmlogo.png/)
Am I doing something wrong or is this logo hard to remove?
Here is a small sample-clip of the logo:
http://netload.in/dateiX7LA9V73sk/sample.mkv.htm
(3800 Frames, 720p. Everything but the logo area is blurred, to keep the filesize small and for copyright reasons.)
mathmax
29th April 2011, 16:10
Hello
I would like to remove a logo located at the center of my video, but the loc parameter only offer "TL", "TR", "BL", "BR"... what should I do?
Moreover, I get this error "Mask is empty"... looking at the script, it seems that it's because my white part in the mask is in the middle of the picture.
Am I using the right tool in my case to remove a logo? It rm_logo the best tool available for these kind of tasks?
BaseballFury
29th April 2011, 22:30
Hello
I would like to remove a logo located at the center of my video, but the loc parameter only offer "TL", "TR", "BL", "BR"... what should I do?
Moreover, I get this error "Mask is empty"... looking at the script, it seems that it's because my white part in the mask is in the middle of the picture.
add the parameter "cutwidth=-1".
mathmax
30th April 2011, 01:46
add the parameter "cutwidth=-1".
same error.. "mask is empty"
and which value should I use for the loc parameter since my logo is at the middle of the video?
-TiLT-
30th April 2011, 02:21
Am I doing something wrong or is this logo hard to remove?
ORF1 HD is hard to remove. Never really had success myself. Maybe it helps if you separate the logo into different parts. Keep in mind that you need to work with really small falloff or falloff borders then.
I was wondering if the logo changes a little bit on every duplicate frame (25fps input vs 50fps output with dupes), making it so hard to remove as the detection always over or undershoots.
mathmax
30th April 2011, 15:37
I wonder what are the differences between this script and avsinpaint... could anyone tell me?
-TiLT-
1st May 2011, 04:18
As far as I know avsinpaint reconstructs areas of the logo by guessing what could have been under the logo through inspecting pixels around the logo and interpolating them over the logo area.
delogo tries to recalculate the original alpha-channel the TV-station used and apply it in a negative way so the the logo would remove itself, revealing the original pixels at the logo area.
mathmax
1st May 2011, 22:17
As far as I know avsinpaint reconstructs areas of the logo by guessing what could have been under the logo through inspecting pixels around the logo and interpolating them over the logo area.
yes and that works quite nicely, as far as I can see... but I wonder if it also process on the following and previous frames.. when there is motion (especially general motion like a camera move), it would be very relevant to interpolate the pixels of the following and preceding frames. Are there any tools or filter for that?
delogo tries to recalculate the original alpha-channel the TV-station used and apply it in a negative way so the the logo would remove itself, revealing the original pixels at the logo area.
you mean for semi-transparent logos?
Mine is solid, so it won't be useful...
In fact I was more asking about the differences between rm_logo and avsinpaint :)
therealjoeblow
3rd January 2012, 06:04
When I run this script I get an error as follows:
AviSynth script error:
Analyze: Mask is empty
(C:\Program Files (x86)\megui\tools\avisynth_plugin\rm_logo.avs, line 110)
(C:\Program Files (x86)\megui\tools\avisynth_plugin\rm_logo.avs, line 115)
Can anyone point me in the right direction please?
Thanks
The REAL Joe
EDIT: Forget it - figured it out, needed to replace "br" with "tr" in the script call... dopey me.
Toilet
7th January 2012, 16:40
Hi I'm new to this but your program is better than anything I can find out there!
:thanks:
Although the removing ability does vary from episode to episode
Here's the result of my script
http://img833.imageshack.us/img833/388/11885850.th.jpg (http://imageshack.us/photo/my-images/833/11885850.jpg/)
My Script:-
LoadCplugin("C:\Program Files\AviSynth 2.5\plugins\AVSInPaint.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\rm_logo.avs")
DirectShowSource("C:\Documents and Settings\Toilet\My Documents\Downloads\Anime\428 (1280x720 x264 AAC) LOGO.mp4", fps=23.976, audio=false, convertfps=true).AssumeFPS(24000,1001)
rm_logo(last, logomask="C:\Documents and Settings\Toilet\My Documents\Downloads\Anime\One Piece\logo3.bmp", loc="TR", par=4.0/3.0, mode="both", percent=75, pp=2)
It's good enough already but any chance of making it better because you can still clearly see the transparent code. Maybe I'm doing something wrong :scared:
Didée
7th January 2012, 17:08
I've never actually used this script of Spuds, but I know the underlying Delogo-filter halfway good. Looking at those masks, something has gone wrong. The alpha mask should be a light gray with the logo itself appearing dark-ish. The shown alpha mask seems dysfunctional. Also, the shown repair-mask and post-mask seem broken.
Can't tell you what went wrong, sorry. But I'm pretty confident that something went wrong.
Oh, maybe ... when using delogo.vdf directly, it is necessary that the initial logomask is plain black/red (with red being strictly RGB 255/0/0). But the shown logomask is black/white. Make it red instead, and try again?
Toilet
7th January 2012, 21:38
Thanks for the quick reply Didée!
I appreciate your help
I tried using delogo but I can't seem to get it to work!
Looking at the previous posts I can understand what you mean.
I tried everything but the repair-masks and post-masks still look like that
Do i need to load more plugins?
It still does a pretty awesome job but I'm just picky like that :P
Can anyone figure out why?
shark000X
7th April 2012, 15:38
Spuds, Didée, Didée and Spuds, thank you for the great work in improving inpaint functionality. I'm not a code-writer, so having terrific difficulties to further adopt inpainting tools according to current needs, and hope for effective help.
The problem is with semi-transparent logos, they eliminated under AVSInpaint+exInpaint+Rm_Logo, their inside fields became perfectly transparent but there are glass-like remainders after their borders. At first, I presumed that is the result of encoding artifacts (slight ringing, graining, so on), and treated the logos under variable customizations, including different logo-templates, but nothing could help. Now I guess, the glass remainders caused by aliased edges in the Pre-multiplied Alpha Channels (http://faculty.mdc.edu/jvanvori/Docs/Alpha%20Channels%20de-mystified.pdf) that probably exist in my HDTV-source.
Please, help to find out the right way:
1) Is it correct when I create RGB24 logo mask, or RGB32 is needed for correct operation?
3.1) Is it feasible at all to eliminate the Pre-multiplied Alpha Channels using your tools, and which tunings to activate in this case?
3.2) If not, are you going to add such functionality?
Sorry for my poor English. Thank you in advance for any help to the right way.
Gser
18th September 2012, 01:38
Wouldn't temporal blurring be a good post processing technique to add? Motion-compensated denoising?
StainlessS
18th September 2012, 03:22
I use a localized FFT3DFilter after Avs Inpaint with good effect, it 'calms' the temporal anomalies that can occur.
Gser
15th February 2013, 17:33
In what color space does this process video? Does it convert the original video the RGB or YUY2 and then back to YV12?
odyssey
27th October 2015, 02:49
I'm trying to remove a fixed date/timecode of old home home videos. These are opaque, very big and even with quite a bit of aliasing around them.
Inpainting with the different logo removal tools I've tried, looks REALLY good when you look at most frames. Unfortunately, it looks very odd in handheld shots (like my home video), because it uses no temporal information (from what I could see).
Wouldn't it be possible to implement this, wherever possible? DePanStabilize does something similar to the edges of stabilized video.
It seems I'm not the only one that would love to see this. I took the liberty of quoting some old (mostly) unanswered posts ;)
Would it be possible to add MV based image restoration to the function?
It could be something like compute the vectors of the 2 previous and following frames with a radius of the clip height/10 around the logo only in the second pass. When a block moves towards the vector and "disappears" it could be layered over the logo, or be mixed with with the Inpainting. (I hope you understand what i mean).
But how do I fix the warping type effect in the logo area when it inpaints? What PP option should I select to sort of "stabalize" that area?
Wouldn't temporal blurring be a good post processing technique to add? Motion-compensated denoising?
Maybe someone already has a solution or workaround, like StainlessS mentions here:
I use a localized FFT3DFilter after Avs Inpaint with good effect, it 'calms' the temporal anomalies that can occur.
That sounds great, but can you share a code example with us, please?
Spuds, I appreciate your effort on this script. Do you have an idea as to how to fix, or reduce this problem?
StainlessS
27th October 2015, 03:17
Suggest give this a whirl, probably will not be outdone for neither quality nor speed (for your problem, could well be wrong).
http://forum.doom9.org/showthread.php?t=154559&highlight=s_exlogo
EDIT: Suggest crop out localised area (with a little extra) and do de-logo on that, then can if required do a ilttle
FFT3DFilter-ing around area slightly larger than de-logo area, and then zap results back over source clip (overlay/layer).
EDIT: "FFT3DFilter-ing", feather result, ie make less obvious the fixed/non fixed region boundary.
johnmeyer
27th October 2015, 03:59
I'm trying to remove a fixed date/timecode of old home home videos ... Unfortunately, it looks very odd in handheld shots (like my home video), because it uses no temporal information (from what I could see).
Wouldn't it be possible to implement this, wherever possibleI've read your post several times, and am not quite sure what problem you are trying to solve. Handheld shots should not introduce any unusual problem. As long as the logo/timecode is at the same X/Y location, tools such as VirtualDub's Delogo should work fine (well, they'll work as well as they work ...).
FYI, here is a short video tutorial I created many years ago on using Delogo. While the tutorial is how to remove a stuck pixel, the same steps work for removing opaque logos.
Delogo Tutorial (https://www.youtube.com/watch?v=Z12TutFSg8c)
Again, if I can better understand what problem you are seeing when trying to remove the logos from hand-held footage, I might be able to suggest something. I've done a LOT of delogo work over the years.
StainlessS
27th October 2015, 16:40
My suggestion was assuming timecode was on opaque rectangular single color background, dont know if that is the case.
johnmeyer
27th October 2015, 17:51
My suggestion was assuming timecode was on opaque rectangular single color background, dont know if that is the case.The date/time stamp on home video footage usually does not have any solid background. In other words, these are different from the usual "lower third" graphic used on commercial television to identify who is talking.
The usual mistake people make when removing "logos" like time stamps is to try be too exact when painting the mask over the numbers (using their photo editing program). As an example they will attempt to paint over a zero (0), but still leave the hole in the center un-masked. Unfortunately, most cameras don't have perfect control over pixel placement, and also there is a lot of "splatter" from the almost pure-white text, and lots of adjacent pixels get affected. You generally have to paint over the entire number, and also the adjacent areas.
I did a terrible job in my tutorial showing how you scrub the Delogo preview window until you find a good frame for making the mask. In general, you would like a uniform light gray background that would make evident exactly how many pixels have been changed by the logo. While not gray, a uniform sky works well. Concrete or asphalt is also useful as a background.
Therefore, there advice I gave in my tutorial -- and the advice given in most other tutorials about removing time stamps and logos -- is to make the mask much larger than you think you need. Yes, this will result in a slightly larger blurry area than you might get with a more precise mask, but it will catch all those nearby pixels that might have been slightly brightened by the number or logo overlay.
BoobieNoobie
11th December 2015, 19:34
LoadCPlugin("C:\avis\AVSInpaint.dll")
Import("rm_logo.avs")
AviSource("C:\avis\video.avi")
rm_logo(last, logomask="logo.bmp", loc="br", par=4.0/3.0, mode="both", percent=20, pp=1)
there is no function rm_logo it says.
what is wrong with my script?
what code has to be in rm_logo.avs?
thank you for helping me :helpful:
manono
11th December 2015, 20:20
At the very least you also need the ExInpaint.dll. Everything you need is included here:
http://avisynth.nl/index.php/Rm_logo
BoobieNoobie
4th January 2016, 00:09
ok,
but my script does not work.
can you help me with a beginner script example for Newbies?
StainlessS
4th January 2016, 01:21
Perhaps already been done (script example)
http://www.google.co.uk/?gfe_rd=cr&ei=KRd1VKG6N5HCVND3gGA&gws_rd=ssl#q=%22rm_logo%22+|+%22Exinpaint%22
or on this site only
http://www.google.co.uk/?gfe_rd=cr&ei=KRd1VKG6N5HCVND3gGA&gws_rd=ssl#q=%22rm_logo%22+|+%22Exinpaint%22+site:forum.doom9.org
manono
4th January 2016, 08:09
but my script does not work.
What does that mean? The video opens but nothing happens? Or you wait and the video never opens? You know, don't you, that it can take a very long time for the script to even open in VDub? Perhaps as long as the video is, give or take, depending on how fast the computer is.
So, give us the script. If the video is a long one then trim it off to get some quicker results, something like:
Trim(500,1000)
right after the source statement.
can you help me with a beginner script example for Newbies?
No. The delogo parameters are based on the video and the logo. Maybe give us 10 seconds or so of the video.
BoobieNoobie
7th January 2016, 22:40
loadCplugin("C:\avis\Plugins\AVSInpaint.dll")
AVIFileSource("C:\avis\video.avi")
InpaintLogo(last, mask="C:\avis\logo.bmp", loc="TL", AR=16.0/9.0, mode="both", speed=20, ppmode=1, pp=75)
Trim (5852,70661)
script error
mask argument has the wrong type
??
logo.bmp ist a 24 bit Bitmap
manono
8th January 2016, 04:06
I thought the RM_Logo was called with:
RM_Logo(......................)
Maybe try:
loadCplugin("C:\avis\Plugins\AVSInpaint.dll")
AVIFileSource("C:\avis\video.avi")
InpaintLogo(last, mask="logo.bmp", loc="TL", AR=16.0/9.0, mode="both", speed=20, ppmode=1, pp=75)
Trim (5852,70661)
I don't know InpaintLogo. Which doesn't mean it doesn't exist, just that I don't know it. I use the InPaintFunc anyway so I won't be much help. Maybe someone else can help.
My BMPs are also 24 bit so I don't think that's the problem.
StainlessS
8th January 2016, 10:09
BoobieNoobie, by Manono,
Maybe give us 10 seconds or so of the video.
A good idea.
TCmullet
26th December 2016, 03:41
1. I struggled to get all the pieces, as the ".ru" site for avisynth is down. But I eventually found the various zip files from ".nl" etc. and pulled the dlls into my plugins. Then discovered the C one (not C++), so I regrettably have a:
LoadCPlugin("C:\Program Files (x86)\AviSynth\cplugins\AVSInpaint.dll")
(I don't like having ANY hardcoded paths. I want all to be in my current working directory, which changes a lot. This is why I like .avsi files. I renamed rm from .avs to .avsi.) The loadCPlugin works. I can see why AVSInpaint.dll needs to not be in plugins. Is there a way to not have to have any reference to it in my script? (Just like there's no need for any others to be referenced, as all the dlls are in plugins.) But this is a minor question. At least I made it further than this.
2. It would bomb on my mask file, with "specify a fully qualified directory and logomask name to use". Knowing numerous languages, and knowing Avisynth in part now, I figured out that even the author's sample code will not work. You MUST have a full path, which includes at least one backslash. And I learned also (by inspection of the code) that you must NOT use periods in your file name, other than before the extension. That's just peachy (sarcastically upset) as I use periods and hyphens LIBERALLY throughout all my filenames. My .bmps were to be no exception. I am frustrated that my whole naming convention has to be damaged because he insisted on not allowing periods AND requiring a path, when periods should be allowed AND the mask .bmp should be able to be held in the folder where my video files, scripts, etc. are, therefore not requiring a path. BUT for now and just to get it working for a test, I gave in and fudged my filename and script.
3. It's not going anywhere. Let me describe. I carefully created a black and white .bmp saving a sample frame from Virtualdub. ("Copy source frame to clipboard" in Vdub then "paste" in MSPaint). I've made red and blue ones lots of times back when I was using the delogo in Vdub. So I know how to make a b/w mask for this. I isolated just a 900 frame sample to analyse, which is 30 seconds at 30fps. I'm not trying get an accurate result yet; just trying to test this system and see it finish. Here's my func call:
rm_logo(logomask="E:\Video-Work-FAST\2016-12-02-1930-wv-TxRgv-v-TX-logoanal-1stRnd.bmp",\
loc="tl", cutsize="small", mode="deblend", percent=10, pp=1)
Before that call is my trims and after it is "__END__". After several minutes it does create a file:
2016-12-02-1930-wv-TxRgv-v-TX-logoanal-1stRndTL10AnalyzeResult000000.ebmp
Then it hangs for literally hours (over 2), creating nothing more, nor letting Vdub finishing "opening the file" and sitting on the first frame. I have to cancel it. If it won't finish with 900 mere frames (really 90, as I last specified 10%), how could it possible ever finish with a two hour video??? Isn't it supposed to stop and some point and create several more .ebmp files? It never created any more files (alpha, blend, etc.). I did this several times, varying percent as 100, 25, and lastly 10. My PC is a fast Dell T3500 workstation with 8 threads. 2 hours to analyse a 30 second video sample???? (And then only 10% of the frames.) The video is 1336 x 752. (Yes, it's odd, but that's not relevant.)
I'd really like to try out this rmlogo. But so far I can't get it past this early stage of failure. I'd appreciate some advice. Do I need to post further information? Sorry to add to this "official" thread for rmlogo, but I could find no answers elsewhere.
manono
26th December 2016, 04:35
Trim off a hundred frames or so and see if it'll open. It can take a very long time for the logo filter to open for a full length film and you don't want to have to wait a very long time only to discover you did something wrong. You might also provide a short 10 second sample from your source and maybe your full script.
TCmullet
26th December 2016, 04:40
Trim off a hundred frames or so and see if it'll open. It can take a very long time for the logo filter to open for a full length film and you don't want to have to wait a very long time only to discover you did something wrong. You might also provide a short 10 second sample from your source and maybe your full script.Isn't 900 frames sampling 10% of them (90 frames) short enough?? I haven't been using the whole 90 min. video but only 30 seconds, as I said. I do wonder if it's getting hung somewhere. Wish I knew more of those functions he's calling, both Avisynth and all the new dlls. Do you really want my script and 10 sec. of video? That's hard as my 900 frames are way into the video and it's 5GB.
TCmullet
26th December 2016, 04:44
# Requires AviSynth 2.6MT (using 2.6.0.5MT)
# 9/11/2015 switched to avisynth.2.5.8.6.MT.svp.dll
# 10/17/2016 switched to 2.6, alleged to be MT (2.5.8 dropped everywhere)
SetMemoryMax(1024)
global svp_scheduler=true
global threads=4
global svp_cache_fwd=threads+10
SetMTMode(3,threads)
mainfile="2016-12-02.1930.wv.TxRgv-v-TX.Rnd1.raw.Xe.es(lhn)" # filename WITHOUT .mp4 extension
video = DGSource(mainfile + ".dgi")
audio = wavsource(mainfile + ".wav")
AudioDub(video,audio)
AssumeFPS("ntsc_video")
# Delogo stuff (Comment all out for encoding)
LoadCPlugin("C:\Program Files (x86)\AviSynth\cplugins\AVSInpaint.dll")
as1=trim(11297,12580)
as2=trim(12873,13421)
as3=trim(13586,15001)
as1 ++ as2 ++ as3 # this is 1:48;
trim(0,900) # take 1st 30 sec
#rm_logo(logomask="E:\Video-Work-FAST\2016-12-02-1930-wv-TxRgv-v-TX-logoanal-1stRnd.bmp",\
# loc="tl", cutwidth=420, cutheight=160, mode="deblend", percent=10, pp=1)
rm_logo(logomask="E:\Video-Work-FAST\2016-12-02-1930-wv-TxRgv-v-TX-logoanal-1stRnd.bmp",\
loc="tl", cutsize="small", mode="deblend", percent=10, pp=1)
__END__
TCmullet
26th December 2016, 04:54
I created a short clip of 8 seconds, which is 1 GOP. This is MP4. But the upload as an attachment failed. It's almost 8MB long.
TCmullet
26th December 2016, 05:26
How do you folks normally share an 8MB file? I happen to have a website, so I am temp-borrowing space on it. Here's the video file:
http://www.tomsgoodfiles.com/2016-12-02.1930.wv.TxRgv-v-TX.8sec-sample(1gop).mp4
But I still hope you'll tell me how to share 8MB files here on Doom9.
TCmullet
26th December 2016, 05:30
I tried to upload the "tiny" .bmp, but IT too failed. (Sigh). Must I use my own file server to host everything?? Here's my b/w paint job. You will see that it correctly matches the logo in the video.
http://www.tomsgoodfiles.com/2016-12-02-1930-wv-TxRgv-v-TX-logoanal-1stRnd.bmp
manono
26th December 2016, 06:46
If you said you were trying to open only a short part of the entire video then I missed it and I apologize. Your first post was kind of long, though. However, when I'm removing opaque logos using the InPaintFunc, I do nothing else in the script but delogo. I'd suggest removing everything else, especially the audio. Make an intermediate lossless AVI and then do the rest the next time.
What are you trying to remove? The Longhorns Network logo? If it's surrounded by that brown stuff all the way through, I'd just replace it with that. Much easier.
Most people, when making samples available, use a third party file sharing site, ones such as Sendspace or MediaFire.
TCmullet
26th December 2016, 08:01
If you said you were trying to open only a short part of the entire video then I missed it and I apologize. Your first post was kind of long, though. However, when I'm removing opaque logos using the InPaintFunc, I do nothing else in the script but delogo. I'd suggest removing everything else, especially the audio. Make an intermediate lossless AVI and then do the rest the next time.
What are you trying to remove? The Longhorns Network logo? If it's surrounded by that brown stuff all the way through, I'd just replace it with that. Much easier.
Most people, when making samples available, use a third party file sharing site, ones such as Sendspace or MediaFire.But this is not an opaque watermark, but fully transparent. Therefore I set mode to "deblend" only. Uh, can't you see?... There's NOTHING else in the script except trimming out JUST the 900 test frame sequence. All of my other processing is out of the script (below the __END__). But to your suggestion of removing audio and creating intermediate lossless AVI, both are out of the question. First, there's no logical reason to believe that the presence of normal simple wav audio is causing the present problem of hanging. The docs NEVER say or imply such a restriction. Second, the concept of 2 passes, one for creating the several bitmap files then the "real" run does not inherently imply that you have to do the 2nd pass to an intermediate file. I often don't have enough space for that, PLUS I really need the 2nd pass to be part of the script that takes the original MP4 and does all processing out to Virtualdub. No multiple scripts. But there's really no need. Maybe it works well for your environment, but there's no way any of this can be causing it to hang.
> If it's surrounded by that brown stuff all the way through, I'd just replace it with that. Much easier.
I really don't know what you're trying to say by this. It's a transparent watermark, needing rmlogo to remove it. I don't know what you're suggesting as an alternative. "Brown stuff"? Well, there IS a lot of brown, but there's tons of lots of colors over time. Play the entire 8-sec. clip in WMP (or any other MP4 player). You'll see that just the camera panning alone causes MANY colors over time to pass under the watermark.
My understanding is that inpaint is used BY rmlogo. Rmlogo is Avisynth's recommended tool for logo removal. Deblending is what I need.
Okay, so while you're suggestions were thoughtful and generously given, I hope I've shown that they are not relevant to the problem at hand... finding out why rmlogo is hanging forever on only a short sequence of 900 (or 90) frames. I have given you the one .bmp that was produced, as well as a real segment of the actual video from which the 900 frames was taken. (Can't give a subset of the trims, as that would require encoding, and you rightly wanted to see part of the original file.)
What else would I need to supply for someone to figure out why rmlogo is hanging before creating the other bitmap files that it normally does by the end of an analysis run?
(Yes, I confess my posts can be long. I should insert blank lines more often, I guess.)
manono
26th December 2016, 08:52
There's so much text in there I thought you were removing the Longhorns Network logo in the lower right. I just looked at the mask and only now see you want to remove the text in the upper left. The last logo remover I'd use for translucent logos is this logo remover because it's so slow. I use (and am using at the moment) LogoTools. Perhaps someone else can help. Sorry not to be of any use. Good Luck.
TCmullet
26th December 2016, 14:56
My script did say loc="tl". As far as that lower right one, that's part of the news bar and I simply black out that whole thing. I don't even have to do it selectively (range of frames) as it's there the whole darn time. Maybe I can check out your suggested alternative for translucent watermarks, but seeing as this one is failing to operate "at all", I'd like to see it run as intended. I'll wait and hope that someone else can discern what my snag is. Thanks for your efforts, Manomo.
StainlessS
26th December 2016, 22:34
You dont like using LoadCPlugin, me neither but I do have an autoload avsi script in plugins for loading often used C plugs, or
for loading CPP plugins from some directory other than plugins eg DGIndex folder, so that I can have a standard DGIndex
folder (up to date) and not by accident be using an additional dll in plugins with an old DGDecode.dll in it.
Here what I use.
InitExternalPlugins.avsi
fn1 ="C:\NON-INSTALL\DGMpgDec\DGDecode.DLL"
Exist(fn1) ? LoadPlugin(fn1) : NOP
fn2= "C:\NON-INSTALL\DGAVCDec\DGAVCDecode.dll"
Exist(fn2) ? LoadPlugin(fn2) : NOP
#fn3= "C:\Program Files\AviSynth\plugins\FFMS_C\ffms2.dll" # FFMpegSource C Plugin
#Exist(fn3) ? LoadCPlugin(fn3) : NOP
fn4= "C:\Program Files\AviSynth\plugins\FFMS_CPP\ffms2_26.dll" # FFMpegSource CPP Plugin
Exist(fn4) ? LoadPlugin(fn4) : NOP
fn5= "C:\Program Files\AviSynth\plugins\LSMASH_CPP\LSMASHSource.dll" # L-Smash CPP
Exist(fn5) ? LoadPlugin(fn5) : NOP
Does not solve your main problem but maybe of some use.
EDIT: Groucho2004 posted an alternative here:- http://forum.doom9.org/showthread.php?p=1790994#post1790994
hello_hello
27th December 2016, 12:41
1. I struggled to get all the pieces, as the ".ru" site for avisynth is down. But I eventually found the various zip files from ".nl" etc. and pulled the dlls into my plugins. Then discovered the C one (not C++), so I regrettably have a:
LoadCPlugin("C:\Program Files (x86)\AviSynth\cplugins\AVSInpaint.dll")
(I don't like having ANY hardcoded paths. I want all to be in my current working directory, which changes a lot. This is why I like .avsi files. I renamed rm from .avs to .avsi.) The loadCPlugin works. I can see why AVSInpaint.dll needs to not be in plugins. Is there a way to not have to have any reference to it in my script? (Just like there's no need for any others to be referenced, as all the dlls are in plugins.) But this is a minor question. At least I made it further than this.
If I'm understanding you correctly you can create your own AVSI file containing your LoadCPlugin line above for loading the plugin and putting it in the auto-loading plugins folder (or use Load_Stdcall_Plugin). Or add it to the top of an AVSI script that uses the plugin such as RMLogo.
If you want to put a C plugin in your working directory, try loading it this way.
Load_Stdcall_Plugin("AVSInpaint.dll")
2. It would bomb on my mask file, with "specify a fully qualified directory and logomask name to use". Knowing numerous languages, and knowing Avisynth in part now, I figured out that even the author's sample code will not work. You MUST have a full path, which includes at least one backslash. And I learned also (by inspection of the code) that you must NOT use periods in your file name, other than before the extension.
I think you're right about having to use a backslash when specifying a bitmap location, but not the full path. This works perfectly for me if the bitmap is in the working directory:
rm_logo(logomask="\test.bmp", loc="tl", cutsize="small", mode="deblend", percent=10, pp=1)
I'd also have to disagree about not using periods in the file name, given this works for me too.
rm_logo(logomask="\t.e.s-t.t-s-.st.bmp", loc="tl", cutsize="small", mode="deblend", percent=10, pp=1)
All files were located in "D:\New Folder" for testing.
I'd really like to try out this rmlogo. But so far I can't get it past this early stage of failure. I'd appreciate some advice. Do I need to post further information? Sorry to add to this "official" thread for rmlogo, but I could find no answers elsewhere.
Try a program that's not VirtualDub. Something like MPC-HC or even VirtualDubMod. I tested the above script with VirtualDub though and it worked fine.
Maybe it's a multithreading issue. I only ever use single threaded avisynth.
A couple of suggestions. Your bitmap contains a large block of white covering the writing. If possible, try making a bitmap with just the writing in white. I think it might work better. It might be just because it was such a short sample, but a block of white appears as though it'll do this.
https://s24.postimg.org/sziq1thmt/Logo.jpg
I also suspect you'll need to use mode="Both" rather than deblend for a better result, which is unfortunately a lot slower. For RMLogo, tuning the AlphaToRepair function is important when using "both" or "Inpaint" modes. The default is 130 which I find is usually way too low. Somewhere around 200 seems to be more typical. The higher you go, the less of that "off colour" effect there'll be, but the more painting it'll do and the more "wobble" there'll be where it's painted instead, but that's probably another reason for avoiding slabs of white in the bitmap if you can.
If you can't get the desired result with RMLogo, try InpaintFunc (http://avisynth.nl/index.php/InpaintFunc) instead. The result won't be hugely different (they both use AVSPaint.dll) but they do seem to paint differently so sometimes one might look a little better than the other according to the logo and/or background. That &*^&s me off no end because I can't just use one or the other. I have to analyse the video with both and compare the results, which of course takes more time. InpaintFunc doesn't have an AlphaToRepair option which maybe contributes to it working a little better sometimes, and sometimes not. You can set the location of the logo more precisely with InPaintFunc, although it probably matters not to the end result. ie loc = "12,364,-440,-20"
hello_hello
27th December 2016, 13:25
That's something I either didn't know, or I did but have long since forgotten. While playing around I noticed the ExInpaint line in the RM_Logo script is commented out by default.
#repaired = ExInpaint (repaired.converttorgb32, repairmask.converttorgb32, color=$ffffff,xsize=5, ysize=3, radius=36)
A quick test indicated the result is different when it's uncommented (at lest in Inpaint mode), but I haven't run any real comparisons yet.
I discovered I didn't have the ExInpaint plugin in the auto-loading folder anyway, but I eventually found it here (http://avisynth.nl/users/fizick/exinpaint/exinpaint.html).
TCmullet
27th December 2016, 14:00
Hello_hello, you're missing something important. A lot of your comments deal with improving and tuning. My main point is not that I need "improvement". I need it to not hang when doing the analyse phase. It never finishes, not even on a 900 frame sample. That's the primary help I need.
> Your bitmap contains a large block of white covering the writing. If possible, try making a bitmap with just the writing in white. I think it might work better. It might be just because it was such a short sample, but a block of white appears as though it'll do this.
Uh, you're missing the point there too. My white DOES cover the writing. What--You want me to trace each strand of the letters?? No, rmlogo (I can tell) works the same way as Delogo in Vdub. You circumscribe the logo area with the solid color painting the logo itself with the opposite one. I made the white as small as humanly possible in surrounding the logo. My block of white is not large, but only barely covers the logo area (which is a bit large for logos, but it's a special one).
> If you want to put a C plugin in your working directory, try loading it this way.
I never wanted to put it in my working directory. I wanted it in the plugins folder AWAY from my numerous working directories and without a path. But I can live with a path if necessary. No, having it in working directory is the worst because then you either have multiple copies (not a good practice) or you may get multiple versions floating around your set up.
But I can try leaving out multithreading, as it's easy enough to try.
TCmullet
27th December 2016, 14:27
> But I can try leaving out multithreading, as it's easy enough to try.
BINGO!!!! It now finishes! And in less than 10 seconds! (As I would have expected.) Thanks, Hello_hello. Now I can pursue other problems. Like getting it to work better. Like re-reading the instructions and maybe figure out why it didn't create the other mask files I thought it would. But it DOES come back and plays the 900 frames on my Virtualdub timeline, with the delogo-ing effect applied!
My plan, if I use rmlogo, is to include the logic for analyse phase at one point shortly after the video file is opened, and comment it out for the real run. I guess I need to have that spot be before I setMTmode to multithreading. A simple change with adverse affect. Seeing as multithreading is used very widespread, maybe the rmlogo doc should be updated to warn not to use with multithreading. However, I wonder if multithreading can be used with the final run. To not allow that would be a great hindrance, as I need multithreading to cut down on run time. I'm reminded of the idea of doing a separate pass for rmlogo, creating a temp lossless file. Ughhh. But it maybe necessary JUST to allow no multithreading for rmlogo and multithreading for the rest of my script which needs it. This is getting to be a lot of work just to get rid of a logo.
TCmullet
27th December 2016, 14:37
That's something I either didn't know, or I did but have long since forgotten. While playing around I noticed the ExInpaint line in the RM_Logo script is commented out by default.
#repaired = ExInpaint (repaired.converttorgb32, repairmask.converttorgb32, color=$ffffff,xsize=5, ysize=3, radius=36)
A quick test indicated the result is different when it's uncommented (at lest in Inpaint mode), but I haven't run any real comparisons yet.
I discovered I didn't have the ExInpaint plugin in the auto-loading folder anyway, but I eventually found it here (http://avisynth.nl/users/fizick/exinpaint/exinpaint.html).
Let us know your results in dealing with that commented out line.
TCmullet
27th December 2016, 14:43
> I'd also have to disagree about not using periods in the file name, given this works for me too.
> rm_logo(logomask="\t.e.s-t.t-s-.st.bmp", loc="tl", cutsize="small", mode="deblend", percent=10, pp=1)
I don't see how this can work, because his logic is testing for the first period in the filename and assumes that it's the delimiter before the extension.
s2 = logo_name.findstr(".") - 1 # find the length of the extension
logo_name = leftstr(logo_name,s2) # just the name !
This would result in your logo_name becoming "t" instead of the desired "t.e.s-t.t-s-.st". But at least it would proceed, I concede.
TCmullet
27th December 2016, 14:57
I ran a NON-analyse mode run. You choose to do analyse vs non-analyse by leaving the ebmp file out there. If it detects it's there, it's non-analyse. Sadly, it appears that in either mode, you may not use multithreading. This will hurt, but maybe I can live without multithreading, as the percentage of videos where rmlogo would be used is small for me.
Yes, mode="both" is TERRIBLY slower!
TCmullet
27th December 2016, 14:58
Uh, I'm beginning to think this rmlogo function does NOT write out additional .ebmp files, but only writes out the one but has 2 images within it, stacked vertically. Am I right?
(Yes, I am, I've found from further reading. I've been operating under the belief that it would operate like Vdub's Delogo. Several files, including a "deblend" mask. But it appears that the deblend mask is created on the fly each time. So the only file put out by rm logo is the sole .ebmp.)
TCmullet
27th December 2016, 15:09
(Yes, I realize I'm stacking many comments, but you (hello_hello) DID say a lot of things.)
> I also suspect you'll need to use mode="Both" rather than deblend for a better result, which is unfortunately a lot slower. For RMLogo, tuning the AlphaToRepair function is important when using "both" or "Inpaint" modes. The default is 130 which I find is usually way too low. Somewhere around 200 seems to be more typical.
Why would you think I'd need "both"? I said "deblend" only, because there is no part of the logo that is not transparent.
TCmullet
27th December 2016, 16:25
New problem: I wanted to try setting PP to something other than 1, and got this:
"FFT3DFilter: Can not load FFTW3.DLL !"
I'm using this file:
fft3dfilter_20070220.zip (Yes, the FFT3DFilter.dll file within, and it's been put in my plugins folder.)
but I don't remember where I got it, other than it wasn't from avisynth.ru as that site is down.
Groucho2004
27th December 2016, 16:49
New problem: I wanted to try setting PP to something other than 1, and got this:
"FFT3DFilter: Can not load FFTW3.DLL !"
Use this one (https://forum.doom9.org/showthread.php?t=173229), instructions for fftw*.dll are included in the first post.
TCmullet
27th December 2016, 17:01
Use this one (https://forum.doom9.org/showthread.php?t=173229), instructions for fftw*.dll are included in the first post.
I put the libfftw3f-3.dll file in both directories (system32 and syswow64), rebooted, and got the same error.
Groucho2004
27th December 2016, 17:12
I put the libfftw3f-3.dll file in both directories (system32 and syswow64) and got the same error.Did you put the included fft3dfilter.dll in your auto-load directory? Also, 64 bit system DLLs go to System32, 32 bit system DLLs go to SysWOW64. If you mix that up you will run into problems.
TCmullet
27th December 2016, 17:21
Did you put the included fft3dfilter.dll in your auto-load directory? Also, 64 bit system DLLs go to System32, 32 bit system DLLs go to SysWOW64. If you mix that up you will run into problems.
Maybe I'm confused a bit. Yes, I put the fft3dfilter.dll into the "autoload" folder, which is the Avisynth plugins folder. For me that's:
C:\Program Files (x86)\AviSynth\plugins
But I'm following your advice and removing libfftw3f-3.dll from system32, leaving it only in syswow64. I'm using 32-bit everything, even though PC is 64-bit Win10, as I was advised long ago to stick with 32-bit "everything" when it comes to Avisynth and VirtualDub.
TCmullet
27th December 2016, 18:29
I hate messing with someone else's code, but it's too much of a disruption to the dozens of projects I'm working on to disallow many periods in the file names (of the analyse bmp) and to require a d_mn path. (I want my .bmp in the same folder with my video files for the project.) So I'm changing this code:
# 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 !
to this:
# TC's version of above 5 commented out lines
# Separate out the directory and logo names so we can save a unique ebmp file
logo_name=leftstr(logomask,strlen(logomask)-4)
There's no reason to hunt for slashes that I'm not going to have there. And as there is only one file, a .bmp, there's no reason to expect some extension of other length. Therefore my one-liner works.
Groucho2004
27th December 2016, 18:49
Maybe I'm confused a bit. Yes, I put the fft3dfilter.dll into the "autoload" folder, which is the Avisynth plugins folder. For me that's:
C:\Program Files (x86)\AviSynth\plugins
But I'm following your advice and removing libfftw3f-3.dll from system32, leaving it only in syswow64. I'm using 32-bit everything, even though PC is 64-bit Win10, as I was advised long ago to stick with 32-bit "everything" when it comes to Avisynth and VirtualDub.
If you still have trouble with this, use AVSMeter (https://forum.doom9.org/showthread.php?t=165528) to check your Avisynth setup.
Run "AVSMeter -avsinfo -log" and post the created log file ("avsinfo.log").
TCmullet
27th December 2016, 19:11
I discovered that pp values do not change a "degree" of anything, but rather are each a radically different method. (The value isn't a value used in a computation, but rather a multi-value SWITCH.) So until I can get pp=2 to work, I'm using pp=1.
I increased the test frames from 900 to 5791 (3:13), and percent from 100 down to 50. Took 46 seconds to run and looks very good! At least most of the time. Here's debug frame of a small segment that looks inferior:
https://s23.postimg.org/6lvoow3wr/2016_12_02_1930_wv_Tx_Rgv_v_TX_rmlogo_test1.jpg
Here's my func call:
rm_logo(logomask="2016-12-02.1930.wv.TxRgv-v-TX.logoanal-1stRnd1.bmp",\
loc="tl", cutwidth=385, cutheight=125, mode="deblend", percent=50, pp=1, debug=true)
In the above image, it's not the text image that's objectionable; it's the reddish "LHN" square in upper left of "Repaired" and "Post". Going from 900 to half of 5791 frames greatly helped, but you can see here the reddish "LHN" portion shows up too well when against a solid not-dark background.
I'll try 100 percent (doubling 46 secs for the analyse run) and see if that's better.
TCmullet
27th December 2016, 19:57
If you still have trouble with this, use AVSMeter (https://forum.doom9.org/showthread.php?t=165528) to check your Avisynth setup.
Run "AVSMeter -avsinfo -log" and post the created log file ("avsinfo.log").
The tail end of the rpt says:
"C:\Program Files (x86)\AviSynth\plugins\FFT3DFilter.dll"
Dependencies that could not be loaded:
fftw3.dll
Note: "fftw3.dll (libfftw3f-3.dll) can be downloaded here:
http://www.fftw.org/install/windows.html
fftw3.dll must be placed in a directory to which the
'PATH' environment variable points, i.e. System32/SysWOW64"
But it IS in sysWOW64. But the problem is the system path does not have that in there. My path is:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Tom-Xeon1\AppData\Local\Microsoft\WindowsApps;
I never set up any path. This was a Win7-64, upgraded to Win10-64, but I've always run 32-bit Avisynth things. Is adding to the path something I as a windows user should be expected to do? I can go into "environment variables" there and augment the path statement I see there. Shall I do that?
TCmullet
27th December 2016, 20:15
I did it. I found where I could add a clause to the path. Path (after reboot) is now:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;
C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\sysWOW64;C:\Users\Tom-Xeon1\AppData\Local\Microsoft\WindowsApps;
But I ran AVSMeter again and still says same thing.
And yet the file libfftw3f-3.dll is definitely in C:\Windows\SysWOW64
Groucho2004
27th December 2016, 22:17
The tail end of the rpt says:
"C:\Program Files (x86)\AviSynth\plugins\FFT3DFilter.dll"
Dependencies that could not be loaded:
fftw3.dll
That last part indicates that you are not using the fft3dfilter.dll I built.
TCmullet
27th December 2016, 23:01
That last part indicates that you are not using the fft3dfilter.dll I built.
So I retraced your instructions. Over at that other thread (in the first post) is:
Dropbox Directory (fft3dfilter_32.7z)
I also built a 64 bit version of this plugin with VC10. In order to do this, all inline assemly code had to be removed because rewriting it to be compatible with x64 would be a major task. With the default temporal block size (bt = 3), it's a bit slower than Fizick's original but with "bt = 5", it's faster.
Dropbox Directory (fft3dfilter_64.7z)
This filter needs the FFTW support library (current version is 3.3.4), you can download it here ("fftw-3.3.4-dll32.zip" / "fftw-3.3.4-dll64.zip"). Unpack "libfftw3f-3.dll" from the zip file and copy it to system32/SysWow64.
I had followed the "here" link which was to www.fftw.org, and I followed instructions there. Are you saying I should have gotten from the 32-bit dropbox instead?
I confess, this is rather confusing for me, but I"m trying hard to sort it out. Confusing as the "here" link does have libfftw3f-3.dll, but the dropbox only has a different file, fft3dfilter.dll. ...As I go back I see you DID say to me to get fft3dfilter.dll. ....
Okay, I have gotten the fft3dfilter_32.7z file from the dropbox. Contents is fft3dfilter.dll. I've put that in Avisynth plugins. And from the "here", the libfftw3f-3.dll is in the sysWOW64 system folder.
And the pp=1 works! Thank you!
TCmullet
27th December 2016, 23:09
Groucho, I think the key point of my confusion was that I THINK I thought that you had changed the name of fft3dfilter.dll to libfftw3f-3.dll. I wasn't realizing that both are necessary, but each in their own location.
TCmullet
27th December 2016, 23:22
Hello_hello (or anyone),
You can see in my debug graphic that the repaired frame has that orangey "LHN" logo (the 3 big letters) still visible. Only appears when the background behind it (I think) is not dark or is a slightly similar color.
With the kind help of Groucho, I've gotten the pp to work. pp=0 is worse. pp=1 is best. pp=2 and =3 are actually worse than pp=1.
I am believing that any of the parameters that have "repair" or "inpaint" in the name relate only to mode="inpaint" (or "both" as both includes inpaint). So does that mean that pp (post processing is the only thing that can be tweaked for deblend-only operations?
Any thoughts on how to improve that orangey "LHN" sometimes-ghost?
TCmullet
27th December 2016, 23:34
It is not clear in all cases WHICH parameters are used during Analysis and WHICH are used in the real run. Some are obvious, like cutsize. But could someone knowledgeable build a list (or change the wiki) with 3 sublists? Analysis, regular run, and both. I'll give a start.
BOTH:
--clp
--logomask
--loc
--cutsize
--cutwidth
--cutheight
--mode
ANALYSIS ONLY:
--par
--percent
REGULAR RUN:
--pp
--lmask
Such lists would help us beginners GREATLY so that we know whether tweaking something has to be done during analysis vs regular run. (I change things and nothing is different. "Must be needed in analysis instead", I tend to think. Yet, we need to avoid doing needless and ignorant reruns of lengthy analysis.)
TCmullet
28th December 2016, 00:01
Another question I've not seen addressed. (Please forgive if obvious.) In Vdub's Delogo, provision was made to include just ranges of frames you specify for final processing. I see nothing of that here. It made me wonder if this filter is able to be applied even where there is no logo, with no harm. In Delogo/Vdub, it DOES cause GREAT harm to non-logoed frames.
Is it totally up to me to devise a mechanism of applying or not applying rm logo to a given frame?? The videos I'll be tackling, including the video from which I supplied an 8-sec test clip here, have it cut in and out A LOT! Not like for example most movies.
hello_hello
28th December 2016, 02:56
Hello_hello, you're missing something important. A lot of your comments deal with improving and tuning. My main point is not that I need "improvement". I need it to not hang when doing the analyse phase. It never finishes, not even on a 900 frame sample. That's the primary help I need.
Missing the point? I made suggestions regarding the problem.
Uh, you're missing the point there too. My white DOES cover the writing. What--You want me to trace each strand of the letters?? No, rmlogo (I can tell) works the same way as Delogo in Vdub. You circumscribe the logo area with the solid color painting the logo itself with the opposite one. I made the white as small as humanly possible in surrounding the logo. My block of white is not large, but only barely covers the logo area (which is a bit large for logos, but it's a special one).
I'm not missing your point. It's easy enough to make just the text white in a bitmap. Often you'll find somewhere the text is on a dark background, so it's easy enough to make the background black and the text white. Any decent image program should have a "fill" function and a function for replacing colours. Even using your tiny video sample, this took me about 90 seconds with Irfanview. I'm not saying it's perfect, but I wasn't bothering with that for this example. It shouldn't take too long though.
https://s27.postimg.org/krsd818pf/test.jpg
I'm not sure you'd always want to do it that way, but for the Inpaint modes I'm sure it makes a difference. Sometimes a block of white might look better rather than painting just the letters, or sometimes not (it depends on the background). Maybe someone else can explain why that's not necessarily the best way. I'll agree from looking at your screenshot of debug mode it's possibly not necessary for pure deblending.
However, I wonder if multithreading can be used with the final run. To not allow that would be a great hindrance, as I need multithreading to cut down on run time.
I don't use mulithreading as I've always found it less stable and no faster than simply running two jobs at a time. If I'm only encoding one video I create two scripts to encode half the video each and run them simultaneously.
Sometimes, if I'm not in a hurry, I run them one at a time as it doesn't push the CPU to 100% and keeps the CPU fan noise down.
Yes, mode="both" is TERRIBLY slower!
InPaint mode will always be way slower than deblend mode but sometimes it works better. Sometimes though, if you can tune the AlphaToRepair just right in "both" mode it'll deblend more and therefore it'll be faster than Inpaint mode.
Why would you think I'd need "both"? I said "deblend" only, because there is no part of the logo that is not transparent.
It's not completely transparent, and the logo above the writing looks almost opaque to me, which is why it's giving you problems in deblend mode, but if you've already decided deblending works best.....
Having a slab of white is possibly producing a different result than only the text being white would, as even looking at deblend mode it seems to be changing the image around the text a bit, and not just the text itself. I'll have to experiment more with that myself at some stage. Anyway....
Deblend
https://s29.postimg.org/o5dahf46v/Deblend.jpg
Both, AlphaToRepair=160
https://s29.postimg.org/bpgknoauv/Both.jpg
hello_hello
28th December 2016, 03:13
It is not clear in all cases WHICH parameters are used during Analysis and WHICH are used in the real run. Some are obvious, like cutsize. But could someone knowledgeable build a list (or change the wiki) with 3 sublists? Analysis, regular run, and both. I'll give a start.
If you change a parameter such as logo location and another analysis pass is required it'll be run and a new ebmp file created. If it's not required it won't be. I don't think there's any exception to that rule, unless you try to fool it by replacing the original bitmap with a different one of the same name, but then you'd delete the ebmp file and force a new analysis. You can change the mode after the analysis pass is run.
Another question I've not seen addressed. (Please forgive if obvious.) In Vdub's Delogo, provision was made to include just ranges of frames you specify for final processing. I see nothing of that here. It made me wonder if this filter is able to be applied even where there is no logo, with no harm. In Delogo/Vdub, it DOES cause GREAT harm to non-logoed frames.
For Inpaint mode it doesn't matter, but for deblend mode I think you'll often end up with black where the logo would have been if it's not present. Use Trim.
Trim(0,1000)\
++Trim(1001,2000).rm_logo(logomask="E:\test.bmp", loc="tl", mode="Both", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=160)\
++Trim(2001,3000)
If you use logo removal for more than one range of frames I'm pretty sure only the first will be used for the analysis. Often that's enough, otherwise you can create a copy of the bitmap with a different name for each frame range requiring logo removal.
TCmullet
28th December 2016, 04:33
It's easy enough to make just the text white in a bitmap. Often you'll find somewhere the text is on a dark background, so it's easy enough to make the background black and the text white. Any decent image program should have a "fill" function and a function for replacing colours. Even using your tiny video sample, this took me about 90 seconds with Irfanview. I'm not saying it's perfect, but I wasn't bothering with that for this example. It shouldn't take too long though.
HH, you're amazing!
Let's start here: To make my simple mask, took me around 10 minutes (a guess) with the "any decent image program" I know of, MSPaint. Uh, are you implying that it's not the best? I had to experiment with brushes, styles, etc., then carefully draw the white rectangles, fill in, then carefully black out the rest. Tedious. Today I gave benefit of doubt for your suggestion to get closer. Here's the result:
https://s28.postimg.org/b6kcf2bt9/2016_12_02_1930_wv_Tx_Rgv_v_TX_logoanal_1st_Rnd2bw.jpg
It took me a horrible half hour or more with painstaking small brushing, a lots of ctrl-z and eyestrain to come up with this! I can't believe you and I are that different in skill. It must be that MSPaint is woefully inadequate. I've not been "into" graphics programs at all really. I did use IRfanview a few years back a lot, BUT only for cropping and resizing. I do have it. Could you please tell me how to make it do what you only took 90 sec. to do?? That is, what items from what dropdown menus, and in what sequence? I have always been intimidated by graphics programs due in part to their lack of explanation of what everything does.
I can grasp that inpainting really would do better if you were to trace the shafts of all the letters. In Delogo, it didn't matter much. But then again, I always focused on deblending more. Also, my results were never outstanding, but marginally tolerable at best.
Since I last wrote, I have experimented a little with "both", and the results are promising. But I am willing and interested in spending "my 90 secs+" to create a better map. I'll greatly appreciate your brief help. I'll follow your steps closely in IRFanView.
TCmullet
28th December 2016, 04:37
As I browse through all the menus and items in my v 4.37 of IRFanView, I cannot even imagine which items would be used for such a thing as this. I really can't!
Update: I've just found and installed v4.44-64bit on my Win10-64bit system. So if you're current, HH, so am I, fyi.
hello_hello
28th December 2016, 05:53
I'm still not 100% sure how much difference it makes to the end result in deblend mode. I haven't tested that yet. It does make a difference when Inpainting. I think the pixels used for InPainting are always taken from outside the "matted" area. Often I'll fill in letters (ie by making the letter "O" a solid circle of colour), at least when Inpainting so the logo isn't replaced by wobbly colours that you can almost still read... if that makes sense.... and sometimes blocks of white can work a little better for InPainting when there's a lot of text. It depends on the size of the text and the type of background, the post processing mode you choose and personal taste, so it's worth experimenting.
The Irfanview Replace Colour function is under the Image menu. The Paint function is under the Edit menu, but you need to install the Irfanview plugins package for that. I'm using Irfanview 4.42.
I often quadruple the size of the image for doing this sort of thing as it's easier to see detail, then resize it back to the original resolution, although I didn't this time.
I think the final image below still has a little non-white in the text area that needs fixing with the paint function or by replacing colours. I didn't look closely enough at the time as I was a little rushed, so it's a little rough. Taking the screenshots took much longer than "painting" though. That was done using only the four steps below. When replacing colours the tolerance value sets how close to the selected colour a colour needs to be for replacement. The higher the value, the more the replaced colour will "bleed" into other colours too. Normally that's want you'd want when replacing the text with white to make sure the entire text is covered. If it bleeds too much or too little, choosing a slightly different source colour instead of adjusting the tolerance level can be enough to fix it.
Replace the background colours after the logo/text is done.
Of course it's much easier if you can find somewhere the logo is on a completely black background, such as during the credits or maybe the fade out before a commercial break.
https://s24.postimg.org/aw5zglhut/image.jpg
Edit/Cut area outside of selection.
https://s24.postimg.org/or49z2c9x/image.jpg
Click on the image to select the colour to be replaced and select the replacement colour using the Replace Colour window.
https://s24.postimg.org/489dtzycl/image.jpg
https://s24.postimg.org/4z6pdiq3p/image.jpg
https://s24.postimg.org/k2oa3vn39/image.jpg
Logos often have outlines that are a slightly different colour to the background or logo itself and hard to see. One trick is to make the logo/text white and then fill the background (using the Paint function rather than Replace Colours) with a lighter colour such as yellow or light blue etc. That way you can usually see if there's a logo outline that should be made white, and after doing so it's easy enough to fill the background colour with black again.
TCmullet
28th December 2016, 06:18
The IRFanView site says "Note: A normal IrfanView version includes the following (most important) PlugIns: Effects, Paint, Ansi2Unicode, Icons, Slideshow-EXE, RegionCapture Tools, Video, Metadata, JPG-Transform." So I think the Edit menu's "Show Paint Dialog" gets us the paint ability.
I'm still struggling to grasp the steps. So far I suspect:
1. Use the Painter (which I haven't tried yet) to draw a small frame around the logo area, then quick-draw massive black everywhere except in the small window.
2. Then somehow use the replace color, which you've set "tolerance" value to 80. Uh, that's not 80 *percent* as it's out of 128, not 100. Therefore I'm not grasping what 80 does. Do we first set "new color" to black or to white for first actions?
There must be a cycle of repetitious steps you are going through, probably with new color set to white intially. You are doing it very fast, as in many cycles in a half minute, but you also have apparently doing it for so many years that you are having a hard time codifying it into concrete steps that I can follow, in order to watch it work for me.) You know what to look for when putting mouse on a stray color. Can you please spell this process out explicitly? It will help not only me but EVERYONE who ever reads this and doesn't know graphics programs inside and out like you apparently do.
Update: Okay, I'm trying it out, not without difficulty. Let me report before you respond.
TCmullet
28th December 2016, 07:09
In IrFanView:
1. Pick Replace Color from Image menu.
2. Press the 2nd Choose button to set a new color.
3. Pick the white color (and "ok"). You'll see white in the dialog window with "Hex FFFFFF" below it, if you picked the right color.
4. Carefully left-click the mouse in the whitest area of the logo one time. The Replace Color dialog window's title bar will flash angrily at you (for reasons I don't know). But the shade of grey that you clicked on in our image's logo area is now filling in the "Replace source color" window in the dialog box. The hex value will be something high, but not white (FFFFFF).
5. Set the Tolerance value to 80. Press "OK" in the dialog box. The box will go away, but in our image lots of greys will turn pure white, both in the logo area and elsewhere.
6. Pick Replace Color again.
7. Choose button for a new color, again.
8. Pick the black color. You'll see white in the dialog window with Hex 000000 below it, IF you picked the right dark color.
9. Carefully left-click the mouse in the DARKEST area anywhere on the image. That dark color will appear in the "Replace source color" window.
10. With Tolerance still at 80, press "OK" to execute the transformation. All dark areas throughout the image will bleed to cover more area.
So.... I hope I get an A for initiative in a very scary environment. What do I do next? How do I get the white letters in the logo text to "bleed" outward so that the white shafts of the letters are "fatter" than normal? I believe this is necesary. (Isn't it?)
I know I must use the Painter tools to black out the massive areas, and then maybe smaller tools to black out the non-black regions that are close to but not touching the logo components.
To make this communication foolproof, I've found and used the same sample frame that you found. (I had to find it in the full video, as that's what's already set up for opening in my script. Wasn't hard as I had pull the 1gop sample MP4 for you from near the start of the first logoed footage.)
(Side note: For some strange reason, I cannot do "undo" for both steps that I did.)
TCmullet
28th December 2016, 07:23
How do I get the white letters in the logo text to "bleed" outward so that the white shafts of the letters are "fatter" than normal? I believe this is necesary. (Isn't it?)
I think I may have answered this. Starting over. (I found out that IrFanView does not have a real Undo stack; you can only undo the last thing done. Silly, IMO.) I'm glad I was never going to save on top of my source file! I "re-open".
I noticed your graphic showing the grey in the Source color window. I decided to start over and instead of clicking the window to pick the whitest grey area I could find, I selected 127,127, 127, *manually* in the color chooser area. (You had apparently clicked on some grey area in the image, resulting in *approximate* grey.) With pure white as the new color, when I okay's it, the logo text was BOLD! Perhaps this is the needed final state of the logo area, except for carefully using the Painter to black out all stray non-black. MUCH easier now that I don't have to do any drawing right up to the edge of anything!
StainlessS
28th December 2016, 07:32
and eyestrain to come up with this!
I usually use quite a big View/Zoom to do the outline in Paint, before using fill and/or rectangular block filling.
Also a good idea to do about two extra pixels all the way around, and not leave any little spikes as in your post #131
ascenders and descenders. (round them off a bit bigger)
TCmullet
28th December 2016, 07:42
I usually use quite a big View/Zoom to do the outline in Paint, before using fill and/or rectangular block filling.
Also a good idea to do about two extra pixels all the way around, and not leave any little spikes as in your post #131
ascenders and descenders.I'm puzzled by this. Those descenders are parts of letters that are part of the logo, so doesn't it make sense that they have to be whited out? What you saw there was my "rough" effort at getting as close to the edges of the letters, first with white, then (harder) with black. Gosh, doesn't it take you forever to do one logo, like it did me?? Even without Hello_hello confirming what I've written of my throw-myself-in-to-the-crocodile-and-maybe-swim experience, I can see that his method is a ton faster. I'm doing it a couple times now myself, to get the hang of it, and to get a result saved. I can't do it in 90-sec. yet like he can, but I feel I'm on the way.
And yes, I did zoom in REAL big for that 131 image. The eye-strain was in trying to see whether I had blacked out pixels or not. Very hard (at least for me) to discern between dark colors when butt up against a pure white edge.
StainlessS
28th December 2016, 07:53
Edited into above post (round them off a bit bigger)
You dont want to get too close to the letters, you will produce visible anomalies, at very least 1 extra pixel
around (as YV12 chroma affects 2x2 pixels, which you may not even be able to see on a black/white frame, also compression artifacts
will likely be present and visible after de-logoing).
Also, can use Block filling mode to black out vast rectangular areas (might actually be best to use eg red or some other color
so that you can see what you are doing, and then a single fill with black and all of the red is gone).
Can also use line drawing rather than single pixel plots.
Yes, Paint will be slower, but I dont usually have any other graphics program installed.
Just use what is best for you.
EDIT: I think has already been mentioned, but best to crop out logo area and fix only that before OverLay()ing back into place,
the delogo-ing will incur a couple of ColorSpace changes at the very least.
TCmullet
28th December 2016, 08:03
Edited into above post
You dont want to get too close to the letters, you will produce visible anomalies, at very least 1 extra pixel
around (as YV12 chroma affects 2x2 pixels, which you may not even be able to see on a black/white frame, also compression artifacts
will likely be present and visible after de-logoing).I gather you mean "don't get too close to the letters *with black*". Yes, I remember (from Delogo/Vdub days) that at least 1 extra pixel, i.e., "fatter" letters. But I perceive that Hello's efforts do that, as well as my efforts to mimic his.
The whole point of my efforts here, even though by changing my mode from "deblend" to "both" and getting impressive results, I want to see if Hello's belief is right; that it can be better by white-outlining the letters (in "fat" fashion) instead of my simple big-block-o-white style. He claims the inpaint logic will be more accurate. (But we won't hear from him tonight, as I suspect he's British and when it's 2am here in ET, it's like 6am+ there. I suspect British because he recently used "colour" instead of the American "color". Hey, he could be in Austral. for all we know.)
StainlessS
28th December 2016, 08:09
You could always try out both methods, a 'suck it and see' approach.
And its currently 07:08 here in the UK :)
TCmullet
28th December 2016, 08:14
but best to crop out logo area and fix only that before OverLay()ing back into place,
the delogo-ing will incur a couple of ColorSpace changes at the very least.What do you mean by "overlaying" back into place? Perhaps you are referring to the Avisynth Overlay function? I don't use that. But what I take away is that delogoing should be done before all other video processing, in the script. I agree, that's what you meant.
StainlessS
28th December 2016, 08:23
If you do not cut out only the area where logo is (and process only that area), then entire frame will be altered during delogo-ing (not just the logo area).
# Return Clip Difference of input clips (amp==true = Amplified, show==true = show background)
Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") {
amp=Default(amp,false)
show=Default(show,false)
c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale()
c1=clip1.subtract(clip2)
c1=(amp)?c1.levels(127,1.0,129,0,255):c1
return (show)?c1.Merge(c2):c1
}
AviSource(...)
ORG=Last
###
... # do delogo stuff
###
ClipDelta(Last,ORG,amp=true)
Will show changes to entire frame.
And Yes, I meant Overlay() back into original position.
EDIT: Leave a significant area (maybe 16 or more pixels all the way around, at least as thick as the lettering) to give the delogoing stuff data to use,
you could then crop away some of that area, taking cropping into account when Overlaying back into position.
TCmullet
28th December 2016, 08:37
You're still confusing me. (Maybe as I've never used Overlay. I HAVE recently used Layer.) There is no positioning of anything. The blackand white analyse frame is the same height and width as all video frames, so there's no positioning if the logo info.
If you're saying that every part of the whited-out logo should have 16 extra pixels white in every direction, then that contradicts what Hello is saying; that you don't want that many in order for inpaint to work the best. I haven't run that ClipDelta function of yours yet, but I'm pretty sure that RmLogo will not touch any pixels that have an analyse mask counterpart that is black and is surrounded by many blacks. That is to say, only the region where the logo is can be affected at all, because the rest of the frame is all black. If I've missed your point, I'm sorry. (It's way too late for me to be up. 2:37am.)
hello_hello
28th December 2016, 13:52
I'm still struggling to grasp the steps. So far I suspect:
1. Use the Painter (which I haven't tried yet) to draw a small frame around the logo area, then quick-draw massive black everywhere except in the small window.
2. Then somehow use the replace color, which you've set "tolerance" value to 80. Uh, that's not 80 *percent* as it's out of 128, not 100. Therefore I'm not grasping what 80 does. Do we first set "new color" to black or to white for first actions?
There must be a cycle of repetitious steps you are going through, probably with new color set to white intially. You are doing it very fast, as in many cycles in a half minute, but you also have apparently doing it for so many years that you are having a hard time codifying it into concrete steps that I can follow, in order to watch it work for me.) You know what to look for when putting mouse on a stray color. Can you please spell this process out explicitly? It will help not only me but EVERYONE who ever reads this and doesn't know graphics programs inside and out like you apparently do.
Update: Okay, I'm trying it out, not without difficulty. Let me report before you respond.
To remove everything around the logo, first left click and drag the mouse across the image to draw a rectangle around the logo (no Paint or Replace Color dialogues open), then use the "Edit/Cut area outside of selection" menu to remove everything outside it (it'll be replaced with black).
For the rest, I just click on a part of the logo/text to select the colour to replace (with the Replace Colour window open) and select white as the replacement colour. 80 just seems like a good tolerance range to begin with. I've not really thought about what it represents exactly, but it's probably luminance range. 0-128 would cover half the possible range. Then again the colour picker only lets you set a luminance of 0-240. Now my head hurts.
Anyway, set it to zero and only the exact colour you select is replaced. Increase the tolerance level a little and slightly lighter and slightly darker shades are also replaced. Sometimes you can set the right tolerance and the text/logo will be replaced with white along with a few pixels more around the edges in a single action. Sometimes you have to reduce the tolerance and replace the colours in the logo/text in a few steps if the difference between the logo/text and background colours isn't all that great. For a completely black background you should be able to crank the tolerance up to 128 and cover the logo/text with white in a single click, because it won't "bleed" into the background.
I always do the text first so the white over the logo/text ends up a few pixels wider then the actual text/logo if possible.
The Replace Colour and Paint Fill functions are the same but different. Replace Colour will replace all matching colour in the image, so if you had a rectangle of black between two rectangles of yellow (for example) Replace Colour would change the colour of both yellow rectangles in one go if you selected to replace yellow.
The Paint Fill function "fills" one colour with another but the tolerance defines where it stops, so you could "fill" one of the yellow rectangles and the black rectangle between them would act as a border, preventing the second yellow rectangle from being filled at the same time. So the Paint "fill" function could make the left yellow rectangle green and the right one blue (for example) whereas Replace Colour could only change both yellow rectangles to another colour. Hopefully that makes sense.
Whether you'd use Paint's "fill" or Replace Colour depends which one gives you the result you want. There's no rule. ;)
Most of Irfanview's editing functions can also be limited to a specific area of the image. Just like you'd draw a rectangle around an area of an image with the left mouse button to use the Edit/Crop or Edit/Cut function, you can draw a rectangle the same way, and any edit functions will only effect the contents of that rectangle. Everything else will be untouched.
Yes it's really annoying Irfanview only has one "undo" level. I don't know why. Maybe it's to keep it working on computers with limited RAM. The Paint function is limited to Irfanview's single "undo". The Replace colour function lets you undo all of it's changes, but there's no rolling back one change at a time. Try clicking the "apply to image" button to replace multiple colours and don't click "okay" till you're happy.
You can use Irfanview to help determine the coordinates for the logo area too if you like. Draw a rectangle around the logo and Irfanview will display the left and top coordinates of that rectangle as "selection" in the Title bar. That's followed by the dimensions of the rectangle and it's aspect ratio.
https://s27.postimg.org/b3cpr3xwj/image.jpg
hello_hello
28th December 2016, 14:11
If you're saying that every part of the whited-out logo should have 16 extra pixels white in every direction, then that contradicts what Hello is saying; that you don't want that many in order for inpaint to work the best.
I think he means if you cut out an area around the logo and process only that area, make it wider than the logo by at least 16 pixels all round because the surrounding pixels are used for painting etc.
I assume StainlessS is referring to RM_Logo converting the whole image to RGB rather than just the logo area? I'm not really sure. I can't say I've ever considered caring enough to worry about it, as I invariably follow the logo removal with noise removal (often QTGMC in progressive mode) maybe a little sharpening and usually dithering, so a conversion to RGB and back would be the least of it. Maybe I should care, but hopefully StainlessS will clarify.
hello_hello
28th December 2016, 14:49
A few quick tests using your sample and your original bitmap (test1) compared to this bitmap (test2):
https://s30.postimg.org/esqzp6q8h/test2.jpg
rm_logo(logomask="D:\test1.bmp", loc="tl", mode="Deblend", cutwidth=420, cutheight=160, percent=100)
https://s30.postimg.org/5hemkprup/test1a.jpg
rm_logo(logomask="D:\test2.bmp", loc="tl", mode="Deblend", cutwidth=420, cutheight=160, percent=100)
https://s30.postimg.org/mlrc9nadd/test2a.jpg
rm_logo(logomask="D:\test1.bmp", loc="tl", mode="Both", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=180)
https://s30.postimg.org/w3r39ow1t/test1b.jpg
rm_logo(logomask="D:\test2.bmp", loc="tl", mode="Both", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=180)
https://s30.postimg.org/df91md54x/test2b.jpg
rm_logo(logomask="D:\test1.bmp", loc="tl", mode="InPaint", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=150)
https://s30.postimg.org/6z02w9wld/test1c.jpg
rm_logo(logomask="D:\test2.bmp", loc="tl", mode="Inpaint", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=150)
https://s30.postimg.org/53dal47r5/test2c.jpg
Well.... I've never really looked too deeply at how RM_Logo works, and I guess I must use mode=both more than anything else. I remembered the way the mask is created having the most effect on the result for mode=Inpaint, but for that it seems to make almost no difference. At least in this case. It effects mode=Deblend and mode=both more. I don't fully understand why.
I've always created a bitmap by making just the logo/text white, rather than create blocks of white, unless the latter looks better for a particular job, which sometimes it does. Only because that's the way I've always done it.....
hello_hello
28th December 2016, 15:31
I've no idea why sometimes the repair masks are green in debug mode. I've decided to pretend it hasn't happened from this point forward. Green?? What green was I talking about.....
Click on thumbnails for larger image. I didn't want to force sideways scrolling to read the thread.
rm_logo(logomask="D:\test1.bmp", loc="tl", mode="Deblend", cutwidth=420, cutheight=160, percent=100, Debug=True)
https://s29.postimg.org/3zd8di7oz/test1d.jpg (https://postimg.org/image/3zd8di7oz/)
rm_logo(logomask="D:\test2.bmp", loc="tl", mode="Deblend", cutwidth=420, cutheight=160, percent=100, Debug=True)
https://s29.postimg.org/5gyop2cfn/test2d.jpg (https://postimg.org/image/5gyop2cfn/)
rm_logo(logomask="D:\test1.bmp", loc="tl", mode="Both", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=200, Debug=True)
https://s29.postimg.org/8zaolgdbn/test1e.jpg (https://postimg.org/image/8zaolgdbn/)
rm_logo(logomask="D:\test2.bmp", loc="tl", mode="Both", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=200, Debug=True)
https://s29.postimg.org/4auoq9o4z/test2e.jpg (https://postimg.org/image/4auoq9o4z/)
TCmullet
2nd January 2017, 00:17
... as I invariably follow the logo removal with noise removal (often QTGMC in progressive mode) maybe a little sharpening and usually dithering...Though this is a little off point, I would greatly appreciate if you kindly give sample call(s) that you use to QTGMC, as well as a sharpening call and dithering. So far, I'm only a bit familiar with aWarpSharp, which is very limited in usefulness. I never used QTGMC, and I don't even know what dithering is. Don't you think my source footage could use some NR?
TCmullet
2nd January 2017, 02:01
Even using your tiny video sample, this took me about 90 seconds with Irfanview. I'm not saying it's perfect, but I wasn't bothering with that for this example. It shouldn't take too long though.I don't have it and probably will never get it down to 90 seconds. But between your very helpful procedural suggestions, my own half-blind experimentation (before your last major post on this), and subsequent thinking and experimenting, I think I have a procedure nailed down that is finite and reasonably quick once you practice it a few times (mainly getting used to this part of IrFanView). First I'll show off my results. Other than using IrFanView's "cut selection" at the end, to black out all remaining traces of non-black-non-white, it involves only 2 executions of "Replace Color". Uh, there was some necessary trials and undos, which I'll cover.
https://s30.postimg.org/dy7zfeqdd/2016_12_02_1930_wv_Tx_Rgv_v_TX_logoanal_1st_Rnd4_s.jpg
Pretty slick-looking, eh? (Yes, I'm a bit proud of it.)
Anyway, set it to zero and only the exact colour you select is replaced. Increase the tolerance level a little and slightly lighter and slightly darker shades are also replaced.
This was a key stimulus for me. Yes, the "tolerance value" in IrFanView is (I'm sure) in terms of luminance, at least for purposes of this discussion. (We speak of luminance as when all three of R, G and B are the same value; grey.)
In reality, what we're given here in "Replace color" is not exactly what we would prefer. We'd like it to be in only one direction, not both "lighter" and "darker". We want to set the new color to pure white (255, 255, 255), then pick a source color (via the "choose" button) and a tolerance value that will color white all values from 255 down to a certain point. I'll illustrate what I did for my mask above.
TURN THE LOGO TO WHITE (plus a bit more):
Let's say I want to color all to white everything that is within the range 255 down to 105. At least let's try it. To do that I need to pick the halfway point, 180 and choose 180,180,180 as the grey color in "source color". Then I set the Tolerance value to 75, as 180 plus and minus 75 gives the range of 105 to 255 that we want to transform into white. It would be nice if I could set a new color as 255,255,255 and simply have a downward tolerance of 150, but IrFanView isn't set up for that. This algorithm adapts to that.
To carry this out, you have to write it down:
Top Bottom Grey-shade Tolerance
255 105 180 75
Halfway from top (255) to bottom (105) is 180, and that distance is our tolerance value of 75. I execute it via the "Apply to original image" button. This converts to white all values from 105 thru 255. I can see that the lettering in the logo is not bold enough, that is, the white pixels don't bleed outward a few pixels from the edges of the letters. So I click "undo" to restore to the original state and try Top and Bottom as 255, 85, adding this line to the table:
Top Bottom Grey-shade Tolerance
255 105 180 75
255 85 170 85
I think the reason we're having to go so greatly toward the dark end of the light spectrum (85 is rather dark for a grey) is that the logo frame was lifted (rightly so) as one that had as much of it's background as something dark.
I did this trial conversion 5 times:
Top Bottom Grey-shade Tolerance
255 105 180 75 x
255 85 170 85 x
255 65 160 95 okay
255 45 150 105 okay
255 25 140 115 x
(Please forgive if the columns don't line up perfectly; haven't figure that out yet.)
In the first two, the white wasn't bleeding enough. The 3rd and 4th were pretty good. After the 4th, I suspected that the next one would be bad. Yes, it was terrible. I could have tried values between the 3rd and 4th line, but I felt the 4th line was as good as it would get, so I ran with it. That is, after doing each test followed by an "undo", I did the 4th line freshly again, with NO undo afterward.
UPDATE: I've since done a couple more logos, and sometimes there needs to be more precision. So I'm reproducing the "help" table a bit bigger: Just remember that your goal is to pull just 2 things from the correct line, the Grey-shade and the Tolerance for plugging into Irfanview's Replace Color function. I've filled in the acceptable grey-shade values between 150 and 140. Notice that they HAVE to be even values. (I'll leave the reason for you to figure out, if curious.)
Top Bottom Grey-shade Tolerance
255 105 180 75
255 85 170 85
255 65 160 95
255 45 150 105
255 41 148 107
255 37 146 109
255 33 144 111
255 29 142 113
255 25 140 115
TURN NON-LOGO AREAS TO BLACK:
Turning all the rest to black is relatively simple, but still convoluted because of IrFanView's design.
Set the "new color" to black (0,0,0). We want all values that are not already pure white to be turned to black. That is, turn everything from 0-254 to black. We don't need a chart, as there's only one line.
Source color is 127,127,127, and Tolerance value is 127.
You can see that adding 127 to source gives 254 (the upper end of our target range) and subtracting it gives zero (the lower end of our target range); perfect. "Apply that to original image" and the replace color steps are done! I supposed my chart would have looked very different had the logo been on a lighter background. But I won't speculate about the feasibility of success with that (but it might be good to research as there may be cases where you can't find a good dark-background snapshot).
All that's left now is "cut selection" a handful of times all over the place to black out all stray white blotches, save it to another .bmp, and we're done!
For my video, it seemed to work very well. I have a few other contributions to add in separate posts.
TCmullet
2nd January 2017, 02:36
Another question I've not seen addressed. (Please forgive if obvious.) In Vdub's Delogo, provision was made to include just ranges of frames you specify for final processing. I see nothing of that here. It made me wonder if this filter is able to be applied even where there is no logo, with no harm. In Delogo/Vdub, it DOES cause GREAT harm to non-logoed frames.
Is it totally up to me to devise a mechanism of applying or not applying rm logo to a given frame?? The videos I'll be tackling, including the video from which I supplied an 8-sec test clip here, have it cut in and out A LOT! Not like for example most movies.
Use Trim.
Trim(0,1000)\
++Trim(1001,2000).rm_logo(logomask="E:\test.bmp", loc="tl", mode="Both", cutwidth=420, cutheight=160, percent=100, AlphaToRepair=160)\
++Trim(2001,3000)
If you use logo removal for more than one range of frames I'm pretty sure only the first will be used for the analysis. Often that's enough, otherwise you can create a copy of the bitmap with a different name for each frame range requiring logo removal.
I would always have a separate block of code to execute for analysis, rather than relying on "only the first [range] will be used for analysis". It would have the trimmed sections together JUST for analysis purposes. Once that .ebmp file is created, then I simply include that file with the project. A couple reasons to do this are:
1. I don't feel we need to do analysis on ALL (or even a percentage of all) of the frames that have the logo. I did this for analysis:
as1=trim(11297,12580)
as2=trim(12873,13421)
as3=trim(13586,15001)
as4=trim(15213,17754)
as5=trim(17967,22144)
as1 ++ as2 ++ as3 ++ as4 ++ as5 # this is 5:32, or 9960 frames
2. I often will APPLY the removal to some frames that would not qualify for analysis. Things like when the logo is part of a fade-in or fade-out. Of course in those cases, you still need to inspect the result of removal for each transitional frame. In some situations it's awful, but others it's fine. I think the fine cases are when you're including inpainting (mode="both").
I decided to hunt for a more elegant method of selecting ranges to delogo, as I have MANY ranges, sadly.
I discovered that Avisynth has the ApplyRange function. But it has a warning: "In cases where a large number of ranges need processing, calling ApplyRange many times may cause resource issues." Well, that's disappointing as I know I'll have LOTS of ranges (which I'm not greatly happy about having to track down). I do wish they could have given an estimate of how many calls I could do before having problems and what kind thereof. But maybe it's too variable to forecast that.
The suggested alternative is a special usage of "ConditionalFilter" and "ConditionalReader". I almost went with it after studying it real hard (the way it works is not real conventional), but then elected against it, as it would require a separate file to hold the ranges. One of the things I like about Avisynth is having everything documented in one place, the avs file. So I looked around within my own set of dusty custom functions, and got inspiration to write this function:
function myRmLogo(clip c, int fstart, int fend)
{
# Accepts fend=0, to last frame
fend = (fend==0) ? c.FrameCount-1 : fend
before = (fstart>0) ? c.Trim(0, -fstart) : c.BlankClip(Length=0)
current = c.Trim(fstart, fend)
after = (fend+1<c.FrameCount) ? c.Trim(fend + 1, 0) : c.Blankclip(Length=0)
current
rm_logo(logomask="2016-12-02.1930.wv.TxRgv-v-TX.logoanal-1stRnd4.bmp",\
loc="tl", cutwidth=395, cutheight=140, mode="both", percent=100,\
pp=1,\
AlphaToRepair = 130, \
debug=false)
current = last
before ++ current ++ after
return last
}
I would like to assume that this would not cause the "resource problems" alleged for ApplyRange. It does work.
TCmullet
2nd January 2017, 02:50
My video is 1 hr 30 min. long. Source is MP4/H.264, and frame size is 1336 x 752. (I have reasons to leave it at that size without resizing or reshaping in any way.)
I cut sections (commercials) out with:
loop(0,28872,31568)
loop(0,36443,39140)
loop(0,47905,50606)
loop(0,61463,64161)
loop(0,76240,78939)
loop(0,88003,91604)
loop(0,95024,98623)
loop(0,118733,121429)
loop(0,125689,128387)
loop(0,136894,999999)
#loop(0,,)
#loop(0,,)
#loop(0,,)
(I'm showing this for a reason.)
I don't type these numbers in. I would guess that most Avisynth users have already figured out how to avoid this. If not, here's what *I* discovered. I was a heavy VirtualDub user. But now I use it only for a GUI and encoder where the input file is my Avisynth script. When I find the starting edit point, I:
1. Mark it with the "mark in" button.
2. Ctrl-G for "go to frame" BUT it has the nice extra feature that the CURRENT frame you're sitting on is already sitting in the input field PLUS it's been selected for you.
3. Ctrl-C to copy that frame number into the Windows clipboard. Press Enter to exit "go to" mode.
4. Select my Notepad window containing my script. My line says:
#loop(0,,)
so I position cursor (via the mouse) after the first comma, and press Ctrl-V, which pastes the frame number into it. Example:
#loop(0,28872,)
5. Find the last frame to delete and (optionally) press the "mark out" button.
6. Ctrl-G,Enter,Ctrl-V THAT number into the script so you have:
#loop(0,28872,31568)
You delete the "#", save the file, then in Vdub, press the "[" key to take you to the mark in point. Press F2 to re-open the script in Vdub. You'll see the first frame AFTER your delete-range has been deleted, pop into view.
There was no typing of numbers. Whew! Once you do dozens of them, you do the steps almost without thinking, and quickly.
TCmullet
2nd January 2017, 02:54
I have tediously finished identifying my frame-ranges to do logo-removal against, using the function myRmLogo I wrote:
myRmLogo(11403,12583)
myRmLogo(12855,13439)
myRmLogo(13585,22146)
myRmLogo(22324,23227)
myRmLogo(23703,24111)
myRmLogo(24331,25587)
myRmLogo(25815,26499)
myRmLogo(26730,28869)
myRmLogo(32723,38745)
myRmLogo(42770,45097)
myRmLogo(45319,48416)
myRmLogo(49693,52657)
myRmLogo(58455,61596)
myRmLogo(61899,68182)
myRmLogo(68383,69556)
myRmLogo(73382,73554)
myRmLogo(73773,77640)
myRmLogo(77928,83967)
myRmLogo(84316,86670)
myRmLogo(89738,91523)
myRmLogo(91894,100926)
myRmLogo(120872,124746)
myRmLogo(125231,125569)
myRmLogo(125800,130225)
myRmLogo(130498,133261)
myRmLogo(133547,137804)
myRmLogo(138032,139428)
myRmLogo(142979,149083)
myRmLogo(152398,161191)
#myRmLogo(
#myRmLogo(
#myRmLogo(
Whew! You can see I have a lot! I use the same GUI steps as when find ranges of frames to delete. You can see that this list is much longer than my list of frame-delete ranges. Therefore it was important to devise a way that would allow me very quick-n-easy setup of the ranges.
TCmullet
2nd January 2017, 03:30
I have both the analysis logic AND the final run logic in the same script file, but comment out the analysis logic before even scripting the rest. It's valuable to keep it there, safely for future re-use if necessary. (I don't like separate scripts if not necessary.)
Here is my order:
# Open the video and audio files (preceded by any SetMemory, globals, loadplugins, etc. but NOTHING that would invoke multi-threading)
function myRmLogo(clip c, int fstart, int fend)
{}
# RmLogo analysis logic (set of trims plus one rm_logo call)
__END__ # During analysis, the script should stop here.
# When your analysis work is all done, comment out the "Rmlogo analsys logic and this END statement
# All the logo removal ranges as specified with that long list of myRmLogo function calls.
(It's valuable to do the logo removal against a clip that has had NO frames deleted yet, as you will find that simultaneously opening the file in a program like AviDemux allows more rapidly moving through the file to find the desired ranges, which would be impossible to identify for adding to your script if all the ranges have changed their frame-numbers due to trimming, etc. My MP4s are H.264 and are all encoded to a GOP-size of 8 ***SECONDS***! This is way too long, but I can't change it now. So the tools I use to open the file (DGSource / DGIndexNV) do not allow rapidly scrolling through a file with such a huge GOP-size via the Virtualdub timeline.)
# Do any form of "SetMTMode(3,threads)" for the rest of your script. (You must not have MT (multithreading) active when running rm_logo.)
# The rest of your script. For me, this includes sound processing, all those range deletions (the "loops"), picture tuning, graphics, etc.
-------
And just so you know, my script without any RmLogo will take 7.3 hours to run. It's using InterFrame logic, which takes lots of CPU and GPU power. With the Rm_logo work, it will take... actually, I can't determine that, which I'll explain in a moment.
I settled on AlphaToRepair of 130. I had experimented with values, 80, 90, etc. up to about 150, then 180. I used the debug mode to watch the effect across various types of background in my analysis ranges. As you go up (which includes more inpaint emphasis) the processing slows WAY down, as evidenced by taking longer in debug via Vdub to step to the next frame. I wanted to have it as low as possible to speed things up. But that partial inpainting (mode="both") is really necessary for some backgrounds of the logo. The default of 130 seemed to be the best tradeoff, at least for me. Gosh, I might not live long enough to watch finish a run with 200!
Vdub is telling me that my script WITH rm_logo will take 7.5 hours to finish. BUT this is not accurate as it's only 3500 frames into the run, and the first rm_logo range doesn't get hit til 11,403. When that hit's it's gonna turn to frozen molasses, I fear! I will definitely move this to my faster PC.
Update #1: Oops, it did NOT slow down when it hit 11,403. But I know why. The very last thing in my script is a call to InterFrame, which (in this case) DOUBLES the total frame count as revealed by Virtualdub. So I need to wait til it hits 22,806 before I reevaluate how long it could take. An accurate estimate will still be unknown as it's slow during the logo ranges, but fast during the rest.
Update #2 (life after 22,806): The video rendering rate dropped from 10.x fp to about 3.9 fps. Not nearly as bad as I had expected. Current estimate has creeped up to 8:15, but will fluctuate as it hits pockets of rm_logo work. It's nice that an upper limit can be derived by comparing 10.x to 3.9, maybe around 2.5 times.
Update #3: I did move it to my "faster" PC. Faster in that it's a Xeon 4-core 8-thread, whereas the former is i5 4-core. But the 4 extra hyperthreads made no difference, and I think it was actually a little slower in terms of fps. But I kept it there, and it finished in just under 14 hours. I'm happy that it was less than double of what it would take without Rm_logo.
hello_hello
2nd January 2017, 14:33
Wow.... a lot of information there. I'll have to return and read it all properly later.
Though this is a little off point, I would greatly appreciate if you kindly give sample call(s) that you use to QTGMC, as well as a sharpening call and dithering. So far, I'm only a bit familiar with aWarpSharp, which is very limited in usefulness. I never used QTGMC, and I don't even know what dithering is. Don't you think my source footage could use some NR?
QTGMC(InputType=1, Preset="Medium", EzDenoise=1.5)
QTGMC in progressive mode as above is good for stabilising the picture if need be, as well as removing noise. I tend to use it for denoising the most but it's all personal taste.
MCTemporalDenoiseMod and SMDegrain are the other two de-noising scripts I'd be likely to use.
MCTemporalDenoiseMod uses LSFMod for sharpening so you don't need to add it again, just adjust the amount of sharpening with MCTemporalDenoiseMod's settings. SMDegrain also has sharpening options and can use LSFMod.
For dithering I just add gradfun3() to the end of the script most of the time.
QTGMC
http://avisynth.nl/index.php/QTGMC
https://forum.doom9.org/showthread.php?t=156028
https://forum.doom9.org/showpost.php?p=1732845&postcount=2041
Everything's out of date. The plugins in the zip file should work, but it'd be a good idea to follow the individual plugin links or search for each plugin and check for newer versions. RemoveGrain is listed as a required plugin, but ignore that and use RGTools instead. http://avisynth.nl/index.php/RgTools
MCTemporalDenoiseMod
http://avisynth.nl/index.php/MCTemporalDenoise
Scroll down to the bottom of the page and follow the link to the mod version.
SMDegrain
http://forum.videohelp.com/threads/369142-Simple-MDegrain-Mod-v3-1-2d-A-Quality-Denoising-Solution?p=2413356&viewfull=1#post2413356
LSFMod
http://avisynth.nl/index.php/LSFmod
Dither Package
https://forum.doom9.org/showthread.php?p=1386559#post1386559
http://avisynth.nl/index.php/Dither_tools
Use the dfttest 1.9.4 and MVTools 2.6.0.5 plugins linked to on the Dither Tools thread in preference to any other versions (if other scripts require the same plugins), this flavour of MaskTools2 (http://avisynth.nl/index.php/MaskTools2) and once again RemoveGrain is replaced with RGTools.
The above scripts are generally quite slow, except for gradfun3 and maybe SMDegrain's defaults.
You might want to try the AVS Cutter (http://www.videohelp.com/software/AVSCutter) 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.
I'm out of time. I'll have to return a bit later. I haven't got my head around the myrmlogo function your created yet, but I want to check it out later.
StainlessS
2nd January 2017, 15:26
Sorry guys, was giving you a bum steer earlier (was confusing InPaintFunc.avs and Rm_Logo.avs),
RM_logo alters only the selected loc location, whereas InPaintFunc affects entire frame.
eg
# Return Clip Difference of input clips (amp==true = Amplified, show==true = show background)
Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") {
amp=Default(amp,false)
show=Default(show,false)
c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale()
c1=clip1.subtract(clip2)
c1=(amp)?c1.levels(127,1.0,129,0,255):c1
return (show)?c1.Merge(c2):c1
}
LoadCPlugin("AvsInpaint.dll")
Import("InPaintFunc.avs")
Import("Rm_Logo.avs")
Avisource("Test.avi")
ORG=Last
SHOW=False
FN="D:\Z\Test.BMP"
#InPaintFunc(FN,"TR",Show=Show)
Rm_Logo(FN,"TR",Debug=SHOW)
ClipDelta(ORG,Last,True) # Amplify difference
Spline36Resize(640,360) # For PhotoBucket
Produces below with RM_Logo
https://s20.postimg.cc/47g57c4u5/Clip_Delta_zpsuz1wqdr3.jpg (https://postimg.cc/image/d2gzhutmh/)
EDIT: InPaintFunc
https://s20.postimg.cc/6q1u80qkd/Clip_Delta2_zpsdjwhidwr.jpg (https://postimg.cc/image/az6ka6ttl/)
StainlessS
2nd January 2017, 18:23
There seems to be a bug in DeblendLogo() [Below, lines added into rm_logo in blue]
# 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
RepairMask = ( RepairRadius > 0.1 ) ? DistanceFunction( 84.0 / RepairRadius, PixelAspect=par ) : last
# FOLLOWING 3 LINES INSERTED for debug purposes
#return Repairmask.ConvertToYV12 # Returns Black mask
deblend = input.DeblendLogo(LogoColor,LogoAlpha) # Isolated from ternary conditional a few lines further on (for mode=both)
return Repairmask.ConvertToYV12 # returns Green Mask with light green line down right hand side
Looks like somehow calling DeblendLogo alters contents of Repairmask (and the weird green frames which are reason I never used this script).
EDIT: Call on alpha blended logo, eg Rm_Logo("D:\Z\Test.BMP","TR",Debug=true)
TCmullet
2nd January 2017, 18:48
Minor point (unless I'm mistaken): There is no "DeblendLogo()" function. But you imply there is by having "()" after this fictitious name.
Major point: When I look at my rm_logo source code (.avsi), I found the section you quote, in which you added your blue debugging code. Are you able to tell us what line or lines of code are incorrect and what they ought to be?
StainlessS
2nd January 2017, 18:51
DeblendLogo() is a function in the C plugin dll [and also where the error resides].
EDIT: Look a few lines after the inserted ones, you will find call to DeblendLogo() [which I just extracted from the ?: conditional
so as to make more obvious what is happening].
EDIT: for default mode="both"
# 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
hello_hello
2nd January 2017, 19:39
Would it be hard to modify the InPaintFunc script so it doesn't convert the whole frame to RGB? Mind you I can't say I've noticed a quality loss as I invariably follow InPaintFunc with other filtering, and much of the time the video requiring logo removal is somewhat ordinary quality anyway. I sometimes wonder why I'm bothering with the logo removal in the first place.... :)
StainlessS,
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, as in my earlier screenshots, but I've become good at pretending it doesn't happen. Would they effect the output?
It's really late here (Australia) and my brain switched off an hour ago, so I'll converse again tomorrow.
StainlessS
2nd January 2017, 20:08
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.
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
# 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.
TCmullet
2nd January 2017, 21:19
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-02.1930.wv.TxRgv-v-TX.Rnd1.RMLOGO-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
2nd January 2017, 21:44
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?
StainlessS
2nd January 2017, 21:53
Hopefully, Yes. :)
EDIT: Calling/not calling DeblendLogo(), altered what would end up in unprocessed chroma channels.
TCmullet
3rd January 2017, 00:50
You might want to try the AVS Cutter (http://www.videohelp.com/software/AVSCutter) 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.
StainlessS
3rd January 2017, 02:22
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.
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.
TCmullet
3rd January 2017, 05:06
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.)
StainlessS
3rd January 2017, 05:28
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.php?p=1772115#post1772115
hello_hello
3rd January 2017, 05:56
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.
https://s24.postimg.org/r9i95putx/Me_GUI_AVSCutter.gif
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 (http://www.videohelp.com/software/AvsP). 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.
hello_hello
3rd January 2017, 06:30
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-02.1930.wv.TxRgv-v-TX.Rnd1.RMLOGO-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
3rd January 2017, 06:34
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!
StainlessS
3rd January 2017, 15:43
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
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
}
hello_hello
3rd January 2017, 22:10
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.
StainlessS
3rd January 2017, 23:56
Thanx, HH, for your consideration, we do try, perhaps not hard enough.
hello_hello
4th January 2017, 09:18
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 (https://forum.doom9.org/showthread.php?t=173640) 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....
StainlessS
12th January 2017, 13:26
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.php?p=1772115#post1772115
TCmullet
13th January 2017, 23:22
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.
hello_hello
14th January 2017, 07:56
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.
hello_hello
14th January 2017, 08:02
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.
pcroland
14th January 2018, 07:43
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?
StainlessS
14th January 2018, 16:34
I think you need something like this
LoadPlugin("...Avisynth_c.dll")
Load_Stdcall_Plugin("...AVSInpaint.dll")
Mask should be black/white only.
EDIT: Perhaps a little info here of some interest:- AutoLoadPlugs.AVSI
https://forum.doom9.org/showthread.php?p=1641795#post1641795
EDIT:
Non CPP v2.5/v2.6 plugs that I have
C v2.0 plugs
AVSCurveFlow.dll
AVSShock.dll
equlines.dll
IBob.dll
SmartDecimate.dll
Transition.dll
C v2.5 plugs
AVSInpaint.dll
yadif.dll
C++ v2.0 plugs
SmartSmoothYuy.dll
EDIT: Avisynth Plugins:- http://avisynth.nl/index.php/Plugins
pcroland
15th January 2018, 23:16
Thanks for the answer but it still does not work: https://vgy.me/59MSTK.png Should I install that autoload script?
StainlessS
15th January 2018, 23:40
AvsInPaint.dll requires MSVCP60.DLL (Standard with XP), maybe you are missing it.
See:- http://www.tomshardware.co.uk/forum/20055-45-install-vital-file-msvcp60
IGNORE ALL ABOVE
EDIT: Sorry, was talking rubbish, you dont need C v2.0 loader for AvsInpaint, this works for me
LoadCPlugin("C:\Program Files\AviSynth\plugins\C v2.5 Plugins\AVSInpaint.dll")
Colorbars.killaudio
Return last
AvsInPaint.dll that I have is 56,832 bytes.
EDIT: Call AvsMeter on above script, see what it says.
lansing
16th January 2018, 00:01
This is clearly rule 6 violation
pcroland
16th January 2018, 00:09
AvsInPaint.dll requires MSVCP60.DLL (Standard with XP), maybe you are missing it.
See:- http://www.tomshardware.co.uk/forum/20055-45-install-vital-file-msvcp60
EDIT: Sorry, was talking rubbish, you dont need C v2.0 loader for AvsInpaint, this works for me
LoadCPlugin("C:\Program Files\AviSynth\plugins\C v2.5 Plugins\AVSInpaint.dll")
Colorbars.killaudio
Return last
AvsInPaint.dll that I have is 56,832 bytes.
EDIT: Call AvsMeter on above script, see what it says.
This is the mask: https://vgy.me/n6hUcM.bmp
And this is the error that I get now: https://vgy.me/c9Eaho.png
My AVSInpaint is 57 344 bytes btw.
AVSMeter:
Unable to load C Plugin: C:\Program Files\AviSynth\plugins\C v2.5 Plugins\AVSInpaint.dll
(C:\Users\pcroland\Desktop\avstest.avs, line 1)
StainlessS
16th January 2018, 00:21
I Cannot access either of those links (Firefox will not allow it), also cannot now access your previous links.
Cant you just post it in text. [EDIT: Secure connection Failed, maybe security certificate expired]
Here my version AVSInpaint-2008.02.23.zip :- http://www.mediafire.com/file/8pudi2p55hzu0jx/AVSInpaint-2008.02.23.zip
EDIT: AvsInpaint.dll does not get a mention @ Avisynth.nl external functions, list (dont know if mine is latest version).
pcroland
16th January 2018, 00:25
I Cannot access either of those links (Firefox will not allow it), also cannot now access your previous links.
Cant you just post it in text.
Here my version AVSInpaint-2008.02.23.zip :- http://www.mediafire.com/file/8pudi2p55hzu0jx/AVSInpaint-2008.02.23.zip
vgy.me went down, right now :D
Error with AVSInpaint 02.23:
Not An Avisynth 2 C Plugin: C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll
(C:\Users\pcroland\Desktop\asd.avs, line 2)
StainlessS
16th January 2018, 00:34
What does AvsMeter say on same script ?
EDIT: ie this script, not your bigger one
LoadCPlugin("...\AVSInpaint.dll")
return Colorbars
pcroland
16th January 2018, 00:37
AviSynth script:
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\AviSynth_C.dll")
LoadCPlugin("C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll")
DirectShowSource("X:\DL\nowarez_homefootage.ts")
ConvertToYV12()
GradFun3(thr=0.5, radius=12, mask=2, mode=0, smode=0, debug=0, lsb=False, lsb_in=False, staticnoise=False, y=3, u=3, v=3)
xlogo("C:\Users\pcroland\Desktop\logo.bmp",180,860,30)
Spline36ResizeMod(1280,720)
AVSMeter log:
AVSMeter 2.7.0 (x86) - Copyright (c) 2012-2017, Groucho2004
AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Not An Avisynth 2 C Plugin: C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll
(C:\Users\pcroland\Desktop\asd.avs, line 2)
AviSynth script:
LoadCPlugin("C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll")
return Colorbars
AVSMeter log:
AVSMeter 2.7.0 (x86) - Copyright (c) 2012-2017, Groucho2004
AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Not An Avisynth 2 C Plugin: C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll
(C:\Users\pcroland\Desktop\avstest.avs, line 1)
StainlessS
16th January 2018, 01:01
No idea.
How bout this,
With AvsInPaint.dll and Yadif.dll, and RT_Stats.dll(v2.6) in plugins directory,
and on commond line ("C:BIN" in Path environment variable and AvsMeter in C:BIN\)
AvsMeter -AvsInfo
I get this
D:\>avsmeter -avsinfo
AVSMeter 2.7.0 (x86) - Copyright (c) 2012-2017, Groucho2004
VersionString: AviSynth 2.60, build:Mar 31 2015 [16:38:54]
VersionNumber: 2.60
File / Product version: 2.6.0.6 / 2.6.0.6
Interface Version: 6
Multi-threading support: No
Avisynth.dll location: C:\WINDOWS\system32\avisynth.dll
Avisynth.dll time stamp: 2015-03-31, 06:40:58 (UTC)
PluginDir2_5 (HKLM, x86): C:\Program Files\AviSynth\plugins
[C 2.5 / 32 Bit Plugins]
C:\Program Files\AviSynth\plugins\AVSInpaint.dll [2008-02-23]
C:\Program Files\AviSynth\plugins\yadif.dll [1.7.0.0]
[CPP 2.6 / 32 Bit Plugins]
C:\Program Files\AviSynth\plugins\RT_Stats26.dll [2017-10-13]
[Plugin errors]
______________________________________________________________________________
Plugin C:\Program Files\AviSynth\plugins\AVSInpaint.dll is not an AviSynth 2.6 o
r 2.5 plugin.
Note: C-Plugins must be loaded explicitly with "LoadCPlugin()"
______________________________________________________________________________
Plugin C:\Program Files\AviSynth\plugins\yadif.dll is not an AviSynth 2.6 or 2.5
plugin.
Note: C-Plugins must be loaded explicitly with "LoadCPlugin()"
______________________________________________________________________________
D:\>
EDIT: Thisis what I got with the short script
D:\>avsmeter a.avs
AVSMeter 2.7.0 (x86) - Copyright (c) 2012-2017, Groucho2004
AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Number of frames: 107892
Length (hh:mm:ss.ms): 00:59:59.996
Frame width: 640
Frame height: 480
Framerate: 29.970 (30000/1001)
Colorspace: RGB32
Audio channels: 2
Audio bits/sample: 32 (Float)
Audio sample rate: 48000
Audio samples: 172799827
Script runtime is too short for meaningful measurements
D:\>
StainlessS
16th January 2018, 01:08
If you have avisynth_c.dll in plugins directory TAKE IT OUT OF THERE, it hijacks the LoadCPlugin function name for v2.0 C Plugins.
Think that will solve the problem. :)
EDIT: Perhaps Groucho2004 would like to look further at this problem, to see if can detect such an event, and give correct diagnosis.
pcroland
16th January 2018, 01:10
AVSMeter 2.7.0 (x86) - Copyright (c) 2012-2017, Groucho2004
VersionString: AviSynth 2.60, build:Mar 31 2015 [16:38:54]
VersionNumber: 2.60
File / Product version: 2.6.0.6 / 2.6.0.6
Interface Version: 6
Multi-threading support: No
Avisynth.dll location: C:\WINDOWS\SysWOW64\avisynth.dll
Avisynth.dll time stamp: 2015-03-31, 06:40:58 (UTC)
PluginDir2_5 (HKLM, x86): C:\Program Files (x86)\AviSynth\plugins
[C 2.5 / 32 Bit Plugins]
C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll [2008-02-23]
[CPP 2.0 / 32 Bit Plugins]
C:\Program Files (x86)\AviSynth\plugins\LogoTools.dll [2003-11-05]
[CPP 2.5 / 32 Bit Plugins]
C:\Program Files (x86)\AviSynth\plugins\AddGrainC.dll [1.5.2.0]
C:\Program Files (x86)\AviSynth\plugins\Average.dll [2007-12-16]
C:\Program Files (x86)\AviSynth\plugins\AviSynth_C.dll [2004-01-01]
C:\Program Files (x86)\AviSynth\plugins\avss.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\avstp.dll [1.0.1.0]
C:\Program Files (x86)\AviSynth\plugins\aWarpSharp.dll [2012-03-28]
C:\Program Files (x86)\AviSynth\plugins\bifrost.dll [2013-11-09]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.dll [2003-11-04]
C:\Program Files (x86)\AviSynth\plugins\ColorMatrix.dll [2.5.0.0]
C:\Program Files (x86)\AviSynth\plugins\Deen.dll [2003-01-19]
C:\Program Files (x86)\AviSynth\plugins\delogo.dll [0.0.5.0]
C:\Program Files (x86)\AviSynth\plugins\dfttest.dll [1.8.0.0]
C:\Program Files (x86)\AviSynth\plugins\DGDecode.dll [1.5.8.0]
C:\Program Files (x86)\AviSynth\plugins\DirectShowSource.dll [2.5.8.6]
C:\Program Files (x86)\AviSynth\plugins\dither.dll [2014-09-23]
C:\Program Files (x86)\AviSynth\plugins\Dup.dll [2007-11-20]
C:\Program Files (x86)\AviSynth\plugins\EEDI2.dll [0.9.2.0]
C:\Program Files (x86)\AviSynth\plugins\eedi3.dll [0.9.1.0]
C:\Program Files (x86)\AviSynth\plugins\exinpaint.dll [0.2.0.0]
C:\Program Files (x86)\AviSynth\plugins\FFT3DFilter.dll [2.1.1.0]
C:\Program Files (x86)\AviSynth\plugins\FillMargins.dll [1.0.2.0]
C:\Program Files (x86)\AviSynth\plugins\flash3kyuu_deband.dll [2012-04-07]
C:\Program Files (x86)\AviSynth\plugins\FluxSmooth.dll [2006-11-09]
C:\Program Files (x86)\AviSynth\plugins\gradfun2db.dll [2006-03-15]
C:\Program Files (x86)\AviSynth\plugins\ImageSequence.dll [2010-11-15]
C:\Program Files (x86)\AviSynth\plugins\medianblur.dll [0.8.4.1]
C:\Program Files (x86)\AviSynth\plugins\mt_masktools.dll [2.0.32.0]
C:\Program Files (x86)\AviSynth\plugins\mvtools2.dll [2.5.11.3]
C:\Program Files (x86)\AviSynth\plugins\nnedi.dll [1.3.0.0]
C:\Program Files (x86)\AviSynth\plugins\nnedi2.dll [1.6.0.0]
C:\Program Files (x86)\AviSynth\plugins\nnedi3.dll [0.9.4.0]
C:\Program Files (x86)\AviSynth\plugins\PeachSmoother.dll [2014-04-28]
C:\Program Files (x86)\AviSynth\plugins\ReduceFlicker.dll [2005-09-15]
C:\Program Files (x86)\AviSynth\plugins\ReduceFlickerSSE2.dll [2005-09-15]
C:\Program Files (x86)\AviSynth\plugins\ReduceFlickerSSE3.dll [2005-09-15]
C:\Program Files (x86)\AviSynth\plugins\RestoreFPS_310705.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpen.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpenS.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpenSSE2.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpenSSE3.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\SangNom.dll [2004-01-18]
C:\Program Files (x86)\AviSynth\plugins\SmoothUV.dll [1.4.0.0]
C:\Program Files (x86)\AviSynth\plugins\SSE2Tools.dll [2005-04-11]
C:\Program Files (x86)\AviSynth\plugins\TBilateral.dll [0.9.11.0]
C:\Program Files (x86)\AviSynth\plugins\TDeint.dll [1.1.0.0]
C:\Program Files (x86)\AviSynth\plugins\TIVTC.dll [1.0.5.0]
C:\Program Files (x86)\AviSynth\plugins\TMM.dll [1.0.0.0]
C:\Program Files (x86)\AviSynth\plugins\TTempSmooth.dll [0.9.4.0]
C:\Program Files (x86)\AviSynth\plugins\VerticalCleanerSSE2.dll [2011-04-19]
C:\Program Files (x86)\AviSynth\plugins\vinverse.dll [2006-11-04]
C:\Program Files (x86)\AviSynth\plugins\xlogo.dll [2003-06-29]
[CPP 2.6 / 32 Bit Plugins]
C:\Program Files (x86)\AviSynth\plugins\checkmate.dll [2015-08-19]
C:\Program Files (x86)\AviSynth\plugins\DCTFilter.dll [0.5.0.0]
C:\Program Files (x86)\AviSynth\plugins\DCTFilter_avx2.dll [0.5.0.0]
C:\Program Files (x86)\AviSynth\plugins\ffms2.dll [2016-12-29]
C:\Program Files (x86)\AviSynth\plugins\fturn-26.dll [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\KNLMeansCL.dll [2017-05-04]
C:\Program Files (x86)\AviSynth\plugins\masktools2.dll [2.2.10.0]
C:\Program Files (x86)\AviSynth\plugins\msharpen.dll [2013-11-30]
C:\Program Files (x86)\AviSynth\plugins\RgTools.dll [2015-07-23]
C:\Program Files (x86)\AviSynth\plugins\SangNom2.dll [2013-11-30]
C:\Program Files (x86)\AviSynth\plugins\Seamer.dll [2015-04-14]
C:\Program Files (x86)\AviSynth\plugins\SmoothAdjust.dll [3.2.0.0]
C:\Program Files (x86)\AviSynth\plugins\TComb.dll [2.0.0.1]
C:\Program Files (x86)\AviSynth\plugins\TCPDeliver.dll [2.6.0.7]
C:\Program Files (x86)\AviSynth\plugins\TEMmod.dll [2016-05-29]
[Scripts / AVSI]
C:\Program Files (x86)\AviSynth\plugins\AnimeIVTC 2.00.avsi [2010-01-07]
C:\Program Files (x86)\AviSynth\plugins\AutoInterlaceDetect.avsi [2012-01-24]
C:\Program Files (x86)\AviSynth\plugins\AWarpSharpDering_1.0.avsi [2015-05-18]
C:\Program Files (x86)\AviSynth\plugins\BalanceBorders.avsi [2015-03-30]
C:\Program Files (x86)\AviSynth\plugins\BBMod.avsi [2017-09-24]
C:\Program Files (x86)\AviSynth\plugins\Cnv2.avsi [2015-03-22]
C:\Program Files (x86)\AviSynth\plugins\colors_rgb.avsi [2015-03-30]
C:\Program Files (x86)\AviSynth\plugins\Corners.avsi [2017-09-27]
C:\Program Files (x86)\AviSynth\plugins\Deblock_QED_MT2Mod.avsi [2017-11-08]
C:\Program Files (x86)\AviSynth\plugins\Dehalo_alpha_mt.avsi [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\Dehalo_alpha_MT2.avsi [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\DeHaloHmod.avsi [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\DFMDeRainbow.avsi [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\dither.avsi [2014-09-23]
C:\Program Files (x86)\AviSynth\plugins\edgecleaner.avsi [2015-07-24]
C:\Program Files (x86)\AviSynth\plugins\FFMS2.avsi [2015-05-22]
C:\Program Files (x86)\AviSynth\plugins\FixBrightness.avsi [2015-10-22]
C:\Program Files (x86)\AviSynth\plugins\GradFun2DBmod.v1.5.avsi [2017-11-08]
C:\Program Files (x86)\AviSynth\plugins\HaloBuster.avsi [2017-11-22]
C:\Program Files (x86)\AviSynth\plugins\HQDering.avsi [2017-11-24]
C:\Program Files (x86)\AviSynth\plugins\HQDeringmod_v1.8.avsi [2015-07-23]
C:\Program Files (x86)\AviSynth\plugins\InpaintFunc.avsi [2018-01-14]
C:\Program Files (x86)\AviSynth\plugins\LSFmod.v1.9.avsi [2015-12-19]
C:\Program Files (x86)\AviSynth\plugins\maa2.avsi [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\MCBob.avsi [2008-05-18]
C:\Program Files (x86)\AviSynth\plugins\MCBobUv5.avsi [2010-05-03]
C:\Program Files (x86)\AviSynth\plugins\MCTemporalDenoise.v1.4.20.avsi [2017-11-08]
C:\Program Files (x86)\AviSynth\plugins\mt_xxpand_multi.avsi [2010-09-11]
C:\Program Files (x86)\AviSynth\plugins\QTGMC-3.32.avsi [2011-06-07]
C:\Program Files (x86)\AviSynth\plugins\s_ExLogo.avsi [2018-01-14]
C:\Program Files (x86)\AviSynth\plugins\SMDegrain.avsi [2017-11-24]
C:\Program Files (x86)\AviSynth\plugins\Spline36ResizeMod.avsi [2016-07-08]
C:\Program Files (x86)\AviSynth\plugins\srestore.avsi [2017-11-25]
C:\Program Files (x86)\AviSynth\plugins\TGMCmod.avsi [2010-01-05]
C:\Program Files (x86)\AviSynth\plugins\Vinverse.avsi [2009-02-20]
C:\Program Files (x86)\AviSynth\plugins\VinverseD.avsi [2009-02-20]
C:\Program Files (x86)\AviSynth\plugins\WarpDeRing.avsi [2015-05-18]
C:\Program Files (x86)\AviSynth\plugins\yahr2.avsi [2017-11-07]
C:\Program Files (x86)\AviSynth\plugins\YLevels_mt.avsi [2015-07-09]
[Uncategorized / 32 Bit DLLs]
C:\Program Files (x86)\AviSynth\plugins\avi.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\avs.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\AvsRecursion.dll [2005-09-13]
C:\Program Files (x86)\AviSynth\plugins\dxr.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\libavcodec.dll [2008-08-06]
C:\Program Files (x86)\AviSynth\plugins\mkunicode.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\mkx.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\mkzlib.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\mp4.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\ogm.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\ts.dll [2013-04-14]
[Uncategorized / Other]
C:\Program Files (x86)\AviSynth\plugins\avisynth.h [2003-01-28]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.cpp [2003-11-04]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.dsp [2003-01-30]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.dsw [2002-09-09]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.h [2003-11-02]
C:\Program Files (x86)\AviSynth\plugins\ffms2.lib [2016-12-29]
C:\Program Files (x86)\AviSynth\plugins\ffmsindex.exe [2016-12-29]
C:\Program Files (x86)\AviSynth\plugins\TempGaussMC_beta1.avs [2008-08-26]
[Plugin errors]
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\avi.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\dxr.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\mkunicode.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\mkx.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\mkzlib.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\mp4.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\ogm.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\TEMmod_x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Error loading "C:\Program Files (x86)\AviSynth\plugins\ts.x64.dll"
Cannot load 64 bit DLL with 32 bit Avisynth
__________________________________________________________________________________________________________________________
Plugin C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll is not an AviSynth 2.6 or 2.5 plugin.
Note: C-Plugins must be loaded explicitly with "LoadCPlugin()"
__________________________________________________________________________________________________________________________
Plugin C:\Program Files (x86)\AviSynth\plugins\LogoTools.dll is not an AviSynth 2.6 or 2.5 plugin.
__________________________________________________________________________________________________________________________
pcroland
16th January 2018, 01:15
If you have avisynth_c.dll in plugins directory TAKE IT OUT OF THERE, it hijacks the LoadCPlugin function name for v2.0 C Plugins.
Think that will solve the problem. :)
EDIT: Perhaps Groucho2004 would like to look further at this problem, to see if can detect such an event, and give correct diagnosis.
After I took out AviSynth_C.dll:
AviSynth script:
LoadCPlugin("C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll")
DirectShowSource("X:\nowarez_homefootage.ts")
ConvertToYV12()
GradFun3(thr=0.5, radius=12, mask=2, mode=0, smode=0, debug=0, lsb=False, lsb_in=False, staticnoise=False, y=3, u=3, v=3)
xlogo("C:\Users\pcroland\Desktop\logo.bmp",180,860,30)
Spline36ResizeMod(1280,720)
AVSMeter log:
X-Logo: Could not load bitmaps
(C:\Users\pcroland\Desktop\asd.avs, line 5)
Mask: https://i.imgur.com/G8MijmW.png (imgur converted it to png, mine is bmp)
StainlessS
16th January 2018, 01:25
These are my dll's that go into system32 (or sysWOW64 on 64 bit).
AvsRecursion.dll
libsndfile-1.dll
fftw3.dll
libfftw3f-3.dll
On your system, this need be removed from plugins
C:\Program Files (x86)\AviSynth\plugins\AviSynth_C.dll [2004-01-01]
Also, none of thse should be in there
[Uncategorized / 32 Bit DLLs]
C:\Program Files (x86)\AviSynth\plugins\avi.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\avs.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\AvsRecursion.dll [2005-09-13] # system32
C:\Program Files (x86)\AviSynth\plugins\dxr.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\libavcodec.dll [2008-08-06]
C:\Program Files (x86)\AviSynth\plugins\mkunicode.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\mkx.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\mkzlib.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\mp4.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\ogm.dll [2013-04-14]
C:\Program Files (x86)\AviSynth\plugins\ts.dll [2013-04-14]
[Uncategorized / Other]
C:\Program Files (x86)\AviSynth\plugins\avisynth.h [2003-01-28]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.cpp [2003-11-04]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.dsp [2003-01-30]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.dsw [2002-09-09]
C:\Program Files (x86)\AviSynth\plugins\ChromaShift.h [2003-11-02]
C:\Program Files (x86)\AviSynth\plugins\ffms2.lib [2016-12-29]
C:\Program Files (x86)\AviSynth\plugins\ffmsindex.exe [2016-12-29]
C:\Program Files (x86)\AviSynth\plugins\TempGaussMC_beta1.avs [2008-08-26] # MAYBE AVSI
Best in directory of its own, maybe auto loaded via some avsi loader, and with ffmsindex.exe in same directory.
C:\Program Files (x86)\AviSynth\plugins\ffms2.dll [2016-12-29]
and maybe in same dir as above
C:\Program Files (x86)\AviSynth\plugins\FFMS2.avsi [2015-05-22]
These are all same plugin, but using different CPU capabilities, avisynth will use the last one loaded, best if you choose one.
C:\Program Files (x86)\AviSynth\plugins\ReduceFlicker.dll [2005-09-15]
C:\Program Files (x86)\AviSynth\plugins\ReduceFlickerSSE2.dll [2005-09-15]
C:\Program Files (x86)\AviSynth\plugins\ReduceFlickerSSE3.dll [2005-09-15]
Same, S suffic one is Static linked, ie does not have an external dll dependency on some MS CPP runtime.
C:\Program Files (x86)\AviSynth\plugins\RSharpen.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpenS.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpenSSE2.dll [2005-07-31]
C:\Program Files (x86)\AviSynth\plugins\RSharpenSSE3.dll [2005-07-31]
same
C:\Program Files (x86)\AviSynth\plugins\DCTFilter.dll [0.5.0.0]
C:\Program Files (x86)\AviSynth\plugins\DCTFilter_avx2.dll [0.5.0.0]
You have a few others that I'm not sure if similar avsi scripts with different names.
pcroland
16th January 2018, 01:38
Wow, thanks for the help :D I cleared up everything. I think that I copied everything that belongs to System32 also to the plugins folder from the AviSynth bundle, that's why they were there also. The error is still present btw.
StainlessS
16th January 2018, 02:12
Looks to me like the xlogo thing wants 1 or 3 bitmaps, first one ending either in 0, or 2.
Did not look into it any further, suggest you try the VDub dll to see if you can figure out what it wants, I've never used it.
Xlogo(Clip, filename, X, Y, ALPHA, T1, T2, T3, B1, B2, B3, WHITE, SIDE, SCENE, FEATHER, NOISE, BLEND, FADEIN, FADEOUT)
filename:
Filename of the first logo bitmap. Uses same naming convention as vdub version. The
first file must end in 0.bmp or 2.bmp
EDIT:
On my system, I have a System32 directory inside my Plugins, where the system32 dll's live, can move whole plugins to another machine and just copy contents of that directory to system32 or SysWOW64, easy peasy, none get lost.
Same for other specials, like ffms, in special CPP or C directories, I can edit the avsi loader which loads several special cases dll's,
I also have a directory for V2.0 C plugs, v2.5 C plugs, and v2.0 CPP plugs. + one for 2.5 and one for v2.6 alternative dll's.
Directories inside Plugins:-
GPU
ini
LSMASH_CPP
My_Plugins_Init # scripts, load plugins + eg SetMemoryMax
MY_PLUGS
OLD_SUPERCEDED
SCRIPTS
SVP
System32
FFMS_C
FFMS_CPP
Exe Files # eg multidecimate.exe (and multidecimate's ProcessMD.exe)
FFDSHOW
FFMS2000_CPP
COMMON_25_PLUGS
Avisynth v2.5_ONLY
C v2.0 Plugins
C v2.5 Plugins
Avisynth v2.6_ONLY
C++ v2.0 Plugins
BAK # temp storage for testing with eg empty dir
Saves quite a lot of time when moving from system to system, I copy what I want into plugins (from the various sub directories, as required).
EDIT: Most people seem to prefer the SSE2 alternatives (to eg SSE3, which some consider a little bit temperamental at times and with only little advantage when they do work well.)
EDIT: COMMON_25_PLUGS folder contains this lot
RARELY_USED_V2.5_COMMON # folder
COMMONLY USED # folder
GRunT.dll # ALWAYS USED
GScript.dll # ALWAYS USED, Cheers Gavino :)
C v2.0 Plugins folder
C_v2.0 Loader
avisynth_c.dll # v2.loader
AVSCurveFlow.dll
AVSShock.dll
equlines.dll
IBob.dll
SmartDecimate.dll
Transition.dll
manono
16th January 2018, 05:42
I've never had much luck using XLogo. I got it to run a couple of times and failed trying a dozen other times. I finally gave up and use InPaintFunc for opaque logos and LogoTools for the see-through ones. If you want to beat your head against a wall some more, here's a guide to using XLogo:
https://forum.videohelp.com/threads/273109-Remove-an-opaque-logo-using-Xlogo-in-Avisynth
Maybe you'll succeed where others have failed.
As for your scripts not opening, comment out all lines (put a '#' in front of) except your DirectSource line just to test if the script even opens in VDub. I never use it if I can help it. That might not be the problem (especially where XLogo is concerned), but it can't help to try, just to make sure your source filter is working.
Then just add back (remove the '#') the lines having to do with the delogo filter until you get that part going.
Looks to me like the xlogo thing wants 1 or 3 bitmaps, first one ending either in 0, or 2.
Yes, it's real particular about how the BMPs are named.
StainlessS
16th January 2018, 06:08
Dekafka is a real fast delogo tool, but basically just blurs out/replaces the nasty stuff (using pixels outside of logo area).
S_ExLogo is my mod of same and is almost as fast as DeKafka, but works better and fixes a few anomolies in the Dekafka script.
If you do want to try Dekafka, see first one here:- http://avisynth.nl/index.php/DeKafka
(never tried the 2nd one, which does require a mask).
There are problems with coords in nearly every D9 thread containing Dekafka script function, so only use from the linked Wiki (I fixed the coords there).
Here, S_ExLogo, which looks like it would be a lot slower, but it really does kick ass (just like Dekafka):- https://forum.doom9.org/showthread.php?t=154559
Neither of them produce best results, but both are easy to use and no masks or other complexities.
EDIT: Both are YUY2 only (uses Layer which dont work in Planar).
EDIT: Wiki says this
Note this version works with any format, but there will be a RGB32 conversion.
However, Layer is YUY2 and RGB32 only, although Layer Wiki says also RGB64 for AVS+. http://avisynth.nl/index.php/Layer
EDIT: Twould be nice if Layer supported YV24 too.
pcroland
17th January 2018, 01:16
I finally gave up and use InPaintFunc for opaque logos and LogoTools for the see-through ones.
xlogo() works now, I renamed the mask to logo0.bmp, but the result is not that great. Would it be any better with LogoTools? The logo is just one color with ~50% transparency: https://imgbox.com/2FqlMBNJ
I installed LoadPluginEx.dll and LogoTools.dll but none of its functions work.
manono
17th January 2018, 05:15
Would it be any better with LogoTools?
I have no idea as a picture is next to useless. You need a piece of video and a frame with the logo over a black background so you can make the mask. The whole frame doesn't have to be black (although it helps), but just the part behind the logo.
I installed LoadPluginEx.dll and LogoTools.dll but none of its functions work.
That's also next to useless. To help we almost always need an untouched piece of video, the complete script used, and the exact error message when the video is opened in VDub.
pcroland
18th January 2018, 06:27
Sample: https://mega.nz/#!qNAC1YbB!LvoFf9VdtQjNNM8bhFe1VRZWuAjvcFozkQHQPgJIK6I
AviSynth script:
a=DirectShowSource("X:\DL\Super.Robot.Monkey.Team.Hyperforce.Go.S01.1080i.HDTV.DD5.1.H.264-NOGRP\S01E01 Chiro's Girl.ts")
a=a.ConvertToYV12()
a=a.GradFun3(thr=0.5)
b=a.xlogo("C:\Users\pcroland\Desktop\logo0.bmp",180,860,0)
a=a.Spline36ResizeMod(1280,720)
b=b.Spline36ResizeMod(1280,720)
Interleave(a,b)
With this script this is the result:
https://testfra.me/1e/
AviSynth script:
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\LogoTools.dll")
a=DirectShowSource("X:\DL\Super.Robot.Monkey.Team.Hyperforce.Go.S01.1080i.HDTV.DD5.1.H.264-NOGRP\S01E01 Chiro's Girl.ts")
a=a.ConvertToYV12()
a=a.GradFun3(thr=0.5)
#xlogo("C:\Users\pcroland\Desktop\logo0.bmp",180,860,0)
a=a.ConvertToYUY2()
b=ImageSource("C:\Users\pcroland\Desktop\nologo.png").ConvertToYUY2()
c=NoLogoAuto(a,b,0)
a=a.ConvertToYV12()
a=a.Spline36ResizeMod(1280,720)
c=c.ConvertToYV12()
c=c.Spline36ResizeMod(1280,720)
Interleave(a,c)
Mask: https://i.imgur.com/HV311oS.png
And with this script, this is the result:
https://testfra.me/1f/
It seems that NoLogoAuto() puts on another logo instead of removing it :D
manono
19th January 2018, 05:20
When using XLogo you can vary the amount of blur. But, as I said, I don't use it so I haven't played with it.
Using LogoTools I mentioned you need the logo with a black background. You don't have one in your sample. Every mask I've ever made was black and white so I don't know for sure whether or not having the green part messes it up because I work with black and white films. From the LogoTools_help.rtf:
Notes: The logo needs to be in a compelely black frame.
pcroland
19th January 2018, 17:41
When using XLogo you can vary the amount of blur. But, as I said, I don't use it so I haven't played with it.
Using LogoTools I mentioned you need the logo with a black background. You don't have one in your sample. Every mask I've ever made was black and white so I don't know for sure whether or not having the green part messes it up because I work with black and white films. From the LogoTools_help.rtf:
I linked a black frame with the logo:
"Mask: https://i.imgur.com/HV311oS.png"
manono
19th January 2018, 19:28
I linked a black frame with the logo:
Was it included as part of the sample video?
pcroland
19th January 2018, 23:47
Was it included as part of the sample video?
Here's a sample with a black frame:
https://mega.nz/#!TBw1iRxJ!eoipHj4TupRvNY_DQbW1o-os65FjI9oVMXKwrQY62sI
Script:
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\LogoTools.dll")
a=FFMS2("C:\Users\pcroland\Desktop\MEGA\sample2.mkv").ConvertToYUY2()
b=NoLogoAuto(a,a,768)
Interleave(a,b)
It does the same thing.
manono
20th January 2018, 08:52
Your 'A' is your video and the 'B' is the logo. I also discovered the mask should be black and white, not black and green. Unfortunately, I didn't have much luck at all using LogoTools. Using the basic script:
B=ImageSource("Logo2.bmp").ConvertToYUY2()###BMP with logo and black background
FFVideoSource("Sample2.mkv").ConvertToYUY2()
A=Last
NoLogoAuto(A,B,531)
The logo was replaced with a dark grey something. Using the more complex versions (NoLogo and NoLogoM), the scripts either crashed or gave out with error messages. I don't know why.
So, I switched to using InPaintFunc (http://avisynth.nl/index.php/InpaintFunc). The link below is to the version I made. Parts of it look pretty good, other parts pretty bad:
LoadCPlugin("H:\AVISynth\Dlls\AVSInPaint.dll")
LoadPlugin("H:\AVISynth\Dlls\ExInpaint.dll")
LoadPlugin("H:\AVISynth\Dlls\AddGrainC.dll")
LoadPlugin("H:\AVISynth\Dlls\MedianBlur.dll")
Import("H:\AVISynth\plugins\INPaintFunc.avs")
AVISource("sample2.avi")#I had made a quick lossless Lagarith AVI
X=InpaintFunc(mask="logo3.bmp",loc="192,870,-1530,-78",AR=1.0/1.0,mode="DeBlend",speed=10, ppmode=1,pp=50,radius=5.0,preblur=8.0)
Y=X.MedianBlur(2,2,2).AddGrain(5,0,0)###Does most of the blurring
Mask=ImageSource("LogoBlur.bmp")
Overlay(X,Y,0,0,Mask)
Also enclosed are the Logo3.jpg and the LogoBlur.jpg, smaller versions of the BMPs I used. the LogoBlur was used to add more blurring and to feather the blurring to blend in better. If you don't want any of that, then just the basic script is fine:
InpaintFunc(mask="logo3.bmp",loc="192,870,-1530,-78",AR=1.0/1.0,mode="DeBlend",speed=10, ppmode=1,pp=50,radius=5.0,preblur=8.0)
Adjust the parameters as you wish. One thing to know; this thing is very slow, just to open. I suggest trimming off 500 or so frames to test. Only after getting it to work and the way you like should you open the complete video. It might take twice the length of the video just to open, or more. The encoding time isn't so bad. It might be better to use the Inpaint mode to completely recreate the inside of the logo from what's around it. Or, maybe try and get the StainlessS one going.
https://www.sendspace.com/file/wiop9v
pcroland
21st January 2018, 16:20
Thanks for all the help, it works great :D
Yanak
22nd January 2018, 12:51
@manono about the very slow part of InPaintFunc :
The speed parameter combined with the length ( number of frames) of the video can take some time for the analyze and generate the .ebmp file the first time yes,
speed=10 like in your example will analyze 50% of the video if i recall correctly, speed 20 is for analyzing 100% ( even slower ) , speed 1 analyze 5% of the frames, speed 2 = 10% etc.
Each step of speed parameter adds 5% for the video analyze, speed parameter allowed values goes from 1 to 20.
Depending the length of my videos i modify this parameter a bit, especially at the start during the settings adjustments, later when i fine tuned a bit my settings i can go with the reset parameter or simply delete the .ebmp file created and set analyze to a very high % and generate a new one before encoding ;)
manono
23rd January 2018, 10:05
Thank you for the suggestions.
TCmullet
26th December 2019, 22:59
I was last in this thread Jan. 2017 (page 9). I did get rm_logo to work in a way helpful to me. I believe I had it 100 percent mode=deblend. However, since then, I had to rebuild the system (I lost the C drive). I've been running many scripts since then, but now I need to rerun the same script (same video file project) that I used rm_logo in.
Avisynth says, There is no function named "DistanceFunction". Yet I have all six required dlls in my plugins folder. Any ideas?
StainlessS
26th December 2019, 23:24
Gee TC,
Suggest dont use old Rm_Logo/InpaintFunc, Pinterf updated AvsInPaint a little while ago:- https://github.com/pinterf/AvsInpaint/releases
Also, VoodooFX created a script to rival/beat the best delogo'ers (InpaintDelogo - advanced logo removal script):- https://forum.doom9.org/showthread.php?t=176860
By VoodooFX,
rm_logo & InpaintFunc are both semi-broken, slow inpainting, with subpar to unusable results.
Dont know why your "DistanceFunction" aint working, it is from the AvsInpaint.dll
EDIT: I'm guessin' that new Pinterf AvsInpaint.dll is avisynth v2.60 only (v2.58 will not be able to see it).
EDIT: From Pinterf AvsInpaint on GitHub, [perhaps you have broken v1.1]
v1.2 (20190705)
Fix broken compatibility with classic Avisynth 2.6 (remove underscore from dll export)
v1.1 (20190624) by pinterf
Fix crash in AVSInpaint-2008.02.23, when using mode "Deblend" or "Both"
(double frame release, revealed when using Avisynth+)
Add version resource
Visual Studio 2019 solution
x64 version
(no new colorspaces)
TCmullet
26th December 2019, 23:40
Thanks for the news, Stainless. However, I spent hours and hours and hours over days getting rm_logo set up and working. I only need to rerun the script to recreate an output file that got lost. Thankfully I have all the original source files (video, audio, etc.) I can't spend all those hours over again to implement a new system even though it's better.
Is it possible it's caused by lack of libfftw3f-3.dll in my system? I found clues it is. (I had made a cryptic reference back then to "I'm following your advice and moving libfftw3f-3.dll from system32 to syswow64.") There was a link to a different thread where I suspect we got that dll from, but that thread no longer exists. I have found ONE copy of that file loose in a stray folder. I have put it in syswow64 and will reboot soon to try it.
I'm not using Avisynth 2.5.8. I think I installed Avisynth+, but then copied over 2.6.0 on top due to needing MT stuff (Interframe), if that makes any sense. If DistanceFunction is a part of AvsInpaint, then maybe I need to figure out how to run AVSMeter again to find out why it's not being detected.
hello_hello
26th December 2019, 23:42
TCmullet,
I think DistanceFunction is a function from AVSInPaint. If you're using Avisynth 2.6, you need to load it as a C plugin rather than a regular plugin. I think Avisynth+ should load C plugins automatically though.
Edit: For Avisynth 2.6, I keep C Plugins in a separate folder, and only the avsi script I created for loading them lives in the auto-loading plugins folder. I think I borrowed the idea from StainlessS. Something like:
AVSInPainting = "C:\Program Files\AviSynth\C Plugins\AVSInPaint.dll"
exist(AVSInPainting) ? LoadCPlugin(AVSInPainting) : nop()
StainlessS
26th December 2019, 23:47
See my Last edit, also, probably needs VS 2019 CPP runtime.
TC, think workings of InPaintDelogo is very simlar to either rm_logo or InPaintFunc, not sure which.
See Manolito comments in VoodooFX thread, it will be worth your while spending a little while modding.
EDIT: Avs+ v3.4.0 is now MT, so you dont need v2.60MT (avs+ v3.4.0 MT) :- https://github.com/AviSynth/AviSynthPlus/releases
EDIT: Nice one HH :)
TCmullet
26th December 2019, 23:52
TCmullet,
I think DistanceFunction is a function from AVSInPaint. If you're using Avisynth 2.6, you need to load it as a C plugin rather than a regular plugin. I think Avisynth+ should load C plugins automatically though.
That was IT! The old rm_logo calls working "purty" again. I had removed the loadCplugin call as I saw that Avisynth+ doesn't need it. But then I relearn I'm not using +. FYI, I had installed plus as a part of the SVP video player, but needed to revert the executable to 2.6MT for my special needs.
Stainless, you edited your post and saved it at the moment I was saving my response. Now that I'm up with rm_logo, I'll go with it for this video rebuild, but will seriously look at the new system if I need delogoing again.
Muchas gracias to you both!
hello_hello
27th December 2019, 00:02
I edited my previous post to add a suggestion for loading C plugins automatically when using Avisynth 2.6, in case you missed it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.