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
27th May 2025, 23:39
Any way to use ImpaintDelogo with a logo that horizontally move slowly from left to right?
maybe there is tracking tool somewhere?


Yes, make a dynamic mask of the logo.

isidroco
12th June 2025, 22:10
Suggestion for InpaintDelogo.avsi:
Change: isHD = (x > 1024) ? true : false
To: isHD = (y >= 720) ? true : false

Because some of my HD material resized to 4:3 is 960x720 which now fails to be flagged as HD.

VoodooFX
12th June 2025, 23:17
Suggestion for InpaintDelogo.avsi:
Change: isHD = (x > 1024) ? true : false
To: isHD = (y >= 720) ? true : false

Because some of my HD material resized to 4:3 is 960x720 which now fails to be flagged as HD.

Why not (y > 576)?
Anyway, usually isHD isn't doing anything.

isidroco
13th June 2025, 01:31
Why not (y > 576)?
Anyway, usually isHD isn't doing anything.

Is used to select correct colorspace for conversions, otherwise may change correct colors/brightness:
matrixID = (isHD == true) ? "Rec709" : "Rec601"

And (y>576) seems ok to me, although any y>=720 is considered HD, not sure about a non standard resolution (ie: y=600 ).

VoodooFX
13th June 2025, 12:29
Is used to select correct colorspace for conversions...

Not only that, anyway, usually it doesn't do colorspace conversion, unless you are doing something weird, like inputting RGB video.

StainlessS
14th June 2025, 09:28
Somebody posted a thread on default matrix.
https://forum.doom9.org/showthread.php?t=169155

What I eventually used in RT_Stats for default Matrix convertsion of RGB -> YUV:

Matrix: Conversion matrix for conversion of RGB to YUV-Y Luma. 0=REC601 : 1=REC709 : 2 = PC601 : 3 = PC709,
Default = (Width > 1100 OR Height>600) then 3(PC709) else 2(PC601). YUV not used

EDIT: You may also have to guess on black bar (letterbox) cropped image.

VoodooFX
14th June 2025, 13:51
Default = (Width > 1100 OR Height>600) then 3(PC709) else 2(PC601). YUV not used


Why those weird numbers and not: "Width > 1024 OR Height > 576"?

StainlessS
14th June 2025, 17:27
That seemed to be best numbers based on linked thread.

francocho
15th June 2025, 02:53
Is there a certain number of frames that should be the target for AnalyzeTh (per 30-60 minutes of video for example)? A setting of 15 gets just over ~1000 frames for analysis on a 50-minute video but much higher settings (eg AnalyzeTh of 44 with ~55k frames for analysis) seem to produce better deblending results, despite my source being an old XviD 576p TV capture with inconsistent quality. Is there a particular sweet spot to aim for if speed is not a concern whatsoever, or is it just a matter of testing everything from 1-255 in chunks and going by eye?

VoodooFX
15th June 2025, 12:15
Is there a certain number of frames that should be the target for AnalyzeTh (per 30-60 minutes of video for example)?

No.

Is there a particular sweet spot to aim for if speed is not a concern whatsoever, or is it just a matter of testing everything from 1-255 in chunks and going by eye?

Default is that spot IMO, "16" if clip > ~30 mins, else "30".
If I'm not happy with default result then I test AnalyzeTh 16, 30, 45 and all frames with Analyze=3.

If you think that deblend could be better then try manual editing -> https://github.com/Purfview/InpaintDelogo/blob/eceb6e89cf19355b2310445edf53c10422f03a47/InpaintDelogo.avsi#L942

real.finder
3rd July 2025, 10:01
I noted that the output will be yv12 even if I use yv16, why?! IIRC all plugins used in InpaintDelogo do work with anything 8bit like yv16 or yv24

VoodooFX
3rd July 2025, 16:42
I noted that the output will be yv12 even if I use yv16, why?!

No, output will be YV16, unless your Loc is the whole frame.

IIRC all plugins used in InpaintDelogo do work with anything 8bit like yv16 or yv24

Yes, but ID does delogo only in RGB or YV12, it could support YV16 or YV24 but then lots of stuff would need lots of additional code.

And there is maybe no bigger than 0.1% or 0.01% chance that you'll encounter non-YV12 video to delogo, even smaller chance that you'll encounter such video and you'll want the end result in non-YV12. :sly:

EDIT:

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

real.finder
3rd July 2025, 17:56
No, output will be YV16, unless your Loc is the whole frame.

I think that is the problem

I didnt use it to delogo :) remember this https://forum.doom9.org/showthread.php?p=1929357#post1929357 ?

