Log in

View Full Version : InpaintDelogo - advanced logo removal & hardcoded subtitles extraction


Pages : 1 [2] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

manolito
8th December 2019, 14:42
When you have "AutoMask=1" in your InpaintDelogo call, then it will only create a mask and not remove any logo. You need to call InpaintDelogo twice, the second time with "AutoMask=0".

For creating the mask you might want to use the "Analyze=4" parameter instead of the default "Analyze=1". But for this you need to specify a frame number with the "Fr1" parameter where the logo is surrounded by black.

Another thing in your script is problematic. Your loc area is identical to the logo size, and this will give you bad results. The loc area must be at least 10 pixels larger than the logo, I use 14 to 16 pixels.

Your changes for the possible loc formats look interesting, but I will probably have no use for the new formats. To determine the loc coefficients I do not use "InpaintLoc" at all, instead I open my clip in VDub and apply the NullTransform filter. From there I can crop the image visually, and VDub shows the coefficients in the correct format which I can enter into my AVS script.


Cheers
manolito

StainlessS
8th December 2019, 15:26
Thanks Mani, guess that this is no good to me at all then, unless we can artificially create a mask in whatever required format.
Currently modding s_ExLogo2(), target is work from v2.58 to avs+ ALL colorspaces [EDIT: except YV411], and nice gauss blurry stuff, with soft edges.

manono
8th December 2019, 20:09
Your changes for the possible loc formats look interesting, but I will probably have no use for the new formats.
I think you're being polite. I took one look and thought to myself, "WTF?". They're fine the way they are.

I'd like to thank the creator for this. It opens almost instantly where when using InPaintFunc as I did before, it took roughly the length of the video to open. And since I work with long movies, mostly, you can imagine the frustration. And the results are better. I've used it twice recently on opaque logos and am very happy with the results.

StainlessS
8th December 2019, 20:43
I also thank VoodooFX for his useful tool.

I think you're being polite. I took one look and thought to myself, "WTF?". They're fine the way they are.

-ve width and height are useful when logo is at RHS or bottom, but less so when at LHS or top,
-ve LogoX and LogoY are useful in the same way as -ve width and height.

Nothing wrong with the way they were, and also nothing wrong with having options.
I did request VoodooFX to make the mod[sept 2019], but he aint been back since then.

Also, Manolito is always polite [well sometimes he is].

EDIT:
Thanks Mani, guess that this is no good to me at all then, unless we can artificially create a mask in whatever required format.
I meant that is no use where single frame delogo required, as analysis stage would find nothing [same where static clip/static logo as in prev test script].

manolito
8th December 2019, 20:46
Yes, the results of the InpaintDelogo plugin blow everything I have tested and used before out of the water...

A few hints:
If you use the "Analyze=1" parameter for the AutoMask creation then 3% of the source clip will be used for analyzing. For a longer movie (duration 90 min or above) this takes a long time. You can use "Trim", but for me I get better results after specifying a lower percentage for analyzing. I edited the InpaintDelogo.avsi file and replaced "every=33" with "every=400", and this is way faster without damaging the mask.

If you use AVS+ and want to use MultiThreading, there are a few catches. As VoodoFX pointed out, the InPaint routines are not really MT friendly. Analyzing the speed with AVSMeter you will find that turning off MT will result in a higher speed. But you may have other filters in your AVS script which do profit from MT, and the overall speed will be higher when using MT.

From my InpaintDelogo tests I found out that it tends to crash quite a bit when using MT. Reducing the prefetch threads did not help, but I got it working without crashes now.

First you need to force MT_SERIALIZED mode for all Inpaint functions:
SetFilterMTMode("InpaintLogo", MT_SERIALIZED)
SetFilterMTMode("DeblendLogo", MT_SERIALIZED)
SetFilterMTMode("AnalyzeLogo", MT_SERIALIZED)
SetFilterMTMode("DistanceFunction", MT_SERIALIZED)
SetFilterMTMode("RequestLinear", MT_SERIALIZED)

