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

VoodooFX
22nd November 2021, 16:58
When I initially made a black image for Automask, then ran it, the mask color appeared as a blue (0,0,255 RGB) in my particular image editor (it was black in another image viewer, though).
You don't create images for Automask. Automask creates images for you. I've no ideas how Black can be Blue...

The other reason that I say it wasn’t a mix-up with VDub’s DeLogo is because, from a user standpoint, VDub’s DeLogo doesn’t require a user-created mask. All you need do is to capture the image, open the image in a image editor, and paint the logo red (255,0,0 RGB).
In your second sentence you describe how you make "a user-created mask" for VDub's Delogo...

That may be an idea for simplifying InpaintDelogo for users, since you are de-constructing VDub’s DeLogo and looking for improvement ideas.
VDub mask has four colors for user to use: Blue, Red, Green and Black. That's way more complex than simply Black and White. I can't reduce colors count further. :D

dot75
22nd November 2021, 18:29
automask work via

InpaintDelogo( mask="E:\Mask15.bmp",
\ Automask=0, aMix=0, Loc="1018,920,-248,-106",
\ Mode="Inpaint",
\ Analyze=4, FrB=499, FrW=800, FrS=0,show=1)

https://imgur.com/a/iRGknHF

VoodooFX
22nd November 2021, 19:13
automask work via
You can still see logo outlines, that's because the mask doesn't cover all upscaled artifacts in your video. Try Inflate=2.
Btw, with Analyze=4 a white frame [FrW] is not used.

dot75
22nd November 2021, 19:24
still artifacts


InpaintDelogo( mask="E:\Mask15.bmp",
\ Automask=0, aMix=0, Loc="1018,920,-248,-106",
\ Mode="Inpaint",
\ Analyze=4, FrB=499, FrW=800, FrS=0,show=1,Inflate=2)

https://imgur.com/a/1SC2mkD

VoodooFX
22nd November 2021, 20:21
still artifacts
I don't see any, looks ok.

Danette
22nd November 2021, 21:07
I think we’re getting twisted-up in semantics:

You don't create images for Automask. Automask creates images for you. I've no ideas how Black can be Blue...

Yes, I know about Automask creating the image/mask. It did create the black mask background with the white logo. It was my image editor that, somehow, reads that black creation of Automask as blue. Then, when I make the manual mask using blue (assuming that was ok), I found that it works with InpaintDelogo, even though it isn’t a black mask background. I guess that InpaintDelogo will work with any pure RGB mask color as long as there isn't such purity in any other part of the image.

This blue mask background was confirmed to be blue by other image editors. If you’re interested in trying this blue version, I can send the file, but you could probably do it as easily by creating the blue mask with your own editor. It’s not an issue, just a point of curiosity.

In your second sentence you describe how you make "a user-created mask" for VDub's Delogo...

Not exactly. There is no mask aspect necessary, from a user standpoint, in VDub’s DeLogo. It is the actual frame image, as it appears in, e.g.; AvsPmod, that is used by VDub’s DeLogo, not a black, blue, etc. colored mask image. The only thing the user needs to do is to paint the logo red. VDub’s DeLogo then takes that and, presumably, creates a mask out of it internally, out of sight from the user.

VDub mask has four colors for user to use: Blue, Red, Green and Black. That's way more complex than simply Black and White. I can't reduce colors count further. :D

Black and white are fine, as mentioned above. However, I think that InpaintDelogo can also handle, at least, blue, as well. I have not tested other two RGB colors. Again, just a point of curiosity/interest.

That would be nice. You can try to make a thread at Avisynth Development (https://forum.doom9.org/forumdisplay.php?f=69), maybe someone would be interested in making such tracking or someone secretly has such plugin.

Surprise: see the comment by wonkey_monkey here: https://forum.doom9.org/showthread.php?p=1957958#post1957958

VoodooFX
22nd November 2021, 22:41
It was my image editor that, somehow, reads that black creation of Automask as blue.
What is that image editor?


If you’re interested in trying this blue version, I can send the file

No need, any image is binarized according to levels [whatever numbers I did put there].


Not exactly. There is no mask aspect necessary, from a user standpoint, in VDub’s DeLogo. It is the actual frame image, as it appears
If you don't understand what mask means, that doesn't make a mask not a mask. :)


not a black, blue, etc. colored mask image. The only thing the user needs to do is to paint the logo red.

That's for opaque logos, for transparent one there are four colors for a mask.

Danette
23rd November 2021, 00:43
The image editor is an old version of Ulead PhotoImpact.

Perhaps I don’t understand what a mask is, as you said. When we paint the logo, that is the mask …correct?

