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
13th June 2023, 23:21
I've looked at that video, looks like logo is animated whole clip, you can't deblend it.
Just use inpaint on it.

mode=Inpaint, Turbo=-1


Before:
https://thumbs2.imgbox.com/67/a4/sh5euKEy_t.jpg (https://images2.imgbox.com/67/a4/sh5euKEy_o.jpg)

After:
https://thumbs2.imgbox.com/f0/c2/lxyAlzzZ_t.jpg (https://images2.imgbox.com/f0/c2/lxyAlzzZ_o.jpg)

drunksunk
16th June 2023, 02:50
I've looked at that video, looks like logo is animated whole clip, you can't deblend it.
Just use inpaint on it.


Nice, ty.

I didn't see it useful anywhere with positive Analyze and in general it's a nonsensical "hack".

EDIT:
Just tested now, AnalyzeTh=45 produced similar reduction on artifacts on that circle without making worse the rest of deblend like Deep:

LWLibAvVideoSource("D:\zzz.mp4")
InpaintDelogo(mask="D:\mask.bmp", Loc="1570, 904, -28, -58", Mode="Deblend", Analyze=1, AnalyzeTh=45, dPP=-5)

https://images2.imgbox.com/26/e7/WGdHdQZ8_o.png
It's amazing how good the result is with this setting, looks perfect almost everywhere except certain parts where you can slightly see the halo effect left by the logo. If I wanted to push a little further getting completely rid of the logo but risking the overlapping text becoming blurrier, what would be the setting to tweak for that?

VoodooFX
16th June 2023, 03:30
If I wanted to push a little further getting completely rid of the logo but risking the overlapping text becoming blurrier, what would be the setting to tweak for that?
Then you don't want to use "1" from Optimize2 argument which is enabled by default. Set Optimize2=2.