And then the InpaintDelogo call must be followed by a RequestLinear call like this:
RequestLinear(rlim=50, clim=50)

This will decrease the possible MT speed gain quite a bit, but for my usual conversions I still get a moderate gain of several fps. And no more crashes for quite some time...


Cheers
manolito

manolito
8th December 2019, 20:48
Also, Manolito is always polite [well sometimes he is].

Should I be offended? :cool:

StainlessS
8th December 2019, 20:58
You are seldom offended when I say such nice things about you [Esp as I was so staunchly defending you :) ].

VoodooFX
9th December 2019, 18:13
I just came to update op, lots of new post I see. :)

So what for these new Loc arguments are for? To use your new plugin with InpaintDelogo, StainlessS? Does it needs some testing?

Yesterday I delogo'ed one video:

https://i.imgur.com/NgbrmFL.png

https://i.imgur.com/M0RP2VE.png

StainlessS
9th December 2019, 19:12
So what for these new Loc arguments are for?

Hi VDX, can I request a feature update.
I like to be able to use -ve width and height as in crop, but not quite so keen on being forced to only use -ve values,
so how bout making +ve width and height possible in your loc string thing ?

Not new arguments, just alternative way of specifiying existing ones. [EDIT: crop() without +ve width,height options, would be a little less perfect]
I dont mind if you remove -ve LogoX,LogoY, sometimes just a little easier to guess relative RHS/BOT, your choice. I've marked all changes in script with 'ssS'.


Does it needs some testing?
Yes please if you would be so kind.

Real good job on you new posted delogo sample, is quite nifty.

I did not know if you were gone for good, nice to see you back again :)

EDIT: The changes were made so as not to foul up your existing logic where code might be reliant upon -ve width,height.

EDIT: This is the only line that I can see that might require a little bit of your time [maybe delay detect until you extract a,b,c,d from loc string, and after conversion to +ve a,b, and -ve c,d].

bugloc2 = (loc == "0,0,-0,-0" || loc == "0,0,0,0") ? true : false # ssS: Added:- || loc == "0,0,0,0"

VoodooFX
9th December 2019, 19:23
Found some old testing files, just need to remember and understand all this new stuff in your plugin.

-ve +ve is confusing as you need to add at least 10px borders from logo edges in InpaintDelogo.
Real minimum I think is 7px or 8px, added some room for user error... that's why 10 in help, it will be best for quality and speed to keep at minimum 8-10px.

StainlessS
9th December 2019, 19:39
Any/all changes that you dont like, remove [or just miss them out all together in v1.14], I can easily make a stub to amend loc from outside of your script, not a problem at all.

The thing I'm currently doing (s_exlogo2) is not in anyway competition for your script, has different intent, I wanna be able to just splat any rectangular problem areas without having to do any analysis.

Found some old testing files, just need to remember and understand all this new stuff in your plugin.

Aint my plugin, is yours, you gets all the blame for everything :)

VoodooFX
9th December 2019, 19:48
By default InpaintDelogo doesn't do any analysis too, only if you want to get the mask automatically or deblend the logo.

TCmullet
27th December 2019, 00:48
I've tried to look over everything and absorb what I could. Your built-in two manuals leave out much. Here's where I'm stuck now:

> 2) Get frames numbers for manual "Analyze".

What do I do with the range of frame numbers that I want the analysis to be based on?

BTW, I will be replacing rm_logo logic. My scripts have commented out code which was used to do the analysis, then further down was my runtime code.

StainlessS
27th December 2019, 11:16
@ TcMullet,

I'm off to bed in a minute, but will come back later.

@ VoodooFX,
I've removed the InPaintDelogo v1.13 pretender script from SendSpace, its gone 4E4. [forever]

Have done a stub function just to manufacture InPaintDelogo style Loc string, add it to your script if your like it, if not then no sweat.