What I have found is that, for both color and B&W videos, if I use a saved image of a video frame and simply paint the logo gray or white, with the PhotoImpact mask tool, it works without having a black base layer. This is similar to VDubs DeLogo, except that white or gray is used to paint the logo instead of red. Do you see anything wrong with this approach to using InpaintDelogo?

BTW: wonkey_monkey is looking for examples of moving logos within a video, in case you can provide any. The link is in a previous post.

VoodooFX
23rd November 2021, 02:06
Do you see anything wrong with this approach to using InpaintDelogo?
If programs tell you to use black and white and you paint there god knows what, do you think it's right? Is Black color against your religion or something, what is the problem? :D

This is similar to VDubs DeLogo
It's opposite of "similar", in VDub you do as instructed - paint mask red, when in here against all instructions you paint some random colors. Why you don't paint some random stuff in VDub's masks?
I don't understand, at all...

Danette
23rd November 2021, 03:17
It's opposite of "similar", in VDub you do as you instructed - paint mask red, when in here against all instructions you paint some random colors. Why you don't paint some random stuff in VDub's masks?
I don't understand, at all...

This was taken out of context. Vdubd DeLogo instructions are quite clear and easy to understand.

Sorry to cause frustration, but the InpaintDelogo instructions leave much to be desired in terms of guidance. So, we are left to our own devices in terms of choosing a color for manual mask creation. I’d be very interested if you could point me to any part of the manual where it states what color to paint the logo and whether or not the background/base should be a certain color. I started with RGB, black and white. After much trial and error, I came up with gray and white as those colors that work for painting the logo.

From what I can tell of the instructions, virtually all guidance is for Automask, but Automask performs rather poorly on every video that I’ve thrown at it. Using the Automask base of black caused my image editor to exhibit a blue base. Not all image editors appear to be created equally so, when you expect black, but get blue, you work with that, since it does the job. With no instruction for manual mask creation apparent, I look for trial and error solutions. From this process, I found that the black base seems to work no better than an original video image. I was simply asking for confirmation that the process I stumbled upon, when not using Automask, was ok given what you know of the code.

Much of the problems that many are struggling with on this thread could be avoided by providing a step-by-step guide on manual mask creation.

I'll back away and follow the progress as others squeeze info out in this thread.

Incidentally: you were quite helpful on other issues and I thank you for that.

VoodooFX
23rd November 2021, 15:21
Vdubd DeLogo instructions are quite clear and easy to understand.
Yes they are, still you didn't understood that you are making a mask and that there are more colors than Red for it.

I’d be very interested if you could point me to any part of the manual where it states what color to paint the logo.
That is in the first sentence about it:

# val "mask" : File based mask:
# Full path to the base mask of the logo, a B/W picture (Logo -> white).

Automask performs rather poorly on every video that I’ve thrown at it... black, but get blue...
Maybe you are doing something wrong, maybe there is a bug, maybe it can be improved, or not. Without examples I don't know.

Danette
23rd November 2021, 23:48
Thanks for the response. I wasn’t expecting it.

I did see the “B/W picture (Logo -> white)” in the manual, but didn’t realize that it was code for: “create a black base with the logo painted white.” I suggest changing that code to the plain-English version I just posted, or something similarly clear. When I read the manual, where it says “B/W picture” I assumed that a B/W picture (black and white as opposed to color) was to be used. Here is an example of a “B/W picture”: https://postimg.cc/jwQyP4gB. This is how I discovered that InpaintDelogo works using that as the “C:\mymask.bmp”. Where I had only a color image, I assumed that Greyscale() could be employed to create the “B/W picture.” I had no idea what “(Logo -> white)” meant. I do now.

I’m not worried about the Automask-generated black base showing as blue in my image editor. I now know that the base should be black if I use Automask and can deal with that. I’m also not worried about the Automask feature, since I won’t be using it. If you are asking, for your own benefit, for examples, to see how it fails on my videos, I’ll be happy to provide examples. However, it seems that Automask is an unreliable method for sufficiently covering a logo, from what I’ve read by other posters confirming my own experience with it. So, I’m happy just making my own manual masks.

What I had an interest in knowing, as per my previous post, is whether or not, in your opinion, using the base without any solid color, such as in the link posted above, presents any problem in your mind. I suspect that you may have been unaware that InpaintLogo does work on a video without needing a black base, much like VDubs DeLogo. As an example; when I take the image in that link, above, and paint the logo white, and then use that in the “C:\mymask.bmp”, it seems to perform exactly as compared to when I make a black base. My reason for doing this is to simply save time in mask creation.

VoodooFX
24th November 2021, 13:13
That's a greyscale image in your example, if you have no idea what something means then you need to ask on forum. I'll change it in the manual to be more specific.

I'm fully aware how InpaintDelogo works, of course images with random colors supplied as masks can have problems. If something seems to work doing against instructions that's called a foolproof design. Looks like I need to change that too. ;)

