lvsfunc.dehardsub
Dehardsubbing functions and wrappers.
|
Apply a list of |
|
Get a clip of |
|
Zastin's spatially-aware hardsub mask. |
- class lvsfunc.dehardsub.HardsubMask(ranges=None, bound=None, *, blur=False, refframes=None)
Bases:
lvsfunc.mask.DeferredMask,abc.ABCDehardsub masking interface.
Provides extra functions potentially useful for dehardsubbing.
- Parameters
range – A single range or list of ranges to replace, compatible with
lvsfunc.misc.replace_rangesbound (
Union[BoundingBox,Tuple[Tuple[int,int],Tuple[int,int]],None]) – Alvsfunc.mask.BoundingBoxor a tuple that will be converted. (Default:None, no bounding)blur (
bool) – Blur the bounding mask (Default: True)refframe – A single frame number to use to generate the mask or a list of frame numbers with the same length as
range
- get_progressive_dehardsub(hrdsb, ref, partials)
Dehardsub using multiple superior hardsubbed sources and one inferior non-subbed source.
- Parameters
hrdsb (
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)
- Return type
Tuple[List[VideoNode],List[VideoNode]]- Returns
Dehardsub stages and masks used for progressive dehardsub
- apply_dehardsub(hrdsb, ref, partials)
Apply dehardsubbing to a clip.
- Parameters
hrdsb (
VideoNode) – Hardsubbed sourceref (
VideoNode) – Non-hardsubbed sourcepartials (
Optional[List[VideoNode]]) – Other hardsubbed sources
- Return type
VideoNode- Returns
Dehardsubbed clip
- class lvsfunc.dehardsub.HardsubSign(*args, thresh=0.06, minimum=1, expand=8, inflate=7, **kwargs)
Bases:
lvsfunc.dehardsub.HardsubMaskHardsub scenefiltering helper using Zastin’s hardsub mask.
- Parameters
thresh (
float) – Binarization threshold, [0, 1] (Default: 0.06)expand (
int) – std.Maximum iterations (Default: 8)inflate (
int) – std.Inflate iterations (Default: 7)
- thresh: float
- minimum: int
- expand: int
- inflate: int
- class lvsfunc.dehardsub.HardsubSignKgf(*args, highpass=5000, expand=8, **kwargs)
Bases:
lvsfunc.dehardsub.HardsubMaskHardsub scenefiltering helper using kgf.hardsubmask_fades.
Dependencies:
kagefunc
- Parameters
highpass (
int) – Highpass filter for hardsub detection (16-bit, Default: 5000)expand (
int) –kgf.hardsubmask_fadesexpand parameter (Default: 8)
- highpass: int
- expand: int
- class lvsfunc.dehardsub.HardsubLine(*args, expand=None, **kwargs)
Bases:
lvsfunc.dehardsub.HardsubMaskHardsub scenefiltering helper using kgf.hardsubmask.
Dependencies:
kagefunc
- Parameters
expand (
Optional[int]) –kgf.hardsubmaskexpand parameter (Default: clip.width // 200)
- expand: int | None
- class lvsfunc.dehardsub.HardsubLineFade(ranges, *args, refframe=0.5, **kwargs)
Bases:
lvsfunc.dehardsub.HardsubLineHardsub scenefiltering helper using kgf.hardsubmask. Similar to
lvsfunc.dehardsub.HardsubLinebut automatically sets the reference frame to the range’s midpoint.- Parameters
refframe (
float) – Desired reference point as a percent of the frame range. 0 = first frame, 1 = last frame, 0.5 = midpoint (Default)
- ref_float: float
- get_mask(clip, ref)
Get the bounded mask.
- Parameters
clip (
VideoNode) – Sourceref (
VideoNode) – Reference clip
- Return type
VideoNode- Returns
Bounded mask
- class lvsfunc.dehardsub.HardsubASS(filename, *args, fontdir=None, shift=None, **kwargs)
Bases:
lvsfunc.dehardsub.HardsubMaskGenerate a mask using an ass script, such as for dehardubbing AoD with CR DE.
- Parameters
filename (
str) – Path to ASS script.fontdir (
Optional[str]) – Extra fonts path.shift (
Optional[int]) – Offset to apply to the script, in frames. May misbehave due to timestamp rounding.
- filename: str
- fontdir: str | None
- shift: int | None
- class lvsfunc.dehardsub.HardsubSignFade(ranges, *args, refframe=0.5, **kwargs)
Bases:
lvsfunc.dehardsub.HardsubSignHardsub scenefiltering helper using Zastin’s sign mask. Similar to
lvsfunc.dehardsub.HardsubSignbut automatically sets the reference frame to the range’s midpoint.- Parameters
refframe (
float) – Desired reference point as a percent of the frame range. 0 = first frame, 1 = last frame, 0.5 = midpoint (Default)
- get_mask(clip, ref)
Get the bounded mask.
- Parameters
clip (
VideoNode) – Sourceref (
VideoNode) – Reference clip
- Return type
VideoNode- Returns
Bounded mask
- ref_float: float
- lvsfunc.dehardsub.bounded_dehardsub(hrdsb, ref, signs, partials=None)
Apply a list of
lvsfunc.dehardsub.HardsubSign- Parameters
hrdsb (
VideoNode) – Hardsubbed sourceref (
VideoNode) – Reference clipsigns (
List[HardsubMask]) – List oflvsfunc.dehardsub.HardsubSignto apply
- Return type
VideoNode- Returns
Dehardsubbed clip
- lvsfunc.dehardsub.get_all_masks(hrdsb, ref, signs)
Get a clip of
lvsfunc.dehardsub.HardsubSignmasks.- Parameters
hrdsb (
VideoNode) – Hardsubbed sourceref (
VideoNode) – Reference clipsigns (
List[HardsubMask]) – List oflvsfunc.dehardsub.HardsubSignto generate masks for
- Return type
VideoNode- Returns
Clip of all hardsub masks
- lvsfunc.dehardsub.hardsub_mask(hrdsb, ref, thresh=0.06, minimum=1, expand=8, inflate=7)
Zastin’s spatially-aware hardsub mask.
- Parameters
hrdsb (
VideoNode) – Hardsubbed sourceref (
VideoNode) – Reference clipthresh (
float) – Binarization threshold, [0, 1] (Default: 0.06)minimum (
int) – Times to minimize the max (Default: 1)expand (
int) – Times to maximize the mask (Default: 8)inflate (
int) – Times to inflate the mask (Default: 7)
- Return type
VideoNode- Returns
Hardsub mask