Function MakeLoc(clip c,Int x, Int y, Int w, Int h) { # https://forum.doom9.org/showthread.php?p=1893966#post1893966
/*
Make Loc string for VoodooFX InPaintDelogo.
Input X and Y, where -ve, is relative to c.Width or c.Height, and are converted to +ve X and Y in result string.
Input W and H, where 0 or -ve, is relative c.Width or c.Height [as in Crop()],
Where +ve, are converted to -ve W and H in result string [as required by InPaintDelogo].
Allows to make Loc string programmatically using flexible coord system and not locked into hand editing Loc string.

ColorBars # 640,480
S=MakeLoc( 0, 0, 0, 0) # "0,0,-0,-0"
S=MakeLoc( 540, 380,-40,-40) # "540,380,-40,-40"
S=MakeLoc(-100,-100, 60, 60) # "540,380,-40,-40"
S=MakeLoc( 540, 380, 60, 60) # "540,380,-40,-40"
S=MakeLoc(-100,-100,-40,-40) # "540,380,-40,-40"
*/
c
# First, Ensure/Convert X,Y,W,H ALL +ve
x = (x >= 0) ? x : Width + x
y = (y >= 0) ? y : Height + y
w = (w > 0) ? w : Width - x + w
h = (h > 0) ? h : Height - y + h
# Check validity
Assert(0 <= x < Width ,String(x,"MakeLoc: 0 <= X(%.0f)") + String(Width ," < Width(%.0f)" ))
Assert(0 <= y < Height ,String(y,"MakeLoc: 0 <= Y(%.0f)") + String(Height ," < Height(%.0f)"))
Assert(1 <= w <= Width -x ,String(w,"MakeLoc: 1 <= W(%.0f)") + String(Width ," <= Width-X(%.0f") + String(x ," - %.0f)"))
Assert(1 <= h <= Height-y ,String(h,"MakeLoc: 1 <= H(%.0f)") + String(Height ," <= Height-Y(%.0f") + String(y ," - %.0f)"))
# Output string: +ve X,Y :: -ve W,H, Ensure all (even W=0 and H=0) flagged as -ve eg -0
return String(x,"%.0f") + String(y,",%.0f") + String(Abs(x+w-Width),",-%.0f") +String(Abs(y+h-Height),",-%.0f")
}


EDIT: If you DONT like the -ve x,y options, then can just delete the above lines in RED, and if you do include above without -ve x,y,
then please rename function to some other name, I dont want it to conflict with my stub. [you would likely want to edit the description too of course].

manono
28th December 2019, 00:51
Here's where I'm stuck now:

> 2) Get frames numbers for manual "Analyze".

What do I do with the range of frame numbers that I want the analysis to be based on?

Forget doing an analysis pass. Make your own logo BMP, find the coordinates for the location (10-12 pixels outside of the logo coordinates). and go right to InpaintDelogo. I've been using this script, copied from the manual, with success (adjust for your BMP location and location coordinates):

InpaintDelogo( mask="G:\Jugnu\Logo.bmp",
\ Automask=0, aMix=0, Loc="44,34,-524,-386",
\ Mode="Inpaint",
\ Analyze=1, Fr1=0, Fr2=0, FrS=0)

Others such as manolito, VoodooX, or StainlessS might want to make suggestions. I'm not even sure I need all that, but it works quickly and it works well.

VoodooFX
28th December 2019, 08:11
December is very busy... I don't have much time StainlessS.

I've tried to look over everything and absorb what I could. Your built-in two manuals leave out much. Here's where I'm stuck now:

> 2) Get frames numbers for manual "Analyze".

What do I do with the range of frame numbers that I want the analysis to be based on?

BTW, I will be replacing rm_logo logic. My scripts have commented out code which was used to do the analysis, then further down was my runtime code.

Everything is in the manual, you just need to read it. Some part of it about frames:

3 - Manual analysis. This method is best, but you need one frame where
# logo area is in a solid black/dark background and another in a solid
# white/bright background. Blacker/whiter - better. These two frames must
# be set with "Fr1" & "Fr2" parameters and optional "FrS".

manolito
29th December 2019, 00:01
I agree that using InpaintDelogo can be a little bit confusing at first - I found it confusing even with a lot of experience from other delogo plugins... :o