Can you generate and show a mask with Automask from video in that example you've posted, and one you made with editor?

VoodooFX
25th November 2021, 19:26
However, it seems that Automask is an unreliable method for sufficiently covering a logo, from what I’ve read by other posters confirming my own experience with it.
I've searched this whole thread and except yours I found only one feedback about Automask:


First of all I must say that the Automask feature works well.

Then I tried Automask on one frame example you have shared. Works well for me:

https://i.imgur.com/wyRJR25.png
Mask from Automask:
https://i.imgur.com/2s57pO4.png
Delogo:
https://i.imgur.com/DJBK2eT.png

Danette
26th November 2021, 15:02
I've searched this whole thread and except yours I found only one feedback about Automask

A quick search shows the same issue in post #125, where Automask apparently had the same problem. In post #126, you suggested that the poster edit the Automask image to improve it. I ran into the same issues and, rather than go through the Automask processing and subsequent editing, it made more sense, to me, to just create the mask manually.

No need to pursue this aspect further, as I think we are going in circles, needlessly, in doing so.


Can you generate and show a mask with Automask from video in that example you've posted, and one you made with editor?

I didn’t run Automask on one image/frame. I ran it on the entire video. There are three images in this link: https://postimg.cc/gallery/9TH71fG/627b6e3e

The script I used is this:

#InpaintLoc(Loc="514,370,-28,-30")
InpaintDelogo(Loc="514,370,-28,-30",Automask=1,mask="C:\Users\Main\Desktop\Capture\MTS Logo Templates\TV Land.bmp")
#InpaintDelogo(mask="C:\Users\Main\Desktop\Capture\MTS Logo Templates\TV Land.bmp", Loc="514,370,-28,-30", Mode="InPaint")

Running Automask on the video generated the mask labeled “BW Automask Mask” and you can see that the upper left part of the main logo is not masked. However, there are large areas to the right of the logo and below the logo that are erroneously masked. The result of using this mask on the video can be seen in the image labeled “BW Automask Results” where the logo is showing through as a result of that missing section where the upper left part of the main logo is not masked. The false masking, to the right and below the logo, will then cover non-logo parts of other frames in the video.

The image labeled “BW Editor Manual Mask” is the mask I created with my image editor and it works perfectly when used in InpaintDelogo processing. Note that this image is not a black base. It is what I would do with VDubs DeLogo, but using a white mask instead of red.

Again, don’t make adjustments for my sake. I am content making manual masks (it’s faster and better). However, if you want additional tests from me, I’ll be happy to help.

VoodooFX
26th November 2021, 16:30
A quick search shows the same issue in post #125, where Automask apparently had the same problem.
Automask is to create a mask for a logo not to some upscaled artifacts like there.

I ran it on the entire video.
So you have selected the wrong method for your task.
Are words from the manual not clear about this: "doesn't produce good results"?

Btw, in v2.0[WIP] there are new smart auto Analyze modes, actually I deleted all old Analyze code, the manual analysis modes too.
Dunno, maybe I need to return manual modes, hard to decide without checking stuff in practice.

EDIT:
OK, I decided to return them. :)
But as old manual and new auto Analysis stuff is not intercompatible then dunno when it will be released...

Danette
26th November 2021, 17:34
So you have selected the wrong method for your task.
Are words from the manual not clear about this: "doesn't produce good results"?

Btw, in v2.0[WIP] there are new smart auto Analyze modes, actually I deleted all old Analyze code, the manual analysis modes too.
Dunno, maybe I need to return manual modes, hard to decide without checking stuff in practice.

EDIT:
OK, I decided to return them. :)
But as old manual and new auto Analysis stuff is not intercompatible then dunno when it will be released...

Don’t do this simply because of my comments. As I said, I won’t be using Automask and others may prefer it as it is.

Yes, "doesn't produce good results" does mean something. It means it may or may not work. From my viewpoint, why spend the time with Automask when I can just make a manual mask, in a fraction of the time, that is guaranteed to work. Who knows, maybe the new smart auto Analyze modes would not be prone to this variability, but I just don’t see the value in it.

You have a great code, overall. By being able to get a good, simple, delogo function in Avisynth script, you've given us a great time savings over having to run it through Vdub. My suggestion is to not get hung-up on the Automask issue. I much prefer your earlier comments regarding the idea to incorporate all masks into one file or, maybe, incorporating what wonkey_monkey may be on the verge of delivering.

VoodooFX
4th December 2021, 22:16
Harder, Better, Faster, Stronger v2.0:


# Version 2.0 : 2021/12/04. AviSynth+ v3.7.1 or later & FrameSel plugin is required.
# New: Old Deblend delogo is superceded by the new superior one.
# New: Smart frames selection for analyze using "AnalyzeTh" & "NoBorderAt" parameters.
# New: "Automask" adapted to the new stuff and it doesn't reanalyze when "aMix" is adjusted.
# New: "Show" 7/8/9.
# Note: Old Deblend is saved as negative "Analyze",
# -3/-4 should be same as old, -1/-2 were augmented by the smart frames selection.


