View Full Version : DeSubtitle with InpaintDelogo
I am trying to "inpaint" the subtitle from a film that was released with burned in subtitles. :/
I am using SubsMask2Img and extract the subtitles, however, it does miss "one word" mostly in few places.
1. How do I use this in the InpaintDelogo to inpaint?
2. How can I get the timecode (xml?) so I can run in ocr?
I'm running this to extract the subtitles.
SubsMask2Img( ImgDir="C:\Users\MyUserName\Downloads\subs", CorrTh=0.8, SubTune=200, DetWinPercW=10, DetWinPercH=60, DetWinHoPos=0, SubMinDur=12, SubSusDur=0, SubMinLuma=0.05, SubSusLuma=0, ImgType="png", ImgInflate=0, ImgInvert=0, ImgSize=1, RawAvr=1 )
VoodooFX
7th May 2023, 12:43
I am using SubsMask2Img and extract the subtitles, however, it does miss "one word" mostly in few places.
Your SubsMask2Img settings looks weird, cut and share ~10 mins of your video [including missed word]. And share your InpaintDelogo settings too.
1. How do I use this in the InpaintDelogo to inpaint?
Disable a mask preview [Show=0] and it should do inpainting.
2. How can I get the timecode (xml?) so I can run in ocr?
"Timecode" is already in the filenames of your extracted files.
Your SubsMask2Img settings looks weird, cut and share ~10 mins of your video [including missed word]. And share your InpaintDelogo settings too.
Disable a mask preview [Show=0] and it should do inpainting.
I don't really know what I am doing, it ask for extension for mask, but don't know how I should formulate it.
I send you the video to your PM, I am not allowed to share this.
SubsMask2Img( ImgDir="C:\subs", CorrTh=0.8, SubTune=200, DetWinPercW=10, DetWinPercH=60, DetWinHoPos=0, SubMinDur=12, SubSusDur=0, SubMinLuma=0.05, SubSusLuma=0, ImgType="png", ImgInflate=0, ImgInvert=0, ImgSize=1, RawAvr=1 )
InpaintDelogo(mask="C:\subs", Show=0, Automask=0, aMix=0, Loc="400,900,-400,-40", Mode="inpaint", Sharpness=60, preBlur=2.1, postBlur=12.6, Radius=16, oPP=-3, Optimize=0)
(added show but get a error:
https://i.ibb.co/9NP7md2/
"Timecode" is already in the filenames of your extracted files.
I noticed this, It is possible to create a text with the timecodes just through cmd or powershell when I think about it. I need to check a bit into this what software can handle this and maybe some does support them directly.
VoodooFX
7th May 2023, 17:52
Looks like you are doing random things there. :)
Did you used SubsMask2Img on original video? It extracts from a mask, so you need to create/set a mask first.
What are the crop settings used to crop that sample you sent me?
Looks like you are doing random things there. :)
Did you used SubsMask2Img on original video? It extracts from a mask, so you need to create/set a mask first.
What are the crop settings used to crop that sample you sent me?
.Crop(400,900,-400,-40)
Yes, I don't know what I am doing. :)
Send new PM uncroped if that might help?
VoodooFX
7th May 2023, 18:42
Here is command to inpaint subs on your video [tuned only to that short sample, no guaranty that it's good for the whole video]:
InpaintDelogo(Loc="400,890,-400,-20", DynMask=4, DynInflate=4, Turbo=-1)
Before:
https://i.imgur.com/NAi0i36.jpeg
After:
https://i.imgur.com/LYzPi87.jpeg
VoodooFX
7th May 2023, 19:05
Here is command to extract subs from your video [tuned only to that short sample, no guaranty that it's good for the whole video]:
InpaintDelogo(Loc="400,890,-400,-20", Show=4, DynMask=4, Extract=1, ImgSize=2, ImgDir="D:\SubImages")
Result:
https://thumbs2.imgbox.com/14/2a/mVNTKOWy_t.png (https://images2.imgbox.com/14/2a/mVNTKOWy_o.png)
To OCR extracted images use Subtitle Edit and nOCR method there.
Here is command to inpaint subs on your video [tuned only to that short sample, no guaranty that it's good for the whole video]:
Before:
https://i.imgur.com/NAi0i36.jpeg
After:
https://i.imgur.com/LYzPi87.jpeg
I tried this but it only blury the text:
InpaintDelogo(Loc="400,890,-400,-20", DynMask=4, DynInflate=4, Turbo=-1)
EDIT: I thought I had to create the "extraction" with SubsMask2Img first then use the images created as a mask in InpaintDelogo. So yeah...I didn't know what I was doing. :P
VoodooFX
8th May 2023, 08:08
I tried this but it only blury the text
I've no idea what that means.
I've no idea what that means.
Well my english is a bit bad, sorry, but it does blurry the text, it does not remove, only make it "out off fuccus". I also tried Mode=inpaint, but it does nothing.
https://i.ibb.co/sKhH4St/Sk-rmbild-130.png
VoodooFX
8th May 2023, 08:29
That's why you should cut and share a sample of original video, instead of sending me God knows what. :)
Why you can't share a sample? It looks like consumer media, not some master.
That's why you should cut and share a sample of original video, instead of sending me God knows what. :)
Why you can't share a sample? It looks like consumer media, not some master.
I did send you through PM.
I am using:
InpaintDelogo(Loc="400,890,-400,-20", DynMask=4, DynInflate=4, Turbo=-1)
but don't know what more to do, it just show up blurry, does it help to send the blurry exported file you mean? I did send you a print screen right now. Don't know why it removes the subtitle when you do it but when i use the same code it does not.
VoodooFX
8th May 2023, 08:49
I did send you through PM.
There is nothing received in my PM box.
does it help to send the blurry exported file you mean?
No, I meant a sample of the original video. I can recreate same "export" on my end.
EDIT:
Share your full avs script too.
EDIT2:
Check if you are using latest InpaintDelogo version.
There is nothing received in my PM box.
No, I meant a sample of the original video. I can recreate same "export" on my end.
EDIT:
Share your full avs script too.
EDIT2:
Check if you are using latest InpaintDelogo version.
I did share the full script on your PM about one hour ago. I will send full file as well.
I did update all plugins and now it works. Might have had one outdated.
VoodooFX
8th May 2023, 16:04
I did share the full script on your PM about one hour ago. I will send full file as well.
Nothing from "one hour ago", but got one after your last post.
I'm not gonna download gigabytes of "full file" when a short sample is enough.
There you can learn how to cut videos: https://www.youtube.com/watch?v=4ior3zoZ7b0
Your script looks OK. What is your InpaintDelogo version?
Nothing from "one hour ago", but got one after your last post.
I'm not gonna download gigabytes of "full file" when a short sample is enough.
There you can learn how to cut videos: https://www.youtube.com/watch?v=4ior3zoZ7b0
Your script looks OK. What is your InpaintDelogo version?
Don't know but I updated all.
StainlessS
8th May 2023, 20:44
Don't know but I updated all.
From here:- https://github.com/Purfview/InpaintDelogo/blob/main/InpaintDelogo.avsi#L1
##================================================================================================##
# #
# ____ _ __ ____ __ #
# / _/___ ____ ____ _(_)___ / /_/ __ \___ / /___ ____ ____ #
# / // __ \/ __ \/ __ `/ / __ \/ __/ / / / _ \/ / __ \/ __ `/ __ \ #
# _/ // / / / /_/ / /_/ / / / / / /_/ /_/ / __/ / /_/ / /_/ / /_/ / #
# /___/_/ /_/ .___/\__,_/_/_/ /_/\__/_____/\___/_/\____/\__, /\____/ #
# /_/ /____/ #
# #
##================================================================================================##
# InpaintDelogo is an advanced logo and watermark removal function using inpainting and deblending
# with an adjustable fine process to hide artifacts and get best delogo results.
# Can remove opaque, transparent, semi-transparent and some dynamic logos from video.
# Can be used to remove hardcoded subtitles or extract them to images for OCR.
# Inpainting refers to the application of sophisticated algorithms to reconstruct of lost
# or deteriorated parts of images or videos.
##================================================================================================##
# Version: 3.6 <<<=========== #
##================================================================================================##
color
18th June 2023, 15:16
I have a new..similar problem. I got a old vhs-video that I don't manage, maybe this will not work?
https://we.tl/t-WIerLAfaHH
also there is a light grey background behind the text.
this is the best i get:
InpaintDelogo(Loc="60,450,-60,-30", DynMask=4, DynInflate=10, Turbo=-1)
https://i.ibb.co/NTNGQcd/New-File-1-012151.png
EDIT: this is the full script:
LWLibavVideoSource("VHS.mkv")
QTGMC(Preset="Very Slow", Sharpness=1.0, InputType=0, FPSDivisor=1, ShowSettings=false)
BicubicResize(720, 576)
#.Crop(30,450,-30,-30)
InpaintDelogo(Loc="60,450,-60,-30", DynMask=4, DynInflate=10, Turbo=-1)
Frank62
18th June 2023, 20:22
Looks as if the negative coordinates don't work like in Crop.
VoodooFX
18th June 2023, 23:46
https://i.ibb.co/NTNGQcd/New-File-1-012151.png
LWLibavVideoSource("VHS.mkv")
QTGMC(Preset="Very Slow", Sharpness=1.0, InputType=0, FPSDivisor=1, ShowSettings=false)
BicubicResize(720, 576)
#.Crop(30,450,-30,-30)
InpaintDelogo(Loc="60,450,-60,-30", DynMask=4, DynInflate=10, Turbo=-1)
DynMask4 is for subtitles with halo, there is no halo in your subs.
You need to read the manual about DynMask and finetune a mask in a script like this:
LWLibAvVideoSource("D:\1991 - Den vite vikingen VHS (del1)-002 (1)-001.mkv")
v=BicubicResize(720, 576).Crop(0,22,-12,-64)
o1=v.InpaintDelogo(Loc="60,428,-70,-0", Show=4, DynMask=6, Dyntune=110)
o2=v.InpaintDelogo(Loc="60,428,-70,-0", Show=4, DynMask=7, DynTEdge=1, DynTEdgeThY=10)
o3=v.InpaintDelogo(Loc="60,428,-70,-0", Show=4, DynMask=3, Dyn3Seq=50, Dyntune=110, DynTEdge=1, DynTEdgeThY=10)
Stackvertical(
\ v.crop(60,428,-70,-0),
\ o1.ConvertToYV12().AddBorders(0,2,0,0,$F0F080),
\ o2.ConvertToYV12().AddBorders(0,2,0,0,$F0F080),
\ o3.ConvertToYV12().AddBorders(0,2,0,0,$F0F080))
This is what you see from the above script:
https://i.imgur.com/YaIUIVy.png
For example, the same frame as you posted: [EDIT: noticed is not same frame, but some frame nearby]
[ Dyn3Seq=50 assumes that there are no shorter sub than 2 seconds ]
LWLibAvVideoSource("D:\1991 - Den vite vikingen VHS (del1)-002 (1)-001.mkv")
BicubicResize(720, 576).Crop(0,22,-12,-64)
InpaintDelogo(Loc="60,428,-70,-0", DynMask=3, Dyn3Seq=50, Dyntune=110, DynTEdge=1, DynTEdgeThY=10, DynInflate=2)
https://i.imgur.com/YpOLDM1.jpeg
color
19th June 2023, 08:39
DynMask4 is for subtitles with halo, there is no halo in your subs.
You need to read the manual about DynMask and finetune a mask in a script like this:
LWLibAvVideoSource("D:\1991 - Den vite vikingen VHS (del1)-002 (1)-001.mkv")
v=BicubicResize(720, 576).Crop(0,22,-12,-64)
o1=v.InpaintDelogo(Loc="60,428,-70,-0", Show=4, DynMask=6, Dyntune=110)
o2=v.InpaintDelogo(Loc="60,428,-70,-0", Show=4, DynMask=7, DynTEdge=1, DynTEdgeThY=10)
o3=v.InpaintDelogo(Loc="60,428,-70,-0", Show=4, DynMask=3, Dyn3Seq=50, Dyntune=110, DynTEdge=1, DynTEdgeThY=10)
Stackvertical(
\ v.crop(60,428,-70,-0),
\ o1.ConvertToYV12().AddBorders(0,2,0,0,$F0F080),
\ o2.ConvertToYV12().AddBorders(0,2,0,0,$F0F080),
\ o3.ConvertToYV12().AddBorders(0,2,0,0,$F0F080))
This is what you see from the above script:
https://i.imgur.com/YaIUIVy.png
For example, the same frame as you posted:
[ Dyn3Seq=50 assumes that there are no shorter sub than 2 seconds ]
LWLibAvVideoSource("D:\1991 - Den vite vikingen VHS (del1)-002 (1)-001.mkv")
BicubicResize(720, 576).Crop(0,22,-12,-64)
InpaintDelogo(Loc="60,428,-70,-0", DynMask=3, Dyn3Seq=50, Dyntune=110, DynTEdge=1, DynTEdgeThY=10, DynInflate=2)
https://i.imgur.com/YpOLDM1.jpeg
that works so much better. Oh, i thought it was how long away from the text it should select. hmm...well thank you. :)
VoodooFX
19th June 2023, 17:54
that works so much better. Oh, i thought it was how long away from the text it should select. hmm...well thank you. :)
Don't think that it will fit the rest of your video, you realty need to study those parameters.
Especially on subtitles like these where they are not so much distinguishable from the background. And probably on other parts of video you would need to use different parameters.
EDIT:
In finetuning script between "o2" and "o3" you can use DynMask=2 combo mask [it's without temporal averaging] to see what is going in DynMask=3 with temporal averaging.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.