preclip.InpaintDelogo(mask=bfixc, Loc="0,0,0,0",dPP=0,dPPm=1,diPP=1,diPPm=0,oPP=1,oPPm=0,Inflate=0) (https://github.com/realfinder/AVS-Stuff/blob/d1735352a76c7abd305a1cbe4054e2535be36689/avs%202.5%20and%20up/Stab3.avsi#L68)

using stab3(mirror=15,fillborder=2,use_inpaintdelogo=true) with yv16 it will not work (scriptclip error) but stab3(mirror=15,fillborder=2) work fine

VoodooFX
3rd July 2025, 18:44
Then limit it's usage to YV12 clips with that option or use AvsInpaint directly.
You’re not going to add YV16/YV24 support to InpaintDelogo. Theoretically, you could, but you’d be in for the adventure of your life. :)

EDIT:

You can remove these, as these options doesn't apply to "inpaint" mode: dPP=0,dPPm=1,diPP=1,diPPm=1

real.finder
4th July 2025, 10:14
Then limit it's usage to YV12 clips with that option or use AvsInpaint directly.
YouÂ’re not going to add YV16/YV24 support to InpaintDelogo. Theoretically, you could, but youÂ’d be in for the adventure of your life. :)

I did a workaround using https://forum.doom9.org/showthread.php?p=1839137#post1839137 http://avisynth.nl/index.php/User:Raffriff42/Utils-r41_Quick_Reference#MatchColorFormat with mt_merge https://github.com/realfinder/AVS-Stuff/commit/d5f766c698580c4444cfcaae1823184da4976a7d but I think if InpaintDelogo work with more Color Formats will be better :)

EDIT:

You can remove these, as these options doesn't apply to "inpaint" mode: dPP=0,dPPm=1,diPP=1,diPPm=1

done :)

drunksunk
8th August 2025, 17:08
It has been running for almost an hour now...

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

VoodooFX
9th August 2025, 02:30
It has been running for almost an hour now...

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

An hour is not so long, there was some user who had it running for days. :D
Post your whole script.

BTW, if you don't want to see this then deselect: "Options>Accessing AviSyth in threads" in AvSPmod.

frobber
1st December 2025, 04:55
Hi,

I was able to use InpaintDelogo once before, but this time I'm stuck.

I'm trying to create a mask using Analyze, and probably doing something wrong.

My script:

v = BSVideoSource("\\MyMovie.mkv", fpsnum=24000, fpsden=1001)
a = BSAudioSource("\\MyMovie.mkv")
AudioDub(v,a)
#InpaintLoc(Loc="124,34,-292,-132")
InpaintDelogo(mask="C:\Program Files (x86)\AviSynth+\plugins64\Logo Database\CS-2.bmp", Automask=1, Analyze=3, Loc="124,34,-292,-132")

After I ran this, InpaintDelogo created two files: CS-2.bmp and CS-2_AutomaskTemp_A3.bmp.

The first one, CS-2.bmp is the same size as the movie, i.e., 1920 x 1080px.

Is this the mask I should use? I was expecting a smaller size, e.g., what I gave as the parameters to Loc. What about the second file? Is it needed?

Next, I try this:

InpaintDelogo(mask="C:\Users\Argento\Documents\Logo Database\CS-2.bmp", Loc="124,34,-292,-132", Interp=0, ShiftMasksHo=-1, GrainPP=2)

It seems to work, but there are some artifacts, apparently due to unexpected white spots in the mask.

How should I proceed?

VoodooFX
1st December 2025, 07:56
I was able to use InpaintDelogo once before, but this time I'm stuck.
...
How should I proceed?


I don't see any info about where you stuck. Just some random questions.


Is this the mask I should use? I was expecting a smaller size, e.g., what I gave as the parameters to Loc.

Yes. BMP basemask always has same dimensions as video input.


What about the second file? Is it needed?

If you are done with a basemask creation then "temp" is not needed anymore.


InpaintDelogo(mask="C:\Users\Argento\Documents\Logo Database\CS-2.bmp", Loc="124,34,-292,-132", Interp=0, ShiftMasksHo=-1, GrainPP=2)

Remove "ShiftMasksHo" & "Interp", no need to randomly add the parameters you found in this thread. :D

frobber
1st December 2025, 08:44
Thanks for your message.

Sorry, I thought my questions were clear, viz., all the masks from Github (https://github.com/Purfview/InpaintDelogo/tree/main/Logo%20Database) are sized to the watermarks, so that's what I was expecting. Apparently that is not the case, so thank you for clearing that up.

Next, there are artifacts in the output, apparently due to large white spots in the auto-generated mask. I was asking how to resolve that.

Idk if it's the best way to handle this, but I just edited the mask directly with GIMP, to black out those spots. The artifacts in the output are gone now.

VoodooFX
1st December 2025, 08:57
all the masks from Github (https://github.com/Purfview/InpaintDelogo/tree/main/Logo%20Database) are sized to the watermarks, so that's what I was expecting.

Those "ebmp" masks at GitHub are not "bmp" basemasks.

Next, there are artifacts in the output, apparently due to large white spots in the auto-generated mask. I was asking how to resolve that.

Adjust "aMix" when "Automask=1". If you didn't delete the "temp" files, the changes will be instant.