Advantages of new delogo will be mostly noticeable on damaged logos (E.g. overcompressed, re-re-re-encoded videos).
So here are some comparisons on such one. x3 upsized, no PP (except last one):

Top row: Original logo & rm_logo/InpaintFunc
Bottom row: InpaintDelogo old, InpaintDelogo v2.0 & InpaintDelogo v2.0 with default dPP=3, Interp=2

https://i.imgur.com/4txTAn3.png https://i.imgur.com/dAaf4hr.png
https://i.imgur.com/qHWMOXa.png https://i.imgur.com/jkp34HL.png https://i.imgur.com/VDheMF5.png

As there are less artifacts then maybe I'll lower PP defaults (btw, for anime Interp shouldn't be used, maybe maximum 1).

Some other before/after frames (no PP):

https://i.imgur.com/38O1t1c.png https://i.imgur.com/Kt4TZn1.png
https://i.imgur.com/ZJorBEY.png https://i.imgur.com/IGT3n3X.png

Old Automask & new Automask:
https://i.imgur.com/JAqC1d7.png https://i.imgur.com/SsFWCdx.png

And benchmarks (video: 720p , H264, 00:18:25):
Automask (old) - 00:01:50
Automask (v2.0) - 00:01:37

Analyze old - 00:03:36
Analyze (v2.0) - 00:02:52

Deblend old - 196 FPS
Deblend (v2.0) - 352 FPS

Happy delogo! ;)

VoodooFX
6th December 2021, 01:43
I was asked to make comparison to "lgd", so here it's: Left InpaintDelogo & right Makki's lgd:

https://i.imgur.com/jkp34HL.png https://i.imgur.com/ldOgPCb.png
https://i.imgur.com/ZJorBEY.png https://i.imgur.com/dg42T3r.png
https://i.imgur.com/IGT3n3X.png https://i.imgur.com/YYHYNSx.png


Good frames found (Threshold 30) & analysis time:
ID v2.0: 10643 frames - 00:02:52
LGD: 7647 frames - 00:05:02

Benchmark:
Deblend ID v2.0 - 352 FPS
Deblend LGD - 380 FPS


Looks almost same, InpaintDelogo has more precise the good frames search so it found more frames.

But, it's simple logo and Makki's delogo can do only simple logos, enough to move logo to the frame's border or letterbox and it fails to do proper analysis:

https://i.imgur.com/jkp34HL.png https://i.imgur.com/UfhjkFg.png

Forget about color and variable transparency logos with lgd. Here is InpaintDelogo v2.01 on my delogotest sample:

https://i.imgur.com/MYOiAWw.gif