drunksunk
8th July 2023, 08:37
1) Get a better version of that video from here:
https://assets14.ign.com/videos/zencoder/1920/211e97c678636e1461aa50b31714e8a4-5000000-1426343076-w.mp4
(It's a 817MB file with a 5000kbps encoding rather than your 3000kbps clip)

How did you manage to find the real video location on the website? When analyzing the network traffic, the best I can find is the .m3u file of the stream for reconstructing the file using ffmpeg, but somehow you managed to find the actual mp4 source and I wonder how you did that.

Example: https://www.ign.com/articles/2015/02/06/making-bloodborne-part-1-souls-evolved-ign-first

https://assets7.ign.com/videos/zencoder/1920/022886772aa71c37e3cde38f1a188569-8000000-1426350275-w.m3u8

Also, do you think this mask would work fine for all videos as long as the type of logo to remove is the same?

InpaintDelogo(mask="D:\mask.bmp", Loc="1570, 904, -28, -58", Mode="Deblend", Analyze=1, AnalyzeTh=45, dPP=-5)

drunksunk
17th July 2023, 00:33
Can somebody tell me how to improve my mask? I use this:

InpaintDelogo(Loc="1590,910,-10,0", mask="D:\Z_DELOGO\d\mask.bmp", Automask=1, Analyze=3)

But the logo gets removed well only for left half, while right half has some extra stuff that gets captured.

File is THIS (https://drive.google.com/file/d/1HJYJcKSfH-jo9jDHGWmknC3Ood0yHkHr/view?usp=drive_link)

VoodooFX
17th July 2023, 13:50
Is that logo only last for 13 seconds?

These settings produce good basemask:


LWLibAvVideoSource("D:\file.mp4")

InpaintDelogo(Loc="1600,912,-20,-6", mask="D:\morbid.bmp", Automask=1, Analyze=-4, FrB=136, aMix=-5)


https://i.imgur.com/2S7CnsG.png

drunksunk
19th July 2023, 21:26
What about this other video (https://drive.google.com/file/d/1X2y6QhmfpaINpHYnTUKaT03IE-D_DlzC/view?usp=sharing)?

I used this:

InpaintDelogo(Loc="1540,870,-70,-30", mask="D:\Z_DELOGO\e\mask.bmp", Automask=1, Analyze=-4, aMix=-5)

But I noticed there are still some small white particles left. Trying to tweak the aMix does never trully give perfect result all-around.

VoodooFX
19th July 2023, 22:53
What about you "answering" questions with questions?

drunksunk
29th July 2023, 17:24
What about you "answering" questions with questions?

Yes, sorry that was only 13s indeed.

drunksunk
29th July 2023, 18:02
I think I found a bug in InpaintDelogo when using portable (loose files) AviSynth+ installation instead of Windows installer: https://i.imgur.com/uLkcWJ9.png

VoodooFX
29th July 2023, 18:35
I think I found a bug in InpaintDelogo when using portable (loose files) AviSynth+ installation instead of Windows installer: https://i.imgur.com/uLkcWJ9.png

It's not a bug, it's a message telling you what to do:
"Load 'ImageSeq.dll' with 'LoadPlugin' or install Avisynth+."

drunksunk
29th July 2023, 18:52
It's not a bug, it's a message telling you what to do:
"Load 'ImageSeq.dll' with 'LoadPlugin' or install Avisynth+."
The fact is that AviSynth+ is installed, but it's installed as loose files and it's references inside AvsPmod settings in "Custom AviSynth directory".

drunksunk
29th July 2023, 19:19
After months I'm still unable to automask correctly...

What am I doing wrong? Mask looks perfect, but when applied the end result is garbage... https://i.imgur.com/wakI9KN.png

Automask=1, mode="Deblend", Analyze=2

Clip is THIS (https://drive.google.com/file/d/1j9yOsgfBCaj40Qcj-zS3Rr1rKhxaOgKZ/view?usp=drive_link)

drunksunk
30th July 2023, 01:40
The problem is that there is no legend with alla the parameters, possible values and what they do.

VoodooFX
30th July 2023, 12:23
The fact is that AviSynth+ is installed, but it's installed as loose files and it's references inside AvsPmod settings in "Custom AviSynth directory".
The real fact is that you didn't installed AviSynth+, you just copied files and plugins are not autoloaded, in such case you need to load them manually with LoadPlugin().

What am I doing wrong? Mask looks perfect, but when applied the end result is garbage... https://i.imgur.com/wakI9KN.png

Automask=1, mode="Deblend", Analyze=2

The basemask is not important for the actual deblending process.
Automask just creates a black/white basemask which is enough only for Inpaint, for Deblend additional deblending masks are auto-created on the first run when Automask is not on.
With "Analyze=2" on this short clip you don't get good deblending masks, that's why you get the garbage result.

The problem is that there is no legend with alla the parameters, possible values and what they do.
The real problem is that you don't read what is posted for you.
I remember answering you multiple times what and where to read.

After months I'm still unable to...
Unable to read posts!? Just kidding... :D

drunksunk
30th July 2023, 13:38
The real fact is that you didn't installed AviSynth+, you just copied files and plugins are not autoloaded, in such case you need to load them manually with LoadPlugin().



The basemask is not important for the actual deblending process.
Automask just creates a black/white basemask which is enough only for Inpaint, for Deblend additional deblending masks are auto-created on the first run when Automask is not on.
With "Analyze=2" on this short clip you don't get good deblending masks, that's why you get the garbage result.


The real problem is that you don't read what is posted for you.
I remember answering you multiple times what and where to read.


Unable to read posts!? Just kidding... :D
I looked at GitHub, looked at first post, etc. but couldn't find the entire list of parameters like you can for ffmpeg and other tools, so I don't know what dPP, Interp, Optimize, AnalyzeTh, aMix, etc. do. Generally when you download an OSS tool you get either get a file with all the instructions or they have a website with the documentation on how to use the tool.

Could you please suggest what parameters should I use for the best result and why you chose those parameters to help me understand the thought process?

VoodooFX
30th July 2023, 14:24
I looked at...
Maybe 6th will be your lucky number. :)

Here you go, links to 5 previous answers I found:

https://forum.doom9.org/showthread.php?p=1987281
https://forum.doom9.org/showthread.php?p=1986329
https://forum.doom9.org/showthread.php?p=1986315
https://forum.doom9.org/showthread.php?p=1986329
https://forum.doom9.org/showthread.php?p=1986299

drunksunk
30th July 2023, 14:53
Maybe 6th will be your lucky number. :)

Here you go, links to 5 previous answers I found:

https://forum.doom9.org/showthread.php?p=1987281
https://forum.doom9.org/showthread.php?p=1986329
https://forum.doom9.org/showthread.php?p=1986315
https://forum.doom9.org/showthread.php?p=1986329
https://forum.doom9.org/showthread.php?p=1986299

So, since the logo is almost completely opaque, I cannot use Deblend on it? With Inpaint I get much better results but there are still some leftover artifacts.

VoodooFX
30th July 2023, 15:18
I have no idea what you mean and I don't see any logical connection to the post you quoted.

drunksunk
30th July 2023, 21:08
I have no idea what you mean and I don't see any logical connection to the post you quoted.
I meant that by looking at documentation in the script, I read that Deblend is only valid for transparent logos, while the video I provided has basically opaque logo so that doesn't work well. I tryed all previous settings and none of them could remove the logo without being slightly noticeable using the Inpaint mode.

VoodooFX
30th July 2023, 21:30
If you mean "bilibili" logo then it's transparent, there is not enough good frames for analysis, even if there were enough, that AV1 video is so much damaged by compression that you wouldn't get good Deblend results anyway.

Actually all videos you posted here are very low or low quality, just use Inpaint on them.

drunksunk
30th July 2023, 22:09
If you mean "bilibili" logo then it's transparent, there is not enough good frames for analysis, even if there were enough, that AV1 video is so much damaged by compression that you wouldn't get good Deblend results anyway.

Actually all videos you posted here are very low or low quality, just use Inpaint on them.

Are there extra parameters I could you to improve the final result or just an Analyze=2 and then apply the mask with mode=Inpaint is all I can do? I tried also DoomDelogo but that's worse.

VoodooFX
30th July 2023, 22:56
Check if Turbo=-1 makes it better.

TrickyTrix
3rd August 2023, 22:42
I used InpaitDelogo with great results a few times with Inpaint mode.
Now I wanted to try Deblend mode on https://www.youtube.com/watch?v=XOiZGSkjygs (ignore the color logo in the beginning and in the end because I'll edit that out later)

My script:
LWLibAvVideoSource("F:\Sheepish_wolf\The_Sheepish_Wolf_(1942).mp4")
InpaintDelogo(automask=0, mask="F:\Sheepish_wolf\logomask.bmp", Loc="1510,886,-178,-100", mode="Deblend")

Mask is created with: InpaintDelogo(automask=0, mask="F:\Sheepish_wolf\logomask.bmp", Loc="1510,886,-178,-100")

Is it normal that you can see transparent defects on dark surfaces after running the script (for instance from 49 to 51 sec)? It's great as is, but I have to ask :)

VoodooFX
4th August 2023, 06:53
Share the masks.
Deblend defects are expected on the low quality videos from Youtube.

TrickyTrix
4th August 2023, 16:36
Here is the mask.

VoodooFX
4th August 2023, 16:47
Don't use attachments in this forum, you can upload to wetransfer or mega ect.
By "masks" I meant .ebmp file.

TrickyTrix
4th August 2023, 19:00
Don't use attachments in this forum, you can upload to wetransfer or mega ect.
By "masks" I meant .ebmp file.
Here it is:
https://mega.nz/file/8sURVQIb#_n7LlV9litR-_DB8k-_Zp6ln2lsbnHma50FAKoTspWs

VoodooFX
4th August 2023, 19:51
Don't know why but I got a lil bit better masks: https://we.tl/t-ULUDdL4gQV

Original vs My vs Yours [with Interp=0, dPP=0 to see pure deblend effect]:

https://i.imgur.com/crpyr0q.png https://i.imgur.com/9UG9pmZ.png https://i.imgur.com/BNVlakE.png

Maybe you didn't excluded non-logo/logo-animation parts when doing analysis. [.mp4 I downloaded is ~180MB]


...can see transparent defects...

I guess it's like on the 2970 frame:

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

It looks like usual Youtube "damage", you could ask the utube uploader for the original undamaged video.

"Optimize2=2, IntSpd=3, dPP=-5" can make it look better like this:

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

But it will make blurry detailed areas where deblending is OK.
You can apply different delogo settings on different parts of video by using Trim().

EDIT:
You can use .ebmp file directly with mask argument -> mask="D:\_mask.bmp_InpaintDelogo3_1510-886-178-100_A2-30.ebmp"

drunksunk
6th August 2023, 00:07
If you can get Deblend mode to just fades the logo a bit but not fully remove it, what setting do you need to tweak to make the removal harder and remove that last bit of transparency? video is this https://t.ly/YXgW1

color
7th August 2023, 17:34
https://i.ibb.co/6F1BM0J/New-File-12-010027.jpg

It has worked perfectly with one color logos, but this...I can get rid of the white (blended away), but the black one is more problematic.

https://we.tl/t-mSWMlUf1yy

I am using the standard thingie:

InpaintDelogo(mask="logo.bmp", Loc="760,580,-90,-50", Mode="Deblend", Automask=0)

kedautinh12
7th August 2023, 23:32
With this logo, i think use mode Inpaint is better

VoodooFX
8th August 2023, 00:45
If you can get Deblend mode to just fades the logo a bit but not fully remove it, what setting do you need to tweak to make the removal harder and remove that last bit of transparency?
If you can't deblend it then you can't. Use Inpaint.

VoodooFX
8th August 2023, 00:59
It has worked perfectly with one color logos, but this...I can get rid of the white (blended away), but the black one is more problematic.

https://we.tl/t-mSWMlUf1yy

Both black and white areas looks same for me.
Before vs After [frame 13585 after trim]:

https://i.imgur.com/bdMCqBx.png https://i.imgur.com/VvTnfZF.png


LWLibAvVideoSource("D:\New File (12).avi")
Trim(118,30904) # Exclude non logo/logo animation for analysis
InpaintDelogo(mode="Deblend", mask="D:\CN.bmp", Loc="12,18,-18,-16")

color
8th August 2023, 08:51
Both black and white areas looks same for me.
Before vs After [frame 13585 after trim]:

https://i.imgur.com/bdMCqBx.png https://i.imgur.com/VvTnfZF.png


LWLibAvVideoSource("D:\New File (12).avi")
Trim(118,30904) # Exclude non logo/logo animation for analysis
InpaintDelogo(mode="Deblend", mask="D:\CN.bmp", Loc="12,18,-18,-16")


Thats what I use, but it looks a bit like this I mean.

I missed the image, sorry:

https://i.ibb.co/9wrwC1m/ss.jpg

optimizer does blur it a little and makes it a little bit more invisible, but not that great.

https://i.ibb.co/k0MrNCH/New-File-12-025794.jpg

frame 025794 when using the "trim"

VoodooFX
8th August 2023, 17:39
Then use Inpaint. Read there about utube videos -> https://forum.doom9.org/showthread.php?p=1990401

color
8th August 2023, 18:07
Then use Inpaint. Read there about utube videos -> https://forum.doom9.org/showthread.php?t=176860

hmm, well inpaint does not look so good. It was recorded directly from tv, but I guess its not enought to get better results. It need to be raw as well.

VoodooFX
8th August 2023, 18:17
It was recorded directly from tv, but I guess its not enought to get better results.
Did you captured original digital stream or recorded it to some lossless codec?

color
8th August 2023, 18:23
Did you captured original digital stream or recorded it to some lossless codec?

Capture the original stream on the hard drive in my DVD-recorder (when I had that one, many years ago), I did choose 720p as resolution, I thought it would give better result, it was more than 10 years ago now. I don't remember if it was through hdmi or scart however, but If i remember correctly hdmi was the only way to be able to save 720, It did give better result when selecting to burn on dvd it gave crisper image than using 576 at the beginning when recording...

VoodooFX
8th August 2023, 18:54
So, not the original digital stream and not lossless.

katzenjoghurt
11th August 2023, 10:48
When I was thinking about "Turbo" argument I had idea to dowsample stuff then inpaint, maybe such approach would work here.

Hi VoodooFX.
Are planning to implement some pre-downsamped inpainting feature one day?

I think it would help to reduce distraction from inpainting noise.
I noticed: The higher the resolution the more distracting wrong reconstructions in inpainting become.

I tried to fight that with blur... but it didn't help too much. Couldn't achieve enough blurryness.

If I reduce UHD videos to FullHD inpainting works a lot better... but of course I'd rather like to keep the video in UHD.

VoodooFX
11th August 2023, 17:06
New version v3.7:

# Version 3.7 : 2023/08/11. Fixed: Broken "YColorSolidIns" arg [code typo].
# Fixed: Bug with "isHD" variable.
# Added 'Mask' path check before running 'Automask'.
# New params: "UVAlphaFromY", "SubPrefix", "SubPostfix".
# Removed "colors_rgb.avsi" dependancy.
# Changed "mShow" to red instead of black.


Are planning to implement some pre-downsamped inpainting feature one day?

Back then I looked at it and it seemed so much work to fully implement it...
I'll check today if some quick limited implementation is possible.

katzenjoghurt
11th August 2023, 17:11
Thanks for considering, VoodooFx! :thanks:

VoodooFX
11th August 2023, 17:33
Thanks for considering, VoodooFx! :thanks:

Just counted, there are 121 arguments, and some with a double function crammed in... I guess it would be no harm for another one. :D
How we name it? Maybe "Turbo2"?

VoodooFX
12th August 2023, 01:16
I noticed: The higher the resolution the more distracting wrong reconstructions in inpainting become.

I tried to fight that with blur... but it didn't help too much. Couldn't achieve enough blurryness.

Do you adjust inpainting settings? Defaults are tuned for SD - HD, Turbo=-1/-2 are more for HD-UHD.

Check the test branch for Turbo2: ;)


# Int "Turbo2" : Pre-downsampled inpainting, sets an resolution divisor for Loc area and masks.
# Meant to speedup inpainting, and improve delogo with the big masks/resolutions.

VoodooFX
12th August 2023, 18:43
With Turbo2 you can get similar effect like with Uglarm but much faster.

Here some comparison with the benchmark results:

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


Previous sample is "720p", here the hole is in "4K":

https://thumbs2.imgbox.com/ca/c0/JZy1ms32_t.jpg (https://images2.imgbox.com/ca/c0/JZy1ms32_o.jpg)


EDIT:
Remember that with high Turbo2 you need to have bigger borders around logo, like ~8 * Turbo2.

katzenjoghurt
13th August 2023, 16:55
Wow. Didn't expect you'd add it THAT fast. Thanks so much, VoodooFX!!
I'll try it out as soon as I can.

Do you adjust inpainting settings? Defaults are tuned for SD - HD, Turbo=-1/-2 are more for HD-UHD.


Yes, I did.

drunksunk
13th August 2023, 23:29
If you can't deblend it then you can't. Use Inpaint.

Isn't that I just suck at deblending? If I can remove it but there's still a bit of transparency left, I think it's because I'm using the wrong settings.

katzenjoghurt
13th August 2023, 23:54
A super general question but I still dare to ask it here:

I'm only diving into VapourSynth recently due to some substantial speed benefits I get with AI / GPU frame interpolation there.
So, don't laugh... I'm a total VS noob.

Is there any existing way to "wrap" InpaintDelogo so that it can be used with VapourSynth?
(Not asking for a port)

Tried to make InpaintDelogo run with AvsProxy (https://github.com/sekrit-twc/avsproxy) but that eventually failed due to 64bit dependencies... *headscratch*

VoodooFX
14th August 2023, 01:29
Isn't that I just suck at deblending? If I can remove it but there's still a bit of transparency left, I think it's because I'm using the wrong settings.

Could be.
No one knows as you never post full avs scripts nor delogo files/masks.