In this post I will try to remove some of the confusion. To achieve this I will only refer to the "Inpaint" mode which is meant for opaque logos. The two other modes ("Deblend" and "Both") are meant for semi-transparent logos, they try to reconstruct the original pixels behind the semi-transparent logo. This makes these modes much more complex and slower, and I found that the result oftentimes does not justify the effort.

For the "Inpaint" mode only one "base mask" is needed. The additional Alpha and Color masks are not needed at all.

This is the basic work flow:
1. Create a "base mask". This is an image file with the identical size of the source clip where the logo itself is all white and the rest of the image is all black. Save it as a BMP file to your HDD.

2. Determine the coordinates for the "Loc" parameter. The dimensions need to be about 10 pixels larger than the logo, and the format is identical to the AviSynth Crop parameters.

3. Call the "InpaintDelogo" function for the logo removal. Use the parameters for the mask file location and the Loc parameter with the coordinates which you have determined.


The InpaintDelogo plugin includes methods to do the #1 and #2 tasks, but it is in no way required to use these methods. For many users it may be much easier to perform these steps manually without using the plugin functions.

Have a look at manono's script two posts above. He does steps #1 and #2 manually, and his final logo removal call can even be stripped down considerably. His original script can be reduced to:
InpaintDelogo(mask="G:\Jugnu\Logo.bmp", Loc="44,34,-524,-386", Mode="Inpaint")

Especially the "Analyze=1" should not be used here. When the mode is set to "Inpaint" then "Analyze=0" will be forced unconditionally. This is because the base mask is already there, and the "Inpaint" mode does not need additional masks which would need analyzing.

For better speed you can play with the "Turbo" parameter, but this is basically it. If you are familiar with using a photo editor to create the mask then this will be your fastest method.


If your are like me and do not feel comfortable with image editors like PhotoShop then it may be a good idea to use the InpaintDelogo plugin to create the required base mask automatically. The "InpaintDelogo" function needs to be called with the "AutoMask=1" parameter for this. With this parameter the function will ONLY CREATE A MASK, nothing else. To actually remove the logo the function has to be called for a second time without the "AutoMask" parameter.

First you need to determine the "Loc" coordinates and enter them into the "Loc" parameter. Then you need to decide which "Analyze" method you want to use for the mask creation. The best and fastest method for the "Inpaint" mode is "Analyze=4". You need to find a source frame where the logo is surrounded by black. For real world movies such a frame can usually be found at the start of the movie or at the very end. The frame number of such a frame needs to be entered with the "Fr1" parameter.

If you cannot find a source frame where the logo is surrounded by black then you need to use the "Analyze=1" method. With this method 3% of the source will be analyzed for the mask creation. This takes time, especially for HD sources. For longer sources you can use this hack to speed up the mask creation:
If you use the "Analyze=1" parameter for the AutoMask creation then 3% of the source clip will be used for analyzing. For a longer movie (duration 90 min or above) this takes a long time. You can use "Trim", but for me I get better results after specifying a lower percentage for analyzing. I edited the InpaintDelogo.avsi file and replaced "every=33" with "every=400", and this is way faster without damaging the mask.

So if you decide to use the AutoMask feature of the plugin your first call to the "InpaintDelogo" function should look similar to this:
Loc="22,12,-588,-328"
InpaintDelogo(automask=1, analyze=4, fr1=10329, mask="d:\logomask.bmp", Loc=Loc)

Or like this:
Loc="22,12,-588,-328"
InpaintDelogo(automask=1, analyze=1, mask="d:\logomask.bmp", Loc=Loc)

And the second call for the actual logo removal could look similar to this one:
Loc="22,12,-588,-328"
InpaintDelogo(mask="d:\logomask.bmp", Loc=Loc, Mode="Inpaint", Turbo=0)



Hint for better speed if you are downscaling your source:

The logo removal will be much faster if you apply it after the resizer (when downscaling). Of course this also means that you need to use a downscaled image for creating the mask.


Cheers
manolito