Download DelogoTest video (https://drive.google.com/uc?export=download&id=1z-8NpTILUkKnjeAtV-sR66w9l0Z4FmRa) for delogo tests, and ID v2.01 command:
InpaintDelogo( mask="D:\mask.bmp", Automask=0, aMix=-1, Loc="10,16,-6,-20", Mode="Both", Analyze=3, Interp=0, oTune=-10)

VoodooFX
10th December 2021, 22:16
# Version 2.02 : 2021/12/10. Fixed: "Analyze=1" bug.
# +11% deblend speed-up.
# Tweaked "aMix". "Analyze=2" is default. Adaptive "AnalyzeTh" default [16 or 30].
# Don't search frames for analyse if 'txt' file is present and ReAnalyze=0.
# Version 2.01 : 2021/12/05. "Analyze" 3 option.

quochuyonnet
12th December 2021, 18:20
Could i have ver 1.48 link please? i'm using avisynth 2.60

VoodooFX
12th December 2021, 18:31
Could i have ver 1.48 link please? i'm using avisynth 2.60

All versions from v1.24 are on GitHub:

https://github.com/Purfview/InpaintDelogo/commits/main/InpaintDelogo.avsi

Two buttons at the right side there will bring you to "that" version.

quochuyonnet
12th December 2021, 19:49
Thank you for answer i've downloaded v1.48 avsi file.

Edit: I've install Gimport, but still can not call InpaintDelogo Function inside AvsPmod
LoadCPlugin("C:\Program Files (x86)\AviSynth\plugins\AVSInpaint.dll")
GImport("C:\Program Files (x86)\AviSynth\plugins\InpaintDelogo.avs")

Update: I'm able to use function by typed it manually in AvsPmod, I saw it did good with static logo, could InpaintDelogo help delogo which is moving/ has faded away slowly effect?

quochuyonnet
12th December 2021, 20:38
Do you've any idea to deal with this moving logo?
https://youtu.be/5ZKuJJaqCDE

VoodooFX
12th December 2021, 22:56
For parts where logo is static but "fades away" use "Inpaint" mode. For moving parts you can try one of dynamic methods.
Share sample of original video.

Inolga
13th December 2021, 15:55
Hi !

Thanks VoodooFX for you great work !

Version 1.48 was working good but every time I try to load the v2.02 with MeGUI, I have an error :

https://i.imgur.com/xdYxlg2.jpg

I have all the requirements, up to date :

https://i.imgur.com/GTS26se.jpg



I'm using ffms2 to load my source video

Thanks for your help

VoodooFX
13th December 2021, 17:10
Version 1.48 was working good but every time I try to load the v2.02 with MeGUI, I have an error :

I think that error is from v2.01.

Try AvS+ v3.7.1 test build 34 https://forum.doom9.org/showthread.php?p=1958925#post1958925

What is masktools2 version? Post your full script and the mask file.

quochuyonnet
13th December 2021, 17:21
this is original video which i've used for test delogo has moving and fades away effect.
https://youtu.be/sQvmLppMU_s

VoodooFX
13th December 2021, 17:33
this is original video which i've used for test delogo has moving and fades away effect.
https://youtu.be/sQvmLppMU_s
Anything uploaded to youtube is not original anymore and it looks cropped.

quochuyonnet
13th December 2021, 17:44
yes, it's only a small clip i've used for testing delogo has moving effect. Here is another host
https://ufile.io/ra46waxn
p/s: i've tried "dynamic mask" as a crop clip with resolution same as "Loc" area, but got "Crop: Destination width is 0 or less (C:\...Inpaintdelogo.avs, line 1296)" error.

StainlessS
13th December 2021, 18:22
"Crop: Destination width is 0 or less (C:\...Inpaintdelogo.avs, line 1296)" error.
I dont know what your crop numbers are, but see here:- https://forum.doom9.org/showthread.php?p=1893966#post1893966
for MakeLoc(), allows more flexible coords


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: To Reply 2 posts later,
our Left/Top/Width/Height coords patch is included from v1.13
OK, thanks.

VoodooFX
13th December 2021, 19:03
yes, it's only a small clip i've used for testing delogo has moving effect. Here is another host
https://ufile.io/ra46waxn

Here is script for v2.03 (for v1.48 you would need to change "128" to "1" at line 989):

o=LSMASHVideoSource("D:\logoorg.mp4")

c1 = o.Trim(0,2)
c2 = o.Trim(3,3).InpaintDelogo(Loc="0,0,-0,-0", Dynmask=2, Dyntune=42, DynInflate=3)
c3 = o.Trim(4,5).InpaintDelogo(Loc="0,0,-0,-0", Dynmask=2, Dyntune=45, DynInflate=3)
c4 = o.Trim(6,136).InpaintDelogo(Loc="0,0,-0,-0", Dynmask=2, Dyntune=50, DynInflate=2)
c5 = o.Trim(137,139).InpaintDelogo(Loc="0,0,-0,-0", Dynmask=2, Dyntune=20, DynInflate=2)

c1+c2+c3+c4+c5


Result:
https://i.imgur.com/wsUhYOc.gif
For 1 & 2 frames use image based mask[s].


p/s: i've tried "dynamic mask" as a crop clip with resolution same as "Loc" area, but got "Crop: Destination width is 0 or less (C:\...Inpaintdelogo.avs, line 1296)" error.

Post full script, try latest InpaintDelogo version.

VoodooFX
13th December 2021, 19:34
I dont know what your crop numbers are, but see here:- https://forum.doom9.org/showthread.php?p=1893966#post1893966
for MakeLoc(), allows more flexible coords

Your Left/Top/Width/Height coords patch is included from v1.13. ;)

Inolga
14th December 2021, 12:19
I think that error is from v2.01.

Try AvS+ v3.7.1 test build 34 https://forum.doom9.org/showthread.php?p=1958925#post1958925

What is masktools2 version? Post your full script and the mask file.

Thanks !

It seems that the problem is that MeGUI doesn't load automatically all the plugins in the MeGUI/tools/avisynth_plugin and MeGUI/tools/avs/plugins (the difference between these 2 folders is not clear to me...)

So I had to install the UN-portable version of Avisynth+ and then InPaint Delogo 2.02 is working :)

Any idea why MeGUI doesn't load automatically the plugins which are in MeGUI/plugins folders ?
Cause IMO, it's much more convenient to use the portable version of Avisynth+

VoodooFX
14th December 2021, 13:27
Any idea why MeGUI doesn't load automatically the plugins which are in MeGUI/plugins folders ?
Cause IMO, it's much more convenient to use the portable version of Avisynth+

