View Full Version : InpaintDelogo - advanced logo removal & hardcoded subtitles extraction
Espinosa
21st July 2022, 23:27
https://i.ibb.co/Hx2qDGh/image.png
VoodooFX
22nd July 2022, 00:05
That's strange, upload your InpaintDelogo.avsi to mega and share output of AVSMeter -avsinfo.
Espinosa
22nd July 2022, 08:54
https://mega.nz/file/CqhlTIoA#3vwgLFNl5oQgDrHzzrtz-nSnVZlcTanHOOfwXUP-mUo
https://mega.nz/file/ymR10JjR#pmJWpn9cGGCbVUHfrP64_EjdIJKAeRpObs1myMULcxA
Espinosa
22nd July 2022, 11:13
That's strange, upload your InpaintDelogo.avsi to mega and share output of AVSMeter -avsinfo.
Can you upload your mask.bmp file? I get this now:
https://i.ibb.co/6N1pjQ6/image.png
This is the mask I used:
https://i.ibb.co/hmGR2fn/image.png
Espinosa
22nd July 2022, 11:26
It's fine, I forgot that ~10px mask rule. I have other issues with updating Avisynth plugins but that has nothing to do with InpaintDelogo.
https://i.ibb.co/FVmq8B6/image.png
Thank you!
VoodooFX
22nd July 2022, 12:34
So what was culprit of that "unexpected character" error?
"Mask is full" is because you painted whole Loc area white, only logo should be white.
Upload your bmp & ebmp masks to mega, I'll check if everything is OK.
Espinosa
22nd July 2022, 15:30
I got lost in all these difficulties with updating but I think it's Avisynth.dll. I use MeGUI and AvsPmod, and since MeGUI uses its own core libraries the same script now runs in AvsPmod but throws the same error in MeGUI. Function objects as a new variable type is something that should be defined in the core part so I suppose it's the problem with the core libraries.
I didn't use a ebmp mask at all but judging by some examples here, I guess it should contain only the logo in order to know what to remove by inpainting and what by deblending or something like that. I'm just not sure whether it should be black & white or not. Can you explain this and also how to name it?
VoodooFX
22nd July 2022, 16:40
...but throws the same error in MeGUI.
In MeGUI set to use external Avisynth: MeGUI > Options > uncheck "Always use the included Avisynth" > Save > restart MeGUI
I didn't use a ebmp mask at all... Can you explain this and also how to name it?
ebmp masks are created and used automatically by InpaintDelogo, they are at same place where is your "bmp" basemask, and it's filename starts same as "bmp" mask's name.
Espinosa
22nd July 2022, 17:23
In MeGUI set to use external Avisynth: MeGUI > Options > uncheck "Always use the included Avisynth" > Save > restart MeGUI
Thank you.
ebmp masks are created and used automatically by InpaintDelogo, they are at same place where is your "bmp" basemask, and it's filename starts same as "bmp" mask's name.
I modified Crop parameters a little bit:
crop(266, 4, -262, -2)
These are the files:
https://mega.nz/file/rngEXJbZ#h4h0wNa58UJseAQInp9H-Q3cY9H70Oe5gK4Vu0PZqKA
https://mega.nz/file/OjYkQTpI#PwmK4yvZNgIlAWAKtXNQ9hmk6-jRFOxIPsvKiBcnCCk
VoodooFX
22nd July 2022, 20:11
These are the files:
Not bad masks, but not so good.
Try these custom masks: https://we.tl/t-yMUvpwMNk1
InpaintDelogo( mask="D:\mask4.bmp", Loc="1170,44,-0,-950", Mode="Both", Analyze=3, dPP=4, oTune=-5, oTinflate=1, Alphatweak=-3)
Your masks:
https://i.imgur.com/0uudsiW.jpeg
My custom masks:
https://i.imgur.com/u1zkaTu.jpeg
Clotibrut
22nd July 2022, 22:14
I don't understand those who remove the logo from images and videos. You don't want the person who created this video or photo to receive well-deserved compliments and praise for his work. I am a photographer, and many of my photos are becoming popular on the networks, so I created a simple logo for myself using create.vista (https://create.vista.com/create/animated-logo-maker/). Finding my photo works in other sources without my logo is extremely unpleasant. It seems to me that this is plagiarism and also very incorrect concerning me.
StainlessS
22nd July 2022, 22:26
Because they're annoying, but welcome to the forum where you will no doubt learn to be similarly annoyed :)
VoodooFX
22nd July 2022, 23:42
Why you are welcoming a new roBot? :)
StainlessS
23rd July 2022, 00:22
It's more pleasant than interacting with the natives.
VoodooFX
23rd July 2022, 00:58
It's more pleasant than interacting with the natives.
https://i.imgur.com/GSjgnAW.png
More pleasures there: https://chai.ml :)
kedautinh12
23rd July 2022, 05:27
Lol :D
Espinosa
28th July 2022, 12:08
Not bad masks, but not so good.
Try these custom masks: https://we.tl/t-yMUvpwMNk1
I didn't have time for creating masks, later will play with that. I updated all plugins but now there is a strange problem.
- InpaintDelogo after QTGMC doesn't work
- InpaintDelogo after Yadif for example works
- QTGMC not followed by InpaintDelogo works
Any idea what could be wrong?
VoodooFX
28th July 2022, 14:12
@StainlessS
Look how your beloved robot replaced his "innocent" post with ad. :)
[10£ per month for some crap :eek:]
I updated all plugins but now there is a strange problem.
- InpaintDelogo after QTGMC doesn't work
- InpaintDelogo after Yadif for example works
- QTGMC not followed by InpaintDelogo works
Any idea what could be wrong?
What happens when "doesn't work"? Share whole avs script.
Btw, can you remove that quote with images?
Espinosa
28th July 2022, 14:22
Images removed.
I have a longer script but after debugging I figured out that the problem is with QTGMC and InpaintDelogo. I was trying to run the script and encode the video but MeGUI crashes at that point.
LWLibavVideoSource("sample.mkv")
QTGMC(preset = "Slower", Sharpness=0.2)
crop(266, 4, -262, -2)
#InpaintDelogo(mask="D:\mask4.bmp", Loc="1170,44,-0,-950", Mode="Both", Analyze=3, dPP=4, oTune=-5, oTinflate=1, Alphatweak=-3)
return last
VoodooFX
28th July 2022, 14:28
Why do you run QTGMC again? Run delogo on your lossless file.
Espinosa
28th July 2022, 14:51
What do you mean by "again"? My source is interlaced, I want to deinterlace it and run delogo.
VoodooFX
28th July 2022, 14:55
Then I've no idea what you are doing there, what are those masks you posted? At this point I thought that you have deinterlaced your file...
Read this post again: https://forum.doom9.org/showpost.php?p=1972031
Espinosa
28th July 2022, 14:59
Why do I need to encode the file to lossless after QTGMC and Crop and then use InpaintDelogo? Can I simply write one script where InpaintDelogo call follows QTGMC?
VoodooFX
28th July 2022, 15:18
Can I simply write one script where InpaintDelogo call follows QTGMC?
You can, but you would be deinterlacing twice as whole video is parsed to create masks.
Espinosa
28th July 2022, 15:40
You can, but you would be deinterlacing twice as whole video is parsed to create masks.
Twice? Where does that happen?:confused:
VoodooFX
28th July 2022, 16:18
Twice? Where does that happen?:confused:
In Avisynth.
Espinosa
28th July 2022, 16:36
That doesn't make sense that QTGMC followed by InpaintDelogo does deinterlacing twice. I used QTGMC in all my scripts with interlaced sources and this is the first time I read that I need to encode twice.
VoodooFX
28th July 2022, 17:10
That doesn't make sense that QTGMC followed by InpaintDelogo does deinterlacing twice. I used QTGMC in all my scripts with interlaced sources and this is the first time I read that I need to encode twice.
Deinterlacing twice doesn't mean encoding twice. You don't "need" to do that, but for some reason you are trying to do that, maybe that's why MeGUI is crashing.
"Twice" is hypothetical, with your way you can go to any number of "empty" deinterlaces, depends from what you are doing there.
Espinosa
28th July 2022, 17:36
LWLibavVideoSource("sample.mkv")
QTGMC(preset = "Slower", Sharpness=0.2)
crop(266, 4, -262, -2)
InpaintDelogo(mask="D:\mask4.bmp", Loc="1170,44,-0,-950", Mode="Both", Analyze=3, dPP=4, oTune=-5, oTinflate=1, Alphatweak=-3)
return last
I still fail to see that this simple script can be problematic. If source file is interlaced then QTGMC should give a progressive output video file. After that InpaintDelogo should remove the logo on that file. This works with Yadif instead of QTGMC.
VoodooFX
28th July 2022, 17:48
Maybe there is not enough memory, try "Medium" instead of "Slower". Why you don't want to deinterlace to lossless file?
You didn't answered how you got those masks you posted there (https://forum.doom9.org/showpost.php?p=1972079&postcount=358).
StainlessS
28th July 2022, 20:36
@StainlessS
Look how your beloved robot replaced his "innocent" post with ad.
[10£ per month for some crap ]
How terribly perceptive of you, It did not occur to me at all the the guy/gal/gadget was as robot. [from original post content]
Espinosa, just do as VX says, from eg VDub2, set codec to eg Ut_Video [lossless code] and save as result of QTGMC to AVi,
otherwise QTGMC deinterlaced twice, is twice as slow.
[InPaintDelogo scans file twice, so it would have to deintelace twice if all done in single script].
Espinosa
28th July 2022, 20:58
Maybe there is not enough memory, try "Medium" instead of "Slower". Why you don't want to deinterlace to lossless file?
You didn't answered how you got those masks you posted there (https://forum.doom9.org/showpost.php?p=1972079&postcount=358).
No, it's not memory. I checked memory consumption in real time while running the script and 40% of it was free.
When you write "lossless file" I interpret it as "Let one script crop the video and deinterlace it, after that encode it losslessly. After that use that lossless file in another script as an input and do additional processing, including InpaintDelogo". To me this seems necessary only in case that deinterlacing can't be followed by InpaintDelogo but I don't see why such a limitation would exist. If my interpretation is not correct then please explain what you mean by "deinterlace to lossless file".
I created that base mask manually and ebmp file I got after running InpaintDelogo using the parameters from your first example. I used Yadif to deinterlace the video file.
Now I tried my script with QTGMC followed by InpaintDelogo in Virtual Dub and it works. I still don't know why it doesn't work with MeGUI. In MeGUI I can see a preview but when I try to start encoding it crashes. It looks like a problem with the encoder but it's updated and this is the first time I see such a behavior so I have no idea why that happens.
Espinosa
28th July 2022, 21:07
Espinosa, just do as VX says, from eg VDub2, set codec to eg Ut_Video [lossless code] and save as result of QTGMC to AVi,
otherwise QTGMC deinterlaced twice, is twice as slow.
[InPaintDelogo scans file twice, so it would have to deintelace twice if all done in single script].
I prefer to understand things than simply do as someone says. Since it works in VirtualDub it means that crashing has nothing to do with QTGMC-InpaintDelogo relationship. As for computational efficiency, I have no idea what InpaintDelogo does internally so I'm confused why deinterlacing happens two times.
VoodooFX
28th July 2022, 21:32
No, it's not memory. I checked memory consumption in real time while running the script and 40% of it was free.
It's not about whole memory, it's about memory per process, 2GB is a limit for 32bits, I think.
When you write "lossless file" I interpret it as "Let one script crop the video and deinterlace it, after that encode it losslessly. After that use that lossless file in another script as an input and do additional processing, including InpaintDelogo". To me this seems necessary only in case that deinterlacing can't be followed by InpaintDelogo but I don't see why such a limitation would exist. If my interpretation is not correct then please explain what you mean by "deinterlace to lossless file".
There is no such limitation, just saving your time when video is/can be parsed many times and you have a heavy filter above InpainDelogo. Most of the mask creation options parse whole video, that means all filters above InpaintDelogo are processed too. So, with lossless file you deinterlace only once, btw lossless encoding is very fast.
I created that base mask manually and ebmp file I got after running InpaintDelogo using the parameters from your first example. I used Yadif to deinterlace the video file.
Like here, you wasted time deinterlacing it, now you need to deinterlace again.
Maybe that mask wasn't so good because you used inferior deinterlacer, I dunno.
You can try Analyze=1, maybe you'll get better masks.
InpaintDelogo( mask="D:\mask.bmp", Loc="1170,44,-0,-950", Mode="Both", Analyze=1, dPP=4, oTune=-5)
VoodooFX
28th July 2022, 21:48
It did not occur to me at all the the guy/gal/gadget was as robot. [from original post content].
Yeah, bots are getting smarter, now they search forums for suitable threads to post targeted ads.
They can be spotted by semi-stupid posts, sometimes they make posts without ads just to build-up human like "ego" and then after few months starts posting targeted ads.
Eshraq Rahman
4th August 2022, 20:03
Hi
I am new to programming as well as to converting hardcoded subtitles to images and then convert them to srt. I have provided the screenshot of the error when I run the script. If anyone could help with the error I would be really appreciate it.
https://1drv.ms/u/s!Aj8vvEW_e-AYlXqRnY_JlRKMzR4M
Thank you
https://1drv.ms/u/s!Aj8vvEW_e-AYlXqRnY_JlRKMzR4M
Eshraq Rahman
4th August 2022, 20:07
I have attached a screenshot of the script and the error message
VoodooFX
4th August 2022, 23:19
Upload your image to Imgur or similar site.
Eshraq Rahman
5th August 2022, 12:03
https://imgur.com/fOEcvaT
VoodooFX
5th August 2022, 13:37
https://imgur.com/fOEcvaT
This error is because GRunT is missing, install all required plugins.
Espinosa
6th August 2022, 13:54
There is no such limitation, just saving your time when video is/can be parsed many times and you have a heavy filter above InpainDelogo. Most of the mask creation options parse whole video, that means all filters above InpaintDelogo are processed too. So, with lossless file you deinterlace only once, btw lossless encoding is very fast.
Well, you could have written that the real reason is computational efficiency and it would be enough to understand. However, I still can't figure out why all filters above InpaintDelogo need to be executed. Can you explain on one example the order of execution when InpaintDelogo follows QTGMC?
Like here, you wasted time deinterlacing it, now you need to deinterlace again.
I always use a very short sequence of frames to test a script before I get the final version, so it's not problematic.
VoodooFX
6th August 2022, 16:27
Well, you could have written that the real reason is computational efficiency and it would be enough to understand.
Isn't obvious that deinterlacing once is more efficient that deinterlacing same thing multiple times?
However, I still can't figure out why all filters above InpaintDelogo need to be executed.
Because those filters stands between InpaintDelogo and video source. That's how Avisynth works, all filters above any filter are executed.
I always use a very short sequence of frames to test a script before I get the final version, so it's not problematic.
You could write that, there was no way to know that you posted useless masks, problem is that I wasted time on useless tasks. :)
Espinosa
6th August 2022, 17:46
Isn't obvious that deinterlacing once is more efficient that deinterlacing same thing multiple times?
Because those filters stands between InpaintDelogo and video source. That's how Avisynth works, all filters above any filter are executed.
You could write that, there was no way to know that you posted useless masks, problem is that I wasted time on useless tasks. :)
Ugh, seems like we always misunderstand each other.
My main question is why does it deinterlace twice? There is one QTGMC call and it does deinterlacing. What part of the code calls it for the second time?
"...need to be executed twice" - I forgot "twice".
I don't understand where your arrogance comes from but that's your problem anyway. Masks which I uploaded I got using your parameters, not mine. I came here to ask for help and turns out I'm blamed that "my masks are useless". If helping random users of your script is useless task then you have a wrong motivation for your work.
VoodooFX
6th August 2022, 20:05
My main question is why does it deinterlace twice? There is one QTGMC call and it does deinterlacing. What part of the code calls it for the second time?
You got answer to that multiple times, I think, now I don't have time to reread posts.
Second [or last n-th] time is when you do encode, encoder calls it.
I don't understand where your arrogance comes from but that's your problem anyway. Masks which I uploaded I got using your parameters, not mine. I came here to ask for help and turns out I'm blamed that "my masks are useless". If helping random users of your script is useless task then you have a wrong motivation for your work.
You asked for help - you got the answer, masks you uploaded you got doing your own things out there, not the things you got as answer.
Don't perceive conversations with strangers online as some feelings, what you perceived as "blaming" I would describe as a sarcastic answer.
I would call "arrogance" when you complain about free things on internet. I didn't knew that helping random users is my work, I'll write that to my resume. I would like to hear your perception about the motivations. :)
PS
Maybe I'm bad at it, let's try again:
Like here, you wasted time deinterlacing it, now you need to deinterlace again.
I always use a very short sequence of frames to test a script before I get the final version, so it's not problematic.
So you waste time deinterlacing it + more time waste "to test". :)
Eshraq Rahman
8th August 2022, 11:40
This error is because GRunT is missing, install all required plugins.
Thank you
Eshraq Rahman
8th August 2022, 12:06
How to extract subtitles which are of two colors on each line and also don't display at once instead shows up like you are typing the subtitles
VoodooFX
8th August 2022, 17:59
How to extract subtitles which are of two colors on each line and also don't display at once instead shows up like you are typing the subtitles
Without video sample I can't tell.
Eshraq Rahman
9th August 2022, 11:02
Without video sample I can't tell.
https://1drv.ms/v/s!Aj8vvEW_e-AYlX0IEPoxHjvytZuy?e=FR9HYl
VoodooFX
9th August 2022, 21:53
Always share sample from original video, anyway, those blue subs are hardly visible, so you can't extract them.
https://i.imgur.com/8LDCyNw.png
EDIT:
Theoretically you can extract them, but OCR engines won't recognize what is written there...
evafans
11th August 2022, 14:05
Thank you, your script works perfect for characters with halo, but for English sub without halo, the characters often miss. Which mask do you recommend? Or is there a well-adjusted setting?
This is my setting for now, It seems fine, does it need any changes? Dyntune seems to be the key parameter to keep character complete, is there other parameter that I can use?
\ DynMask=4, DynTune=200,
\ DynMask4H=110,
\Extract=1, Show=4,
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.