Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th January 2021, 14:01   #1  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Automatic Subs Detection?

I am not sure: But wasn't there some old thread where somone built automatically masks to remove/blend somehow hardcoded subs?
I can't find anything.
Frank62 is offline   Reply With Quote
Old 14th January 2021, 17:16   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Perhaps you were thinking of this [abandoned thread, OP closed thread due to comment on rule breaking]
Hardsub Removal using another source :- https://forum.doom9.org/showthread.php?t=173837

Last detect script version:- https://forum.doom9.org/showthread.p...36#post1782036

Explanation of detect script method:- https://forum.doom9.org/showthread.p...25#post1780125

Quote:
Originally Posted by StainlessS View Post
The script basically extracts from RGB color value eg $FEFEFE, the individual R,G,B components of both Text and Halo, then calculates the range limits for
each channel using CHANVAR (just saves user from specifying min and max for each color channel individually for both text and halo).
The ShowRed, etc lines isolate pixels that fall within the acceptable ranges for all 3 channels for text, and then AND's them together so result is pixels where all 3 channels are in acceptable range. Same is then done for HALO.

The for next loop, Expands (swells) the text [edit: by halo HALO_W,HALO_H] so as to swell into the halo region (both horizontally and vertically), and then expands the halo to swell into the text region [edit: by TEXT_W,TEXT_H]. (These are two swelled frames shown in diagnostic as TEXT and HALO frames).
Finally, the expanded/swelled frames are AND'ed together for the diagnostic shown DETECT frame.
This detect frame therefore contains white pixels where text/halo were valid colors, and because of the AND'ed swellings, it also shows where both
text and halo swelled 'into' each other ie where they were adjacent to each other (allows to ignore randomly positioned pixels which just happen to be the
sort after colors).

The FindSub routine just checks the scan area using RT_YInRangeLocate() to see if there is a suspect area of white(good) pixels of sufficient 'bulk'.


EDIT: Hit a small problem, TextSub() seems to produce drop shadow halos, and so more black halo below text [EDIT: and to the right] rather than above,
we could improve things here if we could expand in only single direction (ie downwards, or upwards), but we dont know how
It still works without this, but a little more error prone and would need to set HALO_H to maximum drop shadow size.
EDIT: Above detect method only works where there is a subtitle text Halo.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 14th January 2021 at 18:08.
StainlessS is offline   Reply With Quote
Old 14th January 2021, 19:01   #3  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Thanks StainlessS! Will see if I can this get to work.
Frank62 is offline   Reply With Quote
Old 14th January 2021, 19:11   #4  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 990
Quote:
Originally Posted by Frank62 View Post
hardcoded subs
Can you link to few mins sample?
VoodooFX is offline   Reply With Quote
Old 14th January 2021, 20:12   #5  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
We just decided to solve the problem by simply using VD's LogoAway. Very simple and fast to define an area, and we splice the sections quickly together, because there are only a few per episode (when they speak Indian...). The clue is these scenes will later be overlayed by new German subs, so the blurring can be quite frankly.

But for the future something automatic will be better, of course.
There are automatic solutions for extracting subs. I wonder if one of those can save a log with coordinates, where it detected subs.

The sample:
https://we.tl/t-WRCpEPeuTF
Frank62 is offline   Reply With Quote
Old 14th January 2021, 20:24   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I doubt very much if method I linked could be used with that clip,
there is no halo of any use, may only really work at bottom of subs with the heavy drop shadow halo.
(with almost none at sides or top).
Sorry.

Glad you got something working with VD LogoAway.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 14th January 2021, 21:14   #7  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 990
Quote:
Originally Posted by Frank62 View Post
The sample:
You can use InpaintDelogo:

Original frame:



Auto dynamic mask (overlay'ed black on top of original frame):



Result:


Last edited by VoodooFX; 14th January 2021 at 22:49.
VoodooFX is offline   Reply With Quote
Old 14th January 2021, 21:54   #8  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Thank you two!
But not necessary to achieve high quality, because later overlayed by new (of course not hardcoded) Subs.
I experimented a lot with the Inpaint-things about two years ago, but always came back to good old DeLogo, which is the very best if subs can be deblended (if not 100% opaque).
For subs like these InPaint really looks better, worth another try in the future.
Frank62 is offline   Reply With Quote
Old 14th January 2021, 22:29   #9  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 990
Quote:
Originally Posted by Frank62 View Post
I experimented a lot with the Inpaint-things about two years ago, but always came back to good old DeLogo, which is the very best if subs can be deblended (if not 100% opaque).
Are you sure that Vdub Delogo can deblend dynamic logos like subs?
InpaintDelogo can do deblend too, and results are way better than old Vdub Delogo, but not dynamic ones, if you have such example then I can add dynamic deblending to it (but I doubt that it will look good).

EDIT:
Btw, those screens above I got with a bit different version than "1.24", as you are not going to use it now then I'll not bother to update it, as yet.

Last edited by VoodooFX; 14th January 2021 at 22:47.
VoodooFX is offline   Reply With Quote
Old 14th January 2021, 23:13   #10  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Sorry, I wrote "subs", that was a mistake. Of course I experimented with logos, never used any DeLogo filter for subs up to now.

After having used VD-DeLogo since about 15 years I finally found that it's a lot better than I always thought (followed the common tutorials and improved a bit while using it). When I find the time I will post some seconds of an example, where there is almost nothing left. Was surprised myself.

InpaintDelogo seems to use newer and improved techniques, so in the end it should be better, when used 100% optimal. I guess.
Frank62 is offline   Reply With Quote
Old 15th January 2021, 19:11   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
InpaintDelogo seems to use newer and improved techniques
Yep, VoodooFX did lots of hard work in that area, does a bloody good job, well done VX
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 15th January 2021, 21:21   #12  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 990
Quote:
Originally Posted by StainlessS View Post
Yep, VoodooFX did lots of hard work in that area, does a bloody good job, well done VX
Imho, it's far away from "bloody good", especially a dynamic masking can be improved a lot, I think, but I'm not proficient in Avisynth, when I see your RT_ stuff it's mostly yadda yadda to me.

I need to find an example with halos to see how your linked script works.
VoodooFX is offline   Reply With Quote
Old 16th January 2021, 03:11   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
I need to find an example with halos to see how your linked script works.
I guess that you could just try create a sample, Subtitle() has a halo.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:30.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.