Portable Avisynth+ can autoload plugins, but from installed Avisyth folders.
Now, after you've installed AvS+ and plugins to its folders, you can use MeGUI's portable version and it will autoload plugins (installed AvS version can be different).

That error looks like wrong plugin version loaded, not that it's not loaded [strange error, maybe some CUDA version of masktools?]:

https://i.imgur.com/xdYxlg2.jpg

StainlessS
14th December 2021, 13:36
the difference between these 2 folders is not clear to me...
So far as I know, MeGUI/tools/avisynth_plugin is used by standard MeGUI tools (those available by megui menus) and loaded by MeGUI when it knows they are required
for eg Deinterlace or whatever - dont think is intended as autoload plugs directory for whatever you put in there, only for builtin MeGUI functionality.

MeGUI/tools/avs/plugins, looks to be for external plugins that may once have been builtin avisynth filters, but were made external as seldom used.
[The plugs contained there are usually auto copied to Plugins directory when using standard Avisynth installer, eg DirectShowSource.dll].

General auto load of plugins is an Avisynth job, not MeGUI job, and apart from anything else, MeGUI does not set an autoload folder,
a portable eg USB stick installed MeGUI cannot really alter system registry to set the autoload folder. [usually done during Avisynth setup].

You might want to use Avs+ AddAutoloadDir(), but would need to use in every script, [set to MeGUI/tools/avs/plugins and copy your plugins there],
but I would find that more awkward than using system wide setup of Avisynth.
See:- http://avisynth.nl/index.php/AviSynth+#Plugin_Autoloader

Lastly, current Avs+ needs new Avs+ wrapper when used with MeGUI,
https://forum.doom9.org/showthread.php?p=1913117#post1913117

quochuyonnet
14th December 2021, 13:48
Thank you, it's worked perfectly when logo is brighter than background of clip. I've tried with background has higher brightness and result is the logo is still seeable
https://youtu.be/NNKqYhPCG04
This is original file without delogo
https://ufile.io/ajoiae88

Inolga
14th December 2021, 14:31
That error looks like wrong plugin version loaded, not that it's not loaded [strange error, maybe some CUDA version of masktools?]:

The weird thing is that I use the same version of masktools2.ddl (x86, 2.2.29) when using the "portable" version of avisynth (I get this error message), that the one I use with the normal "installed" version of avisynth (no error message). In the first case, when I manually load the plugin in my script, this error disappears but others appear (probably cause I need to manually load the other required plugins).

Portable Avisynth+ can autoload plugins, but from installed Avisyth folders.
Now, after you've installed AvS+ and plugins to its folders, you can use MeGUI's portable version and it will autoload plugins (installed AvS version can be different).

Thanks for your explanation. It is more convenient for me to use "portable" version of avisynth+ 2.7.1 into the MeGUI folder cause I already have avisynth 2.5 installed on my PC (with a 2.5 avisynth.dll file in the SysWOW64 folder). I need this 2.5 version to be on my PC ("system wide" setup) cause I use it within an installed MPC-HC and madVR configuration which calls for this 2.5 avisynth version in order to apply upscaling filters when I play films on my 4K TV.


So far as I know, MeGUI/tools/avisynth_plugin is used by standard MeGUI tools (those available by megui menus) and loaded by MeGUI when it knows they are required
for eg Deinterlace or whatever - dont think is intended as autoload plugs directory for whatever you put in there, only for builtin MeGUI functionality.

MeGUI/tools/avs/plugins, looks to be for external plugins that may once have been builtin avisynth filters, but were made external as seldom used.
[The plugs contained there are usually auto copied to Plugins directory when using standard Avisynth installer, eg DirectShowSource.dll].

General auto load of plugins is an Avisynth job, not MeGUI job, and apart from anything else, MeGUI does not set an autoload folder,
a portable eg USB stick installed MeGUI cannot really alter system registry to set the autoload folder. [usually done during Avisynth setup].

You might want to use Avs+ AddAutoloadDir(), but would need to use in every script, [set to MeGUI/tools/avs/plugins and copy your plugins there],
but I would find that more awkward than using system wide setup of Avisynth.
See:- http://avisynth.nl/index.php/AviSynth+#Plugin_Autoloader

Lastly, current Avs+ needs new Avs+ wrapper when used with MeGUI,
https://forum.doom9.org/showthread.php?p=1913117#post1913117


Thanks a lot for all these explanations ! I already tried this AddAutoloadDir() command in my script after I saw a post about it in other forum (videohelp I think) but it didn't work, plugins weren't loaded. I'll try again using the explanations in the link you provided :).

For AVS+ wrapper, I have already replaced the one in the MeGUI folder with the good one (1.0.217.2).