manono
29th December 2019, 00:41
His original script can be reduced to:
InpaintDelogo(mask="G:\Jugnu\Logo.bmp", Loc="44,34,-524,-386", Mode="Inpaint")
Thank you very much. I figured it could be streamlined but hadn't gotten around to playing with it as I was just so happy with the way it was working.

If you are familiar with using a photo editor to create the mask then this will be your fastest method.
Which is why I said to forget analyzing the video and just create your own logo BMP. Any photo editor can do the job. I use the freeware PhotoFiltre (http://www.photofiltre.com/).

manolito
29th December 2019, 01:19
Any photo editor can do the job. I use the freeware PhotoFiltre (http://www.photofiltre.com/).

Hey manono,

looks like we have similar preferences. I have been using PhotoFiltre exclusively for many years now. But I still am not an expert with layers and masks, I just don't do much photo editing... :o

Happy New Year
manolito

manono
29th December 2019, 03:02
I just don't do much photo editing...
Me neither. About all I use it for is mask creation for logos and for parts of frames where filters are to be applied, and then its Gaussian Blur filter for feathering when needed.

Oh, and for replacing parts of artifacted frames with bits from nearby good frames. All simple stuff. And all for use in AviSynth scripts.

RieGo
29th December 2019, 10:22
i love this plugin!
my personal workflow (no need to create mask):
-find logo area with InpaintLoc()
-find 30+ frames with logo on black background (mostly at start or end of video)
-find 30+ frames with logo on white(ish) background

InpaintDelogo(mask="tmp.bmp",Automask=1,Loc="x,x,-x,-x", Mode="Both", Analyze=3,Fr1=x,Fr2=x,FrS=3)

now there are 2 things which still are a bit annoying:
-loc parameter would be great to be used as "left,top,width,height" imo
-whenever Automask is enabled, staxrip and probably avisynth doesn't generate a valid output, so i need to first analyze and then disable automask

thanks dev for this great plugin, this really helps a lot!
next improvement would be finding black/white frames on its own :D

manolito
29th December 2019, 14:05
-loc parameter would be great to be used as "left,top,width,height" imo

Have a look at this script by StainlessS:
https://forum.doom9.org/showthread.php?p=1893966#post1893966
It will convert your input to the required format for InpaintDelogo.


-whenever Automask is enabled, staxrip and probably avisynth doesn't generate a valid output, so i need to first analyze and then disable automask

This is not a bug, it's a feature... :D
From the manual:
# Int "Automask" : Generates a base mask of the logo.
# "Analyze" (and its sub-parameters, except "ReAnalyze"), "aMix", "mask" and
# "Loc" parameters will be used.
# "Loc" would be best 10(no less) pixels from the logo edges.
# Needs "mask" defined with path to imaginary bmp picture, that's where
# a base mask will be generated.
# Will re-analyze on every script load. Fastest and best results will be
# with manual "Analyze".
#
# 0 - Off (default).
# 1 - On. Generates a mask, doesn't do anything else when "On".



Cheers
manolito

RieGo
30th December 2019, 11:26
Have a look at this script by StainlessS:
https://forum.doom9.org/showthread.php?p=1893966#post1893966
It will convert your input to the required format for InpaintDelogo.


Thanks! i missed that one :D

JohnDoe
13th May 2020, 16:04
Maybe anyone have a idea for this Problem:

https://forum.doom9.org/showthread.php?t=181432

Thanks!

JohnDoe
31st August 2020, 00:37
I have a film with a single color transparent text watermark, always at the same location. I also have the film in a lower resolution version without watermarks, but with a lower frame rate (and therefore missing frames). I don't want to remove the missing frames, otherwise the film will be more jerky.

I've built a script for myself, which picks out the best fitting frames with help of LumaDifference and use a black/white mask to blend the parts of the lowres movie to the higher res movie to remove the logo. So far so good.

The problem now are the missing frames. I tried to remove the logo from this frames with deblending, which works more or less well. Unfortunately the logo is not very transparent. So i've seen some leftovers.

The film has a black spot with the logo. Unfortunately not a bright spot. That's why i'm using Analyze = 4 instead of 3.

Unfortunately now a slightly flickering is visible on change from the deblended to non deblended frames (caused by the leftovers)

The question now is, if the deblending could be improved by better masks. Theoretically, I should be able to "somehow" calculate better masks because I have the film in a version without the logo (but how said in lower resolution and lower framerate), right? Unfortunately, I just lack the understanding a little.

As far as I understand i need two masks. A transparent mask and a color mask?!?

It is somehow a mystery to me how this calculated color mask, which is calculated from many frames, can work properly for much different frames.

Maybe someone have a idea and can help me.

Unfortunately, I can't give out my film. But I think it's relatively easy to build a small demo for the experts.

The avs script i currently use i've attached here.

Hope the "code" isn't that bad. I'm not yet an Avisynth expert.

VoodooFX
31st August 2020, 14:13
How do you replace parts on same frames if two clips are not same frame rate?

About deblending: I hardly understand what you are doing, so without example I can't give you an advice. Mask creation and deblending should be done only using frames with logo.
txt/avs you can post as text or on pastebin.com because attachments can take some time to get approved.

JohnDoe
31st August 2020, 21:07
Okay.. here the avs script https://pastebin.com/Un9c19D0

My solution to the different frame rates is to convert both videos to a higher frame rate. In this case it is 150Fps .. because 150/25 is 6 and 150/30 is 5 :-) ... A little SelectEvery voodoo ;)

