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
Guilbert
11th February 2024, 23:51
Strangely, no images were extracted (on the whole movie).
https://i.ibb.co/pjHTRHM/Capture-d-cran-2024-02-11-234232.png
VoodooFX
11th February 2024, 23:56
It extracted all subtitles from your sample.
Guilbert
12th February 2024, 00:09
Indeed. Thank you, it helped a lot!
HeinrichI
14th March 2024, 11:27
Hello. Can you give me some advice? Launched analysis by command:
InpaintDelogo( mask="Unfabulous\Unfabulous.bmp", Automask=1, Loc="450,0,150,174")
4 files were created:
https://i.ibb.co/yXZ8x0c/Files.png
But when I run the preview after, with the command
InpaintDelogo( mask="Unfabulous\Unfabulous.bmp", Loc="450,0,150,174", Mode="Deblend") then instead of removing the logo, colored spots appeared:
https://i.ibb.co/pyTB92k/2024-03-14-132153.png
The logo itself:
https://i.ibb.co/KNfb4Fw/2024-03-14-132627.png
kedautinh12
14th March 2024, 13:27
You need show your mask image
HeinrichI
14th March 2024, 13:46
You need show your mask image
Unfabulous.bmp:https://i.ibb.co/kK0CFvd/Unfabulous.png
Unfabulous_AutomaskTemp_A2.bmp:https://i.ibb.co/t87G3V6/Unfabulous-Automask-Temp-A2.png
VoodooFX
14th March 2024, 14:07
Launched analysis by command:
InpaintDelogo( mask="Unfabulous\Unfabulous.bmp", Automask=1, Loc="450,0,150,174")
4 files were created:
ebmp file is not created by Automask=1.
But when I run the preview after, with the command
InpaintDelogo( mask="Unfabulous\Unfabulous.bmp", Loc="450,0,150,174", Mode="Deblend") then instead of removing the logo, colored spots appeared:
Because logo is not transparent, so there is nothing to deblend.
kalehrl
14th March 2024, 14:52
Any advice how to create a mask for this kind logo:
https://i.ibb.co/MZjYxSp/Untitled.png (https://imgbb.com/)
It is faint and the resulting automask is no good because I just get a jumbled mask like this:
https://i.ibb.co/tMNDDLZ/output3-Automask-Temp-A2.png (https://imgbb.com/)
I used this command:
InpaintDelogo(mask="D:\Videos\Encodes\output3.bmp", Automask=1, Analyzeth=70, Loc="1800,908,-36,-0", Mode="Inpaint")
HeinrichI
14th March 2024, 14:57
ebmp file is not created by Automask=1.
How to create ebmp? I still don’t understand it from the description in the script.
Because logo is not transparent
The logo is still slightly transparent, as you can see in this shot.
https://i.ibb.co/VCccTW1/102-Unfabulous-The-Secret-avi-20240314-165255-211-2.png
VoodooFX
14th March 2024, 15:18
How to create ebmp? I still don’t understand it from the description in the script.
It's created automatically by analysis on the first deblend delogo run.
The logo is still slightly transparent, as you can see in this shot.
Probably not transparent enough for video compression level. Or maybe you are doing something wrong.
VoodooFX
14th March 2024, 15:23
Any advice how to create a mask for this kind logo:
https://i.ibb.co/MZjYxSp/Untitled.png (https://imgbb.com/)
I've no idea what "this kind" means.
This image looks like any other random image.
kalehrl
14th March 2024, 16:05
I don't known how to describe it. It's very transparent and faint. The whole video file is pretty dark and automask fails to create a proper mask using the default values. Are there any advanced options which may help?
VoodooFX
14th March 2024, 16:10
Can you share the video?
kalehrl
14th March 2024, 19:44
It's 47 minutes long. How much video do you need? I need to cut it because my upload speed is slow.
EDIT: Link removed.
I hope it's enough.
VoodooFX
14th March 2024, 20:21
Use Analyze=1 or Analyze=2 with NoBorderAt="bottom".
Then for high transparency logos you want to use higher aMix when getting basemask.
kalehrl
14th March 2024, 20:59
Thank you. Those extra options did the trick.
One more question. You noticed that the video has 2 logos.
How can I create 2 masks with automask?
kedautinh12
14th March 2024, 21:22
Thank you. Those extra options did the trick.
One more question. You noticed that the video has 2 logos.
How can I create 2 masks with automask?
Make a mask first, do the second later
kalehrl
14th March 2024, 22:11
I did it that way but then I end up with 2 masks which significantly slow down the encoding.
I think having 1 mask with 2 logos will result in faster encoding.
HeinrichI
14th March 2024, 22:29
On another episode of the series, where I'm trying to remove the logo, the transparency is better, and the removal works, but at times there is colored noise, how can I reduce it?
https://i.ibb.co/NyxxtPd/2024-03-15-002328.png
https://i.ibb.co/4dyj4Vw/2024-03-15-002830.png
VoodooFX
14th March 2024, 22:44
On another episode of the series, where I'm trying to remove the logo, the transparency is better, and the removal works, but at times there is colored noise, how can I reduce it?
Try these:
Inflate=2, Optimize2=2, dPP=-5
Btw, if resolution is same then you can use these masks on that previous episode too.
VoodooFX
14th March 2024, 22:46
I think having 1 mask with 2 logos will result in faster encoding.
No, it wouldn't.
VoodooFX
15th March 2024, 04:47
Unfabulous_AutomaskTemp_A2.bmp:https://i.ibb.co/t87G3V6/Unfabulous-Automask-Temp-A2.png
You didn't left enough space at the right side, and other sides have too large borders. This can have negative impact on generation of ebmp masks.
Remove 30 pixels at left.
Add 6 pixels at right.
Remove 16 pixels at top.
Remove 40 pixels at bottom.
Floatingshed
8th April 2024, 15:45
I am getting an error message repeatedly, I don't understand.
"Source clip must have at least two frames for alpha computation"
Clip is over 18000 frames...
VoodooFX
8th April 2024, 21:58
I am getting an error message repeatedly, I don't understand.
"Source clip must have at least two frames for alpha computation"
Clip is over 18000 frames...
Share your full avs script and mask. And cut video sample if possible.
Floatingshed
9th April 2024, 14:37
Thanks for the offer of help.
Script, mask and video clip here:
https://wetransfer.com/downloads/bbd19d832769a6d3353b944c10e4afc220240409133239/eb7ce3760c7f831b0d7c00f53b234f6820240409133239/19bad1?trk=TRN_TDL_01&utm_campaign=TRN_TDL_01&utm_medium=email&utm_source=sendgrid
VoodooFX
9th April 2024, 18:27
Thanks for the offer of help.
Script, mask and video clip here:
You didn't left at least 10 pixels around logo in Loc.
The basemask is not good.
Video quality is crap - you'll have crap deblend result.
TrickyTrix
2nd August 2024, 12:56
InpaintDelogo is a fantastic tool for removing logos, but I failed to create masks for some videos below and I don't know why
https://mega.nz/folder/AsUWGaZJ#NzqG_wzzmw_BYZvd2KgPJg
I used InpaintDelogo(automask=1, mask="C:\xy\logomask.bmp", Loc="376,16,-26,-318")
but all I get is black rectangle for e10, e12, e13, e14, e15 and e16.
But interestingly enough, for e11 I get a perfect mask and I don't see any visual difference between e11 and those other e1x videos.
What could be the problem and is there a way to fix it?
VoodooFX
4th August 2024, 00:20
but I failed to create masks for some videos below and I don't know why
Short clips don't have enough suitable frames to build a good mask, as all those clips have exact same logo you should joint all them in script and then build the masks.
TrickyTrix
4th August 2024, 10:54
They are 7 minute cartoons with semi transparent Boomerang logo from 1st till the last frame, it doesn't make any sense for InpaintDelogo not to create the mask.
I tried the good mask I got on other cartoons, but since it is a logo from a TV, logo is not always in the same exact position pixel wise, so the final results are very bad.
VoodooFX
5th August 2024, 02:00
Oh I see, logo in e11 video looks like normal "blend":
https://i.imgur.com/UFmEo32.png
When logos in the other videos looks like "add blend" or whatever:
https://i.imgur.com/HyeC9Lw.png
TrickyTrix
5th August 2024, 08:53
But logo is still static and located in the same place. So, I still don't understand why InpaintDelogo won't produce a mask for it.
Floatingshed
14th August 2024, 14:22
How do we deal with a logo that fades in after the start of the programme?
If InpaintDelogo is active on pictures without logo it creates a logo.
Which 'appears' to fade out as the logo actually fades in...
VoodooFX
14th August 2024, 20:24
But logo is still static and located in the same place. So, I still don't understand why InpaintDelogo won't produce a mask for it.
It won't because InpaintDelogo is for normal logo blends, not for any other blend effects (https://en.m.wikipedia.org/wiki/Blend_modes).
Later I'll show you how to remove "add" blend logo.
How do we deal with a logo that fades in after the start of the programme?
Use inpaint mode on those fadein/out frames. Btw, and don't analyze such frames with animations.
VoodooFX
14th August 2024, 22:32
@TrickyTrix Here is how manually deblend those "add blend" logos:
# Video with "add" blend. (Not the normal blend!)
o=LWLibAvVideoSource("D:\e10.avi")
# Here we find frame with logo in solid background
m=o.trim(11267,-1).ConvertToY8
# Measure background brightness value and subtract it from the frame so background is ~0 to get the "add" mask:
addmask=m.Tweak(bright=-18, coring=false)
# Here we get the black and white basemask for PP (postprocess):
basemask=m.mt_binarize(25).crop(376,16,-26,-318)
# Here we subtract addmask from video as it's opposite of "add":
o.Overlay(addmask, x=0, y=0, mode="subtract", opacity=1)
# Hack to PP the logo remnants with InpaintDelogo
# YAlphaTweak=-255, UVAlphaFromY=1 to ensure that InpainDelogo's deblend process has no effect on the video
InpaintDelogo(mask=basemask, Loc="376,16,-26,-318", mode="deblend", YAlphaTweak=-255, UVAlphaFromY=1)
Original, Subtracted, PP:
https://i.imgur.com/esz1cxc.png https://i.imgur.com/7iPJoda.png https://i.imgur.com/iTHA57F.png
EDIT:
For the script to work get 3.8-test3 version from the test branch -> https://github.com/Purfview/InpaintDelogo/tree/test
TrickyTrix
15th August 2024, 12:36
@TrickyTrix Here is how manually deblend those "add blend" logos:
# Video with "add" blend. (Not the normal blend!)
o=LWLibAvVideoSource("D:\e10.avi")
# Here we find frame with logo in solid background
m=o.trim(11267,-1).ConvertToY8
# Measure background brightness value and subtract it from the frame so background is ~0 to get the "add" mask:
addmask=m.Tweak(bright=-18, coring=false)
# Here we get the black and white basemask for PP (postprocess):
basemask=m.mt_binarize(25).crop(376,16,-26,-318)
# Here we subtract addmask from video as it's opposite of "add":
o.Overlay(addmask, x=0, y=0, mode="subtract", opacity=1)
# Hack to PP the logo remnants with InpaintDelogo
# YAlphaTweak=-255, UVAlphaFromY=1 to ensure that InpainDelogo's deblend process has no effect on the video
InpaintDelogo(mask=basemask, Loc="376,16,-26,-318", mode="deblend", YAlphaTweak=-255, UVAlphaFromY=1)
Original, Subtracted, PP:
https://i.imgur.com/esz1cxc.png https://i.imgur.com/7iPJoda.png https://i.imgur.com/iTHA57F.png
EDIT:
For the script to work get 3.8-test3 version from the test branch -> https://github.com/Purfview/InpaintDelogo/tree/test
Thank you for pointing out different blending effects and showing me how to do this new deblending in new InpaintDelogo plugin.
Please tell me how would I measure background brightness value (I used your value for all these videos)?
Since it's a test branch it might be of use to report that on e12 you can see a gray Boomerang logo on frames around 680 and 1222, but it might be a completely normal artefact from this type of deblending, I wouldn't know.
VoodooFX
15th August 2024, 18:29
...showing me how to do this new deblending in new InpaintDelogo plugin.
InpaintDelogo doesn't do any deblending in that script... The line with "Overlay" does actual delogo.
Please tell me how would I measure background brightness value (I used your value for all these videos)?
AvsPmod (https://forum.doom9.org/showthread.php?t=175823) shows values of pixel at the bottom of the preview screen, you need the first value of "yuv".
Since it's a test branch it might be of use to report that on e12 you can see a gray Boomerang logo on frames around 680 and 1222, but it might be a completely normal artefact from this type of deblending, I wouldn't know.
It's normal artifact for such low quality videos as these.
You can use stronger postprocess settings -> "dPP=-5" & "Optimize2=2", best would be to use them only on the frames with those stronger artifacts.
Here is how to apply the different settings on the different parts of the video:
o=LWLibAvVideoSource("D:\e12.avi")
m=o.trim(10979,-1).ConvertToY8
addmask=m.Tweak(bright=-20,coring=false)
basemask=m.mt_binarize(27).crop(376,16,-26,-318)
d=o.Overlay(addmask, x=0, y=0, mode="subtract", opacity=1)
a1=d.Trim(0, 645).InpaintDelogo(mask=basemask, Loc="376,16,-26,-318", mode="deblend", YAlphaTweak=-255, UVAlphaFromY=1)
a2=d.Trim(646, 1353).InpaintDelogo(mask=basemask, Loc="376,16,-26,-318", mode="deblend", YAlphaTweak=-255, UVAlphaFromY=1, dPP=-5, Optimize2=2)
a3=d.Trim(1354, 0).InpaintDelogo(mask=basemask, Loc="376,16,-26,-318", mode="deblend", YAlphaTweak=-255, UVAlphaFromY=1)
a1++a2++a3
Enthusiast
21st August 2024, 10:09
First of all, I would like to express my gratitude for this delightful instrument. And secondly, I would like to ask for help.
I have a video with an animated black logo in the center. In some parts of the video, it is clearly visible, in some, it is not. If it were stable I could just make a mask and inpaint it. But it is moving and black as some parts of the frame. Could I somehow delete it from the video?
https://i.postimg.cc/cHgnLz0w/test-video-mp4-00-00-01-2024-08-14-12h15m53s770.jpg
https://i.postimg.cc/76FTGNZc/test-video-mp4-00-00-02-2024-08-14-12h16m28s996.jpg
Here is the sample https://file.io/pBiZAcI8d5vf
VoodooFX
21st August 2024, 13:23
But it is moving and black as some parts of the frame.
And I don't see a pattern in logo movements. Avisynth doesn't have object tracking tool...
Try Premiere or some AI tool.
Enthusiast
23rd August 2024, 08:42
And I don't see a pattern in logo movements. Avisynth doesn't have object tracking tool...
Try Premiere or some AI tool.
Is it possible to use an animated mask with Inpaint Delogo?
VoodooFX
23rd August 2024, 09:59
Is it possible to use an animated mask with Inpaint Delogo?
Yes, for example if mask has same dimensions as video:
m=LWLibAvVideoSource("D:\mask.mkv")
InpaintDelogo(mask=m, Loc="0,0,-0,-0")
Enthusiast
24th August 2024, 09:57
Yes, for example if mask has same dimensions as video:
m=LWLibAvVideoSource("D:\mask.mkv")
InpaintDelogo(mask=m, Loc="0,0,-0,-0")
Amazing, I thought it only understands BMP files!
kalehrl
25th August 2024, 10:08
Yes, for example if mask has same dimensions as video:
m=LWLibAvVideoSource("D:\mask.mkv")
InpaintDelogo(mask=m, Loc="0,0,-0,-0")
Is there an option to automatically create video like automask?
VoodooFX
25th August 2024, 19:53
Is there an option to automatically create video like automask?
Read the manual about DynMask.
Floatingshed
10th September 2024, 18:52
Read the manual about DynMask.
Are there any dynamic logo removal examples?
VoodooFX
11th September 2024, 01:13
Are there any dynamic logo removal examples?
For example: https://forum.doom9.org/showthread.php?p=1980298#post1980298
Search the thread.
Floatingshed
12th September 2024, 15:09
For example: https://forum.doom9.org/showthread.php?p=1980298#post1980298
Search the thread.
Yes, I did that before asking. I'm afraid I didn't find it very enlightening, it assumes a lot.
I am trying to remove, or at least mitigate, a very intrusive burned-in timecode. Can you please give me some easy to follow pointers?
Thanks.
VoodooFX
12th September 2024, 19:01
Yes, I did that before asking. I'm afraid I didn't find it very enlightening, it assumes a lot.
I am trying to remove, or at least mitigate, a very intrusive burned-in timecode. Can you please give me some easy to follow pointers?
There are 5 dynamic mask examples in that post, what's more to give?
Can you share a sample of your video?
dot75
1st October 2024, 17:27
Hello, can you help me? I would like to erase this logo. I can't make it transparent, the red is still visible.
https://i.postimg.cc/bSspcvM7/00624.png (https://postimg.cc/bSspcvM7)
https://i.postimg.cc/d0dT10gL/mask.png (https://postimages.org/)
InpaintDelogo( mask="C:\temp\Test\SubP2\eva4\eva5\mask.bmp",
\ Automask=0, aMix=-30,Loc="482,652,-0,-30",
\ Mode="inpaint",
\ Analyze=-3, FrW=642, FrS=0,dPP=0,Show=0, Inflate=0)
VoodooFX
1st October 2024, 21:26
InpaintDelogo( mask="C:\temp\Test\SubP2\eva4\eva5\mask.bmp",
\ Automask=0, aMix=-30,Loc="482,652,-0,-30",
\ Mode="inpaint",
\ Analyze=-3, FrW=642, FrS=0,dPP=0,Show=0, Inflate=0)
The mask doesn't look right.
Can you explain what dPP is doing there?
Btw, logo doesn't even fit into Loc.
Share the video.
dot75
1st October 2024, 21:39
The mask doesn't look right.
Can you explain what dPP is doing there?
Btw, logo doesn't even fit into Loc.
Share the video.
https://www.swisstransfer.com/d/1043a6d8-e81a-4080-9d45-1d53e635764d
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.