hardsub ¶
Classes:
-
CustomMaskFromFolder
–A helper class for creating a mask clip from a folder of images.
-
CustomMaskFromRanges
–A helper class for creating a mask clip from a mapping of file paths
-
HardsubASS
–A helper for de-hardsubbing using an ASS subtitle file to generate a hardsub mask.
-
HardsubLine
–Helper for de-hardsubbing white text with black border subtitles.
-
HardsubLineFade
–A specialized version of HardsubLine with a weight for selecting a frame within the specified frame ranges.
-
HardsubMask
–Abstract HardsubMask interface
-
HardsubSign
–Hardsub scenefiltering helper using
Zastin <https://github.com/kgrabs>
_'s hardsub mask. -
HardsubSignFades
–Helper for hardsub scene filtering, typically used for de-hardsubbing signs during fades or hard-to-catch signs.
Functions:
CustomMaskFromClipsAndRanges dataclass
¶
CustomMaskFromClipsAndRanges(
*,
processing: VSFunctionNoArgs[
VideoNode, ConstantFormatVideoNode
] = BinarizeMask,
idx: Indexer | Type[Indexer] = IMWRI
)
Bases: GeneralMask
, vs_object
Abstract CustomMaskFromClipsAndRanges interface
Methods:
-
apply_mask
– -
frame_ranges
– -
get_mask
–Get the constructed mask
Attributes:
-
clips
(list[VideoNode]
) – -
idx
(Indexer | Type[Indexer]
) – -
processing
(VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode]
) –
idx class-attribute
instance-attribute
¶
processing class-attribute
instance-attribute
¶
processing: VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode] = field(
default=BinarizeMask, kw_only=True
)
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
frame_ranges abstractmethod
¶
Source code in vsmasktools/hardsub.py
108 109 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to
replace_ranges
function.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/hardsub.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
CustomMaskFromFolder dataclass
¶
CustomMaskFromFolder(
folder_path: FilePathType,
*,
processing: VSFunctionNoArgs[
VideoNode, ConstantFormatVideoNode
] = BinarizeMask,
idx: Indexer | Type[Indexer] = IMWRI
)
Bases: CustomMaskFromClipsAndRanges
A helper class for creating a mask clip from a folder of images.
Methods:
-
apply_mask
– -
frame_ranges
– -
get_mask
–Get the constructed mask
Attributes:
-
clips
(list[VideoNode]
) – -
folder_path
(FilePathType
) – -
idx
(Indexer | Type[Indexer]
) – -
processing
(VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode]
) –
idx class-attribute
instance-attribute
¶
processing class-attribute
instance-attribute
¶
processing: VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode] = field(
default=BinarizeMask, kw_only=True
)
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
frame_ranges ¶
Source code in vsmasktools/hardsub.py
131 132 133 134 135 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to
replace_ranges
function.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/hardsub.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
CustomMaskFromRanges dataclass
¶
CustomMaskFromRanges(
ranges: Mapping[FilePathType, FrameRangeN | FrameRangesN],
*,
processing: VSFunctionNoArgs[
VideoNode, ConstantFormatVideoNode
] = BinarizeMask,
idx: Indexer | Type[Indexer] = IMWRI
)
Bases: CustomMaskFromClipsAndRanges
A helper class for creating a mask clip from a mapping of file paths and their corresponding frame ranges
Methods:
-
apply_mask
– -
frame_ranges
– -
get_mask
–Get the constructed mask
Attributes:
-
clips
(list[VideoNode]
) – -
idx
(Indexer | Type[Indexer]
) – -
processing
(VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode]
) – -
ranges
(Mapping[FilePathType, FrameRangeN | FrameRangesN]
) –
idx class-attribute
instance-attribute
¶
processing class-attribute
instance-attribute
¶
processing: VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode] = field(
default=BinarizeMask, kw_only=True
)
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
frame_ranges ¶
Source code in vsmasktools/hardsub.py
150 151 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to
replace_ranges
function.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/hardsub.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
HardsubASS ¶
HardsubASS(
filename: FilePathType,
ranges: FrameRangeN | FrameRangesN | None = None,
bound: BoundingBox | None = None,
*,
fontdir: str | None = None,
blur: bool = False,
refframes: int | list[int | None] | None = None
)
Bases: HardsubMask
A helper for de-hardsubbing using an ASS subtitle file to generate a hardsub mask.
Parameters:
-
filename
¶FilePathType
) –Subtitle file.
-
ranges
¶FrameRangeN | FrameRangesN | None
, default:None
) –The frame ranges that the mask should be applied to.
-
bound
¶BoundingBox | None
, default:None
) –An optional bounding box that defines the area of the frame where the mask will be applied. If None, the mask applies to the whole frame.
-
blur
¶bool
, default:False
) –Whether to apply a box blur effect to the mask.
-
refframes
¶int | list[int | None] | None
, default:None
) –A list of reference frames used in building the final mask for each specified range. Must have the same length as
ranges
.
Methods:
-
apply_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
-
apply_mask
– -
get_mask
–Get the constructed mask
-
get_progressive_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Attributes:
-
bin_thr
(float
) – -
blur
(bool
) – -
bound
(BoundingBox | None
) – -
filename
(str
) – -
fontdir
(str | None
) – -
ranges
(FrameRangesN
) – -
refframes
(list[int | None]
) –
Source code in vsmasktools/hardsub.py
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
|
ranges instance-attribute
¶
ranges: FrameRangesN = (
ranges
if isinstance(ranges, Sequence)
else [(0, None)] if ranges is None else [ranges]
)
apply_dehardsub ¶
apply_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode] | None = None
) -> ConstantFormatVideoNode
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode] | None
, default:None
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
ConstantFormatVideoNode
–Dehardsubbed clip.
Source code in vsmasktools/hardsub.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to the internal
_mask
method.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/abstract.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_progressive_dehardsub ¶
get_progressive_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode]
) -> tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode]
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
–Dehardsub stages and masks used for progressive dehardsub.
Source code in vsmasktools/hardsub.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
HardsubLine ¶
HardsubLine(
ranges: FrameRangeN | FrameRangesN | None = None,
bound: BoundingBox | None = None,
expand: int | None = None,
*,
blur: bool = False,
refframes: int | list[int | None] | None = None
)
Bases: HardsubMask
Helper for de-hardsubbing white text with black border subtitles. Originally written by Kageru from Kagefunc: https://github.com/Irrational-Encoding-Wizardry/kagefunc
Parameters:
-
ranges
¶FrameRangeN | FrameRangesN | None
, default:None
) –The frame ranges that the mask should be applied to.
-
bound
¶BoundingBox | None
, default:None
) –An optional bounding box that defines the area of the frame where the mask will be applied. If None, the mask applies to the whole frame.
-
expand
¶int | None
, default:None
) –std.Maximum iterations. Default is automatically adjusted based on the width of the clip.
-
blur
¶bool
, default:False
) –Whether to apply a box blur effect to the mask.
-
refframes
¶int | list[int | None] | None
, default:None
) –A list of reference frames used in building the final mask for each specified range. Must have the same length as
ranges
.
Methods:
-
apply_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
-
apply_mask
– -
get_mask
–Get the constructed mask
-
get_progressive_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Attributes:
-
bin_thr
(float
) – -
blur
(bool
) – -
bound
(BoundingBox | None
) – -
expand
(int | None
) – -
ranges
(FrameRangesN
) – -
refframes
(list[int | None]
) –
Source code in vsmasktools/hardsub.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
ranges instance-attribute
¶
ranges: FrameRangesN = (
ranges
if isinstance(ranges, Sequence)
else [(0, None)] if ranges is None else [ranges]
)
apply_dehardsub ¶
apply_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode] | None = None
) -> ConstantFormatVideoNode
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode] | None
, default:None
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
ConstantFormatVideoNode
–Dehardsubbed clip.
Source code in vsmasktools/hardsub.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to the internal
_mask
method.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/abstract.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_progressive_dehardsub ¶
get_progressive_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode]
) -> tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode]
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
–Dehardsub stages and masks used for progressive dehardsub.
Source code in vsmasktools/hardsub.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
HardsubLineFade ¶
HardsubLineFade(
ranges: FrameRangeN | FrameRangesN | None = None,
bound: BoundingBox | None = None,
expand: int | None = None,
refframe: float = 0.5,
*,
blur: bool = False
)
Bases: HardsubLine
A specialized version of HardsubLine with a weight for selecting a frame within the specified frame ranges.
Parameters:
-
ranges
¶FrameRangeN | FrameRangesN | None
, default:None
) –The frame ranges that the mask should be applied to.
-
bound
¶BoundingBox | None
, default:None
) –An optional bounding box that defines the area of the frame where the mask will be applied. If None, the mask applies to the whole frame.
-
expand
¶int | None
, default:None
) –std.Maximum iterations. Default is automatically adjusted based on the width of the clip.
-
refframe
¶float
, default:0.5
) –Weight of the reference frame used in building the final mask for each range. Must be between 0 and 1.
-
blur
¶bool
, default:False
) –Whether to apply a box blur effect to the mask.
Methods:
-
apply_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
-
apply_mask
– -
get_mask
– -
get_progressive_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Attributes:
-
bin_thr
(float
) – -
blur
(bool
) – -
bound
(BoundingBox | None
) – -
expand
(int | None
) – -
ranges
(FrameRangesN
) – -
ref_float
(float
) – -
refframes
(list[int | None]
) –
Source code in vsmasktools/hardsub.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
ranges instance-attribute
¶
ranges: FrameRangesN = (
ranges
if isinstance(ranges, Sequence)
else [(0, None)] if ranges is None else [ranges]
)
apply_dehardsub ¶
apply_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode] | None = None
) -> ConstantFormatVideoNode
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode] | None
, default:None
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
ConstantFormatVideoNode
–Dehardsubbed clip.
Source code in vsmasktools/hardsub.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
get_mask ¶
get_mask(
clip: VideoNode, /, ref: VideoNode, **kwargs: Any
) -> ConstantFormatVideoNode
Source code in vsmasktools/hardsub.py
447 448 449 450 |
|
get_progressive_dehardsub ¶
get_progressive_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode]
) -> tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode]
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
–Dehardsub stages and masks used for progressive dehardsub.
Source code in vsmasktools/hardsub.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
HardsubMask ¶
HardsubMask(
ranges: FrameRangeN | FrameRangesN | None = None,
bound: BoundingBox | None = None,
*,
blur: bool = False,
refframes: int | list[int | None] | None = None
)
Bases: DeferredMask
Abstract HardsubMask interface
Parameters:
-
ranges
¶FrameRangeN | FrameRangesN | None
, default:None
) –The frame ranges that the mask should be applied to.
-
bound
¶BoundingBox | None
, default:None
) –An optional bounding box that defines the area of the frame where the mask will be applied. If None, the mask applies to the whole frame.
-
blur
¶bool
, default:False
) –Whether to apply a box blur effect to the mask.
-
refframes
¶int | list[int | None] | None
, default:None
) –A list of reference frames used in building the final mask for each specified range. Must have the same length as
ranges
.
Methods:
-
apply_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
-
apply_mask
– -
get_mask
–Get the constructed mask
-
get_progressive_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Attributes:
-
bin_thr
(float
) – -
blur
(bool
) – -
bound
(BoundingBox | None
) – -
ranges
(FrameRangesN
) – -
refframes
(list[int | None]
) –
Source code in vsmasktools/abstract.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
ranges instance-attribute
¶
ranges: FrameRangesN = (
ranges
if isinstance(ranges, Sequence)
else [(0, None)] if ranges is None else [ranges]
)
apply_dehardsub ¶
apply_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode] | None = None
) -> ConstantFormatVideoNode
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode] | None
, default:None
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
ConstantFormatVideoNode
–Dehardsubbed clip.
Source code in vsmasktools/hardsub.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to the internal
_mask
method.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/abstract.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_progressive_dehardsub ¶
get_progressive_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode]
) -> tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode]
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
–Dehardsub stages and masks used for progressive dehardsub.
Source code in vsmasktools/hardsub.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
HardsubSign ¶
HardsubSign(
ranges: FrameRangeN | FrameRangesN | None = None,
bound: BoundingBox | None = None,
thr: float = 0.06,
minimum: int = 1,
expand: int = 8,
inflate: int = 7,
expand_mode: XxpandMode = RECTANGLE,
*,
blur: bool = False,
refframes: int | list[int | None] | None = None
)
Bases: HardsubMask
Hardsub scenefiltering helper using Zastin <https://github.com/kgrabs>
_'s hardsub mask.
Parameters:
-
ranges
¶FrameRangeN | FrameRangesN | None
, default:None
) –The frame ranges that the mask should be applied to.
-
bound
¶BoundingBox | None
, default:None
) –An optional bounding box that defines the area of the frame where the mask will be applied. If None, the mask applies to the whole frame.
-
thr
¶float
, default:0.06
) –Binarization threshold, [0, 1] (Default: 0.06).
-
minimum
¶int
, default:1
) –std.Minimum iterations (Default: 1).
-
expand
¶int
, default:8
) –std.Maximum iterations (Default: 8).
-
inflate
¶int
, default:7
) –std.Inflate iterations (Default: 7).
-
expand_mode
¶XxpandMode
, default:RECTANGLE
) –Specifies the XxpandMode used for mask growth (Default: XxpandMode.RECTANGLE).
-
blur
¶bool
, default:False
) –Whether to apply a box blur effect to the mask.
-
refframes
¶int | list[int | None] | None
, default:None
) –A list of reference frames used in building the final mask for each specified range. Must have the same length as
ranges
.
Methods:
-
apply_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
-
apply_mask
– -
get_mask
–Get the constructed mask
-
get_progressive_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Attributes:
-
bin_thr
(float
) – -
blur
(bool
) – -
bound
(BoundingBox | None
) – -
expand
(int
) – -
expand_mode
(XxpandMode
) – -
inflate
(int
) – -
minimum
(int
) – -
ranges
(FrameRangesN
) – -
refframes
(list[int | None]
) – -
thr
(float
) –
Source code in vsmasktools/hardsub.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|
ranges instance-attribute
¶
ranges: FrameRangesN = (
ranges
if isinstance(ranges, Sequence)
else [(0, None)] if ranges is None else [ranges]
)
apply_dehardsub ¶
apply_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode] | None = None
) -> ConstantFormatVideoNode
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode] | None
, default:None
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
ConstantFormatVideoNode
–Dehardsubbed clip.
Source code in vsmasktools/hardsub.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to the internal
_mask
method.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/abstract.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_progressive_dehardsub ¶
get_progressive_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode]
) -> tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode]
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
–Dehardsub stages and masks used for progressive dehardsub.
Source code in vsmasktools/hardsub.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
HardsubSignFades ¶
HardsubSignFades(
ranges: FrameRangeN | FrameRangesN | None = None,
bound: BoundingBox | None = None,
highpass: float = 0.0763,
expand: int = 8,
edgemask: MaskLike = SobelStd,
expand_mode: XxpandMode = RECTANGLE,
*,
blur: bool = False,
refframes: int | list[int | None] | None = None
)
Bases: HardsubMask
Helper for hardsub scene filtering, typically used for de-hardsubbing signs during fades or hard-to-catch signs. Originally written by Kageru from Kagefunc: https://github.com/Irrational-Encoding-Wizardry/kagefunc
Parameters:
-
ranges
¶FrameRangeN | FrameRangesN | None
, default:None
) –The frame ranges that the mask should be applied to.
-
bound
¶BoundingBox | None
, default:None
) –An optional bounding box that defines the area of the frame where the mask will be applied. If None, the mask applies to the whole frame.
-
highpass
¶float
, default:0.0763
) –Highpass threshold. Lower this value if the sign isn't fully de-hardsubbed, but be cautious as it may also capture more artifacts.
-
expand
¶int
, default:8
) –Number of expand iterations.
-
edgemask
¶MaskLike
, default:SobelStd
) –Edge mask used for finding subtitles.
-
expand_mode
¶XxpandMode
, default:RECTANGLE
) –Specifies the XxpandMode used for mask growth
-
blur
¶bool
, default:False
) –Whether to apply a box blur effect to the mask.
-
refframes
¶int | list[int | None] | None
, default:None
) –A list of reference frames used in building the final mask for each specified range. Must have the same length as
ranges
.
Methods:
-
apply_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
-
apply_mask
– -
get_mask
–Get the constructed mask
-
get_progressive_dehardsub
–Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Attributes:
-
bin_thr
(float
) – -
blur
(bool
) – -
bound
(BoundingBox | None
) – -
edgemask
(MaskLike
) – -
expand
(int
) – -
expand_mode
(XxpandMode
) – -
highpass
(float
) – -
ranges
(FrameRangesN
) – -
refframes
(list[int | None]
) –
Source code in vsmasktools/hardsub.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
ranges instance-attribute
¶
ranges: FrameRangesN = (
ranges
if isinstance(ranges, Sequence)
else [(0, None)] if ranges is None else [ranges]
)
apply_dehardsub ¶
apply_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode] | None = None
) -> ConstantFormatVideoNode
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode] | None
, default:None
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
ConstantFormatVideoNode
–Dehardsubbed clip.
Source code in vsmasktools/hardsub.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
apply_mask ¶
apply_mask(
_clipa: VideoNode,
_clipb: VideoNode,
_ref: VideoNode | None = None,
/,
**kwargs: Any,
) -> ConstantFormatVideoNode
Source code in vsmasktools/abstract.py
37 38 39 40 41 |
|
get_mask ¶
Get the constructed mask
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
ref
¶VideoNode
) –Reference clip.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to the internal
_mask
method.
Returns:
-
ConstantFormatVideoNode
–Constructed mask
Source code in vsmasktools/abstract.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_progressive_dehardsub ¶
get_progressive_dehardsub(
hardsub: VideoNode, ref: VideoNode, partials: list[VideoNode]
) -> tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
Parameters:
-
hardsub
¶VideoNode
) –Hardsub master source (eg Wakanim RU dub).
-
ref
¶VideoNode
) –Non-subbed reference source (eg CR, Funi, Amazon).
-
partials
¶list[VideoNode]
) –Sources to use for partial dehardsubbing (eg Waka DE, FR, SC).
Returns:
-
tuple[list[ConstantFormatVideoNode], list[ConstantFormatVideoNode]]
–Dehardsub stages and masks used for progressive dehardsub.
Source code in vsmasktools/hardsub.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
bounded_dehardsub ¶
bounded_dehardsub(
hrdsb: VideoNode,
ref: VideoNode,
signs: list[HardsubMask],
partials: list[VideoNode] | None = None,
) -> ConstantFormatVideoNode
Source code in vsmasktools/hardsub.py
497 498 499 500 501 502 503 504 |
|
diff_hardsub_mask ¶
diff_hardsub_mask(
a: VideoNode, b: VideoNode, **kwargs: Any
) -> ConstantFormatVideoNode
Source code in vsmasktools/hardsub.py
507 508 509 510 511 512 513 |
|
get_all_sign_masks ¶
get_all_sign_masks(
hrdsb: VideoNode, ref: VideoNode, signs: list[HardsubMask]
) -> ConstantFormatVideoNode
Source code in vsmasktools/hardsub.py
516 517 518 519 520 521 522 523 524 525 526 527 528 |
|