VoodooFX
14th December 2021, 16:08
Thank you, it's worked perfectly when logo is brighter than background of clip. I've tried with background has higher brightness and result is the logo is still seeable
https://youtu.be/NNKqYhPCG04
This is original file without delogo
https://ufile.io/ajoiae88

DynMask=2 is just simple method to be used where dynamic logo is brighter than background, and DynMask=3/4 methods for the subtitle like dynamic logos.
You can poke wonkey_monkey with your original samples there -> https://forum.doom9.org/showthread.php?p=1957958
And there is Animate filter-> http://avisynth.nl/index.php/Animate

As you are in luck with your video and have sample with most of the logo animation in dark background then you can construct dynamic mask and apply it on different parts of your video.
Example on the same[previous] sample:

o = LSMASHVideoSource("D:\logoorg.mp4")

m1 = o.Trim(3,3) .InpaintDelogo(Loc="0,0,-0,-0", DynMask=2, DynTune=42, DynInflate=3, Show=4)
m2 = o.Trim(4,5) .InpaintDelogo(Loc="0,0,-0,-0", DynMask=2, DynTune=45, DynInflate=3, Show=4)
m3 = o.Trim(6,136) .InpaintDelogo(Loc="0,0,-0,-0", DynMask=2, DynTune=50, DynInflate=2, Show=4)
m4 = o.Trim(137,139).InpaintDelogo(Loc="0,0,-0,-0", DynMask=2, DynTune=20, DynInflate=2, Show=4)
constructedDynmask = m1+m2+m3+m4

c1 = o.Trim(0,2)
c2 = o.Trim(3,139).InpaintDelogo(Loc="0,0,-0,-0", mask=constructedDynmask, DynMask=1)
c1+c2


It has same result as the script I posted before, but now you can apply "constructedDynmask" on different parts of your video.

You can even join-in the image based masks for frame 1 & 2 if you want, with something like that:

img1 = ImageReader("D:\mask1.bmp",0,0).ConvertToY8(matrix="PC.601").AssumeFPS(30)
img2 = ImageReader("D:\mask2.bmp",0,0).ConvertToY8(matrix="PC.601").AssumeFPS(30)
constructedDynmask2 = img1+img2+constructedDynmask.AssumeFPS(30)

VoodooFX
14th December 2021, 16:26
The weird thing is that I use the same version of masktools2.ddl (x86, 2.2.29) when using the "portable" version of avisynth (I get this error message), that the one I use with the normal "installed" version of avisynth (no error message). In the first case, when I manually load the plugin in my script, this error disappears but others appear (probably cause I need to manually load the other required plugins).



Thanks for your explanation. It is more convenient for me to use "portable" version of avisynth+ 2.7.1 into the MeGUI folder cause I already have avisynth 2.5 installed on my PC (with a 2.5 avisynth.dll file in the SysWOW64 folder). I need this 2.5 version to be on my PC ("system wide" setup) cause I use it within an installed MPC-HC and madVR configuration which calls for this 2.5 avisynth version in order to apply upscaling filets when I play films.