VoodooFX
2nd September 2020, 00:16
If you can't use Analyze=3, then try Analyze=1, it can be better than Analyze=4. Sometimes you can get better deblending masks from Analyze=1 if you limit locations to analyze with trims, similar stuff what is good for Analyze=3, like more solid different luminosity objects passing through logo area ect..

real.finder
21st October 2020, 15:30
hi,

what about make the mask parameter as val? so user can feed it with any mask clip to allow moving logo mask

also is ExInpaint instead of AvsInpaint will be better? from what I see ExInpaint is faster and give better output in some usages

StainlessS
21st October 2020, 17:48
Not sure but I think that ExInpaint is less temporally stable than AvsInpaint, better for still image but not video.

real.finder
21st October 2020, 18:17
Not sure but I think that ExInpaint is less temporally stable than AvsInpaint, better for still image but not video.

so that mean ExInpaint use temporal dimension (The previous and next frame)? in stab3 (https://github.com/realfinder/AVS-Stuff/blob/9d659c02ae77bf5e823ff68f9a00a621264f87fc/avs%202.5%20and%20up/StabilizationToolsPack.avsi#L417) using stab3(mirror=15,FillBorder=2,use_exinpaint=true) will give better stability than stab3(mirror=15,FillBorder=2) (which use AvsInpaint)

StainlessS
21st October 2020, 18:35
I think that ExInpaint is purely spatial, it predicts missing parts based on spatial structure elsewhere in the same image.
If video, then spatial predictions can be quite a lot different to adjacent frames [but indiviual frames, might look good].

I've no idea what Stab() does.

real.finder
21st October 2020, 19:00
I've no idea what Stab() does.

http://avisynth.nl/index.php/Stab

it made black borders by default, so the Stab2 and Stab3 has some solutions for it

VoodooFX
22nd October 2020, 13:18
hi,

what about make the mask parameter as val? so user can feed it with any mask clip to allow moving logo mask

also is ExInpaint instead of AvsInpaint will be better? from what I see ExInpaint is faster and give better output in some usages
What I have seen from examples, ExInpaint is good for the images, that would make it bad for video. I could add separate function for it, for images.

Not sure what the use scenario would be with "val". Is there new code for an object tracking or an object recognition? How is that half python Avisynthtrackin code? Anyone tried it? Can it be incorporated to something useful?

I remember trying Stab, but couldn't manage to get the results, so dunno what it actually does...

StainlessS
22nd October 2020, 13:47
I tried Avisynthtrackin a little bit,
[original StarWars] on C3PO walking towards camera alone over the sand dunes.
Worked reasonably well, but IIRC required occasional user nudge/tweak to keep it working.
For above to have worked, it must continuously vary tracking stuff as C3PO got bigger and bigger as well as moving in frame.

Probably too much bother to be useful though.

real.finder
22nd October 2020, 14:04
What I have seen from examples, ExInpaint is good for the images, that would make it bad for video. I could add separate function for it, for images.

Not sure what the use scenario would be with "val". Is there new code for an object tracking or an object recognition? How is that half python Avisynthtrackin code? Anyone tried it? Can it be incorporated to something useful?

I remember trying Stab, but couldn't manage to get the results, so dunno what it actually does...

val in avs is not new, with it you can make the parameter accept any type of things, you can see how SMDegrain deal with prefilter parameter for example

VoodooFX
22nd October 2020, 14:06
While I'm at this thread, one comparison for the history; somewhere here in forum is semi-manual "Delogo" avs script which was aiming to do better than vdub plugin, I didn't tried it (don't like manual scripts), but from examples I have seen it did better job than other methods at the time. Here few comparison screenshots:

Original:
https://images2.imgbox.com/06/2f/Xsm8fxWn_o.png

DeLogo (avs script):
https://images2.imgbox.com/28/8d/7FuGUZKv_o.png

InpaintDelogo:
https://images2.imgbox.com/9b/52/QUcQYPzA_o.png

Original:
https://images2.imgbox.com/24/be/e6UFFL0E_o.png

DeLogo (avs script):
https://images2.imgbox.com/92/6e/XUOVe3s7_o.png

InpaintDelogo:
https://images2.imgbox.com/a7/96/FYNHENz7_o.png

VoodooFX
22nd October 2020, 16:44
val in avs is not new, with it you can make the parameter accept any type of things, you can see how SMDegrain deal with prefilter parameter for example
I meant what to do with those "any type of things"?

real.finder
22nd October 2020, 18:56
I meant what to do with those "any type of things"?

as I said "so user can feed it with any mask clip to allow moving logo mask" since now it only accept image mask path

and maybe I will add InpaintDelogo to stab3 since ExInpaint crash in x64 after refresh in avspmod and AvsInpaint give flickering borders

test codes
last.ExInpaint(FillBorders_stabi(pad=2,maskonly=true,thr=30).mt_expand(U=-255,v=-255))
last.InpaintLogo(FillBorders_stabi(pad=2,maskonly=true,thr=30).mt_expand())


so maybe your script will help if it work with mask clip :)

VoodooFX
22nd October 2020, 20:29
Ah, that's why. I would look into it if there was generally working script/plugin for an actual moving logo detection/tracking. Filling borders doesn't give an incentive when that's not a small tweak. :)
Script is using same AvsInpaint, I wouldn't expect different results. How wide those borders are and why not cut them off?

real.finder
22nd October 2020, 21:22
Ah, that's why. I would look into it if there was generally working script/plugin for an actual moving logo detection/tracking. Filling borders doesn't give an incentive when that's not a small tweak. :)
Script is using same AvsInpaint, I wouldn't expect different results. How wide those borders are and why not cut them off?

for moving logo, I think if the move not random then user can make mask using http://avisynth.nl/index.php/Animate and the logo

the borders width depend on the shaking fix and the stab settings, cut them off not always a good idea especially when you deal with 480p input that you have to cut the black borders in it and then use stab(), and it's worst if it have a big black borders up and down (16:9 in 4:3)

VoodooFX
25th October 2020, 22:14
I tried Avisynthtrackin a little bit,
[original StarWars] on C3PO walking towards camera alone over the sand dunes.
Worked reasonably well, but IIRC required occasional user nudge/tweak to keep it working.
For above to have worked, it must continuously vary tracking stuff as C3PO got bigger and bigger as well as moving in frame.

Probably too much bother to be useful though.

If it can track an object with the changing shapes, then it should track movement of the static shape object much better, no? What if such object jumps long distances? I personally don't have time to test it, left comment there https://forum.doom9.org/showthread.php?p=1926710#post1926710, maybe someone interested in such logos will give it a go.

Somewhere I've seen that you wrote some motion blending script to isolate a moving logo, did you tried to adapt it to InpaintDelogo? Every time I look at the code of ID it makes my head spin for a bit... :)
How reliable such isolation is?

...it's worst if it have a big black borders up and down (16:9 in 4:3)
That's way beyond of practical use. Imo practical threshold would be somewhere bellow ~20px.

Now I'm trying to remove a static animated logo, a running timer, that would be a bias to what you are asking for.

real.finder
26th October 2020, 01:11
That's way beyond of practical use. Imo practical threshold would be somewhere bellow ~20px.

Now I'm trying to remove a static animated logo, a running timer, that would be a bias to what you are asking for.

indeed, but I didn't mean that, I was mean after crop them and use stab

and thanks about trying support it

VoodooFX
2nd November 2020, 19:24
and thanks about trying support it
I started tinkering around it; so you want to supply there a whole clip aka dynamic mask or just a one frame mask?

There is lots of changes accumulated in the script over the year, I'll publish it after I'll add all new stuff to the manual.
I hate writing manuals, but there is no point releasing without them... :D

real.finder
2nd November 2020, 21:06
I started tinkering around it; so you want to supply there a whole clip aka dynamic mask or just a one frame mask?

There is lots of changes accumulated in the script over the year, I'll publish it after I'll add all new stuff to the manual.
I hate writing manuals, but there is no point releasing without them... :D

supply a whole clip aka dynamic mask, or it's will be better if both :)

VoodooFX
5th November 2020, 18:36
Added support for dynamic/static mask clips, just need to optimize the script for the dynamic clips.

I noticed that multi-threading now works, it runs x3-x4 faster with Prefetch(4), not sure why, is it because some changes in new LSMASH indexer or AVS+ 3.5?

kedautinh12
6th November 2020, 00:15
Added support for dynamic/static mask clips, just need to optimize the script for the dynamic clips.

I noticed that multi-threading now works, it runs x3-x4 faster with Prefetch(4), not sure why, is it because some changes in new LSMASH indexer or AVS+ 3.5?

Where your download link new ver??

VoodooFX
6th November 2020, 14:31
Encountered some weird random bug (LSMASH 20200728 + AVS+ 3.4 r2923), first I thought that's some frame inaccuracy but probably it's bug in AVS+/Overlay or AVSinpaint, need to investigate it more. Is there some script/plugin which would compare frames from two separate video files (expected to be identical) and return frame numbers of not identical frames? Or any ideas how to do such comparison?

Where your download link new ver??
It will be posted when it's ready.

VoodooFX
8th November 2020, 01:46
No ideas how to make such comparison, that would really help to pin point the bug?

Here I made another run with few steps on the output to see more what is going on and accidentally noticed this on one frame ("before" bug was different and much severe):
Proper:
https://images2.imgbox.com/80/42/mF55E4gZ_o.png
Bug:
https://images2.imgbox.com/5f/5b/xdueHoVk_o.png

Here it didn't influenced much the end result (left/bottom), but how in the hell top/right corner mask is red, feathered and "12" visible when it goes through Greyscale.Levels(127,1,128,0,255)...

poisondeathray
8th November 2020, 02:35
Is there some script/plugin which would compare frames from two separate video files (expected to be identical) and return frame numbers of not identical frames? Or any ideas how to do such comparison?


WriteFileIf with a runtime function expression like lumadifference . But there was some bugs in avs+ 3.x with this. It works in 2.6 classic. There was some discussion about this somewhere IIRC. Not sure what changed or what the exact syntax change was

Something like this works in avs+ 2.6 classic

.
.
.

Subtract(clip1,clip2)
WriteFileIf (last, "log.log", "LumaDifference(clip1, clip2)>0", "current_frame", """ ":" """, "AverageLuma")


Other approaches would be psnr . You can print out per frame PSNR in ffmpeg (should be infinity for identical frames), but that prints out every frame value. Maybe some spreadsheet or grep function to reduce to only different frames