AvS v2.5 is veeery dated, can't you get madVR working with AvS+?
I've no idea what plugins madVR is using, maybe it's safe for you to copy AvS+ plugins to your AvS v2.5 folders.
And with this old AvS instalation you would need to load ImageSeq in your script [when using MeGUI's portable]:
Loadplugin("D:\MeGUI\tools\avs\plugins\ImageSeq.dll")

Inolga
14th December 2021, 17:55
AvS v2.5 is veeery dated, can't you get madVR working with AvS+?
I've no idea what plugins madVR is using, maybe it's safe for you to copy AvS+ plugins to your AvS v2.5 folders.
And with this old AvS instalation you would need to load ImageSeq in your script [when using MeGUI's portable]:
Loadplugin("D:\MeGUI\tools\avs\plugins\ImageSeq.dll")

Here are the avisynth plugins installed on my setup using MPC-HC + madVR (this one : https://www.kazcorporation.com/la-config-kaz=) :

https://images4.imagebam.com/47/4e/19/ME5LF4Y_o.JPG

https://images4.imagebam.com/db/7b/bb/ME5LETU_o.JPG

I tried to put avs+ plugins into this avs 2.5 plugins folder but now I have this error when I try to use Inpaint Delogo :

https://images4.imagebam.com/3e/5d/0a/ME5LEX3_o.JPG

From what I understand I guess it's because MeGUI now uses the 2.5 avisynth.dll file which is in SysWOW64. So I tried to replace this file with the 2.7.1 version, but now I have this error when playing my video :

https://images4.imagebam.com/ff/a3/58/ME5LF55_o.JPG

So I'm not sure that my video playing setup can coexist with Inpaint Delogo. So I guess I'm forced to find a way to use Inpaint Delogo with a portable avisynth+, isn't it?

VoodooFX
14th December 2021, 18:29
It's v3.7.1, not v2.7.1.
To get info about your AvS installation and plugins use AVSMeter (https://forum.doom9.org/showthread.php?t=174797): "Avsmeter.exe -avsinfo".
You should run MeGUI with portable option enabled in settings, and don't replace Avisynth files in non portable folders.
About MadVR you can ask there: https://forum.doom9.org/showthread.php?t=146228

Inolga
14th December 2021, 20:48
It's v3.7.1, not v2.7.1.
To get info about your AvS installation and plugins use AVSMeter (https://forum.doom9.org/showthread.php?t=174797): "Avsmeter.exe -avsinfo".
You should run MeGUI with portable option enabled in settings, and don't replace Avisyth files in non portable folders.
About MadVR you can ask there: https://forum.doom9.org/showthread.php?t=146228

Yes I mean 3.7.1 sorry
Ok, I'll continue to find a way, thanks again for your help !

VoodooFX
14th December 2021, 21:35
Post Avsmeter info, post your full script, then we can tell what you are doing there.

quochuyonnet
15th December 2021, 05:19
Yes, i've given this case to wonkey_monkey for his testing.
Thank you for a useful way although constructedDynmask is not perfect in some circumstances. In this case i've tested KillBlobs=7 with Dynmask=2, Dyntune=150 giving a better result.

VoodooFX
15th December 2021, 09:11
Thank you for a useful way although constructedDynmask is not perfect in some circumstances.
I guess that's because duplicates in your video. 30 FPS is weird fps for video. Try to dedupe first before delogo.

coolgit
15th December 2021, 10:25
Inolga, I use MadVR and the latest avisynth+ and no issues at all. Works as intended. Try installing MadVR again and follow the quirky instructions without any deviation.

Inolga
22nd December 2021, 17:33
I finally managed to get the last portable version of avisynth working in MeGUI with last version of Inpaint Delogo, while the 2.5 avisynth version is still installed on my PC for MadVR.

To get it working, I added these two line at the top of my script :

ClearAutoloadDirs()
AddAutoloadDir("C:\Users\***\Desktop\MeGUI\tools\avs\plugins")

Thanks again for your precious help !

katzenjoghurt
29th December 2021, 22:16
Hey. :) This new version seems to work much better for me than last time, when I tried it with inpaint and UHD material. *thumbsup*

But I’m still struggling with getting Deblend to… well deblend in all areas.
The logo disappears well on a dark scene or on white background… but on colored backgrounds it’s still well visible/readable.
Well… actually it seems to matter which part of the video you analyze. If you do the analyze step on a certain section it may blend well there… but worse with other backgrounds.
I don’t know how it works internally but from a naïve view it feels like some more sophisticated color mapping could do wonders. Feels like there’s just not enough information to adapt to too many different backgrounds. But probably that’s nonsense.

Anyway… is there some promising way to tweak this?
dPP seemed to help a lot to make the deblended logo adapt to the color tones of different backgrounds - at the cost of losing most details due to blurring.

Before that I just did the basic steps… (out of my head):
Analyze with:
InpaintDelogo(mask="C:\Mask.bmp", Loc="…", mode= "Deblend", Automask=1, Analyze=2)
Deblend with:
InpaintDelogo(mask="C:\Mask.bmp", Loc="…", mode= "Deblend")


Btw… I guess there’s a major thing I didn’t understand yet:
As the doc says Automask would only work with Analyze=2, when would I ever use Analyze=1 then?
Why would I do an analyze pass without creating an automask? :confused:

VoodooFX
30th December 2021, 10:37
Hey. :) This new version seems to work much better for me than last time, when I tried it with inpaint and UHD material. *thumbsup*
But since your last post there is nothing changed in Inpaint mode that would visually impact it. Can you post comparison examples what is "better" now?

But I’m still struggling with getting Deblend to… well deblend in all areas.
The logo disappears well on a dark scene or on white background… but on colored backgrounds it’s still well visible/readable.
Well… actually it seems to matter which part of the video you analyze.
Without samples of video and script I can't help you. Maybe video is overcompressed + logo is hardly transparent, maybe you are doing something wrong.
You should analyze whole video where logo is, not some parts.

Btw… I guess there’s a major thing I didn’t understand yet:
As the doc says Automask would only work with Analyze=2, when would I ever use Analyze=1 then?
Why would I do an analyze pass without creating an automask? :confused:

Analyze when you create the base mask [with Automask=1] and Analyze for actual delogo with Deblend does the two different things, for Deblend it creates Alpha/Color masks.
Analyze=2 is default, no need to add it to a script then.
Btw, Analyze options are the different frame selection methods, and if you ran same option before with Automask=1 then the frame selection result is reused when Analyze runs again for Alpha/Color masks.
Analyze=1 should be more precise, but usually you won't see a difference, in some rare cases it can be helpful.