From 010673efa4c0c23d42a20bdae47528689c54d79a Mon Sep 17 00:00:00 2001 From: louis Date: Thu, 3 Jun 2021 19:48:41 -0400 Subject: [PATCH] tensura: s2: bd: vol1 zoning and vol2 --- .../S2 [BD]/01/01.vpy | 13 ++- .../S2 [BD]/02/02.vpy | 4 +- .../S2 [BD]/03/03.vpy | 13 ++- .../S2 [BD]/04/04.vpy | 4 +- .../S2 [BD]/05/05.vpy | 4 +- .../S2 [BD]/06/06.vpy | 13 ++- .../S2 [BD]/07/07.vpy | 74 +++++++++++++ .../S2 [BD]/08/08.vpy | 77 +++++++++++++ .../S2 [BD]/09/09.vpy | 67 ++++++++++++ .../S2 [BD]/10/10.vpy | 87 +++++++++++++++ .../S2 [BD]/11/11.vpy | 101 ++++++++++++++++++ .../S2 [BD]/12/12.vpy | 81 ++++++++++++++ .../S2 [BD]/nced/nced.vpy | 60 +++++++++++ .../S2 [BD]/ncop/ncop.vpy | 60 +++++++++++ .../S2 [BD]/recap/recap.vpy | 99 +++++++++++++++++ .../tensura_common/__init__.py | 5 +- .../tensura_common/config.py | 25 +++-- .../tensura_common/filter.py | 19 ++++ .../tensura_common/final-settings | 2 +- 19 files changed, 781 insertions(+), 27 deletions(-) create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/07/07.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/08/08.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/09/09.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/10/10.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/11/11.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/12/12.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/nced/nced.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/ncop/ncop.vpy create mode 100644 Tensei Shitara Slime Datta Ken/S2 [BD]/recap/recap.vpy diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/01/01.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/01/01.vpy index 3949146..f73df56 100644 --- a/Tensei Shitara Slime Datta Ken/S2 [BD]/01/01.vpy +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/01/01.vpy @@ -1,8 +1,8 @@ import vapoursynth as vs -from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain -from yt_common.automation import SelfRunner +from yt_common.automation import SelfRunner, Zone from yt_common.chapters import Chapter from yt_common.source import FileTrim, SimpleSource @@ -15,7 +15,7 @@ from typing import List, Tuple import os EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) -CONFIG: TenSuraConfig = TenSuraConfig(EPNUM) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" SOURCE: SimpleSource = SimpleSource( FileTrim(os.path.join(BDMV, "00006.m2ts"), (24, -50)) @@ -35,6 +35,11 @@ NOD3: List[Range] = [ (33926, 34045), ] +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 if isinstance(r, tuple)] + AA_STRONG: List[Range] = [ (15605, 15772), ] @@ -88,6 +93,6 @@ def filter() -> vs.VideoNode: if __name__ == "__main__": - SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS) + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) else: filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/02/02.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/02/02.vpy index 9e41499..4d5bfa0 100644 --- a/Tensei Shitara Slime Datta Ken/S2 [BD]/02/02.vpy +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/02/02.vpy @@ -1,6 +1,6 @@ import vapoursynth as vs -from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain from yt_common.automation import SelfRunner from yt_common.chapters import Chapter @@ -14,7 +14,7 @@ from typing import List import os EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) -CONFIG: TenSuraConfig = TenSuraConfig(EPNUM) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" SOURCE: SimpleSource = SimpleSource( FileTrim(os.path.join(BDMV, "00007.m2ts"), (None, -49)) diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/03/03.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/03/03.vpy index fdee8fb..d8b8f15 100644 --- a/Tensei Shitara Slime Datta Ken/S2 [BD]/03/03.vpy +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/03/03.vpy @@ -1,8 +1,8 @@ import vapoursynth as vs -from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain -from yt_common.automation import SelfRunner +from yt_common.automation import SelfRunner, Zone from yt_common.chapters import Chapter from yt_common.source import FileTrim, SimpleSource @@ -14,7 +14,7 @@ from typing import List import os EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) -CONFIG: TenSuraConfig = TenSuraConfig(EPNUM) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" SOURCE: SimpleSource = SimpleSource( FileTrim(os.path.join(BDMV, "00008.m2ts"), (None, -50)) @@ -34,6 +34,11 @@ NOD3: List[Range] = [ (33926, 34045), ] +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 if isinstance(r, tuple)] + AA_STRONG: List[Range] = [ (3084, 3125), ] @@ -60,6 +65,6 @@ def filter() -> vs.VideoNode: if __name__ == "__main__": - SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS) + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) else: filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/04/04.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/04/04.vpy index 7d935fa..cba33a7 100644 --- a/Tensei Shitara Slime Datta Ken/S2 [BD]/04/04.vpy +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/04/04.vpy @@ -1,6 +1,6 @@ import vapoursynth as vs -from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain from yt_common.automation import SelfRunner from yt_common.chapters import Chapter @@ -15,7 +15,7 @@ from typing import List, Tuple import os EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) -CONFIG: TenSuraConfig = TenSuraConfig(EPNUM) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" SOURCE: SimpleSource = SimpleSource( FileTrim(os.path.join(BDMV, "00009.m2ts"), (None, -51)) diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/05/05.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/05/05.vpy index e75d959..b2442ed 100644 --- a/Tensei Shitara Slime Datta Ken/S2 [BD]/05/05.vpy +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/05/05.vpy @@ -1,6 +1,6 @@ import vapoursynth as vs -from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain from yt_common.automation import SelfRunner from yt_common.chapters import Chapter @@ -15,7 +15,7 @@ from typing import List, Tuple import os EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) -CONFIG: TenSuraConfig = TenSuraConfig(EPNUM) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" SOURCE: SimpleSource = SimpleSource( FileTrim(os.path.join(BDMV, "00010.m2ts"), (None, -24)) diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/06/06.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/06/06.vpy index dd8cf17..ebbbbb3 100644 --- a/Tensei Shitara Slime Datta Ken/S2 [BD]/06/06.vpy +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/06/06.vpy @@ -1,8 +1,8 @@ import vapoursynth as vs -from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain -from yt_common.automation import SelfRunner +from yt_common.automation import SelfRunner, Zone from yt_common.chapters import Chapter from yt_common.source import FileTrim, SimpleSource @@ -15,7 +15,7 @@ from typing import List, Tuple import os EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) -CONFIG: TenSuraConfig = TenSuraConfig(EPNUM) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" SOURCE: SimpleSource = SimpleSource( FileTrim(os.path.join(BDMV, "00011.m2ts"), (24, -25)) @@ -35,6 +35,11 @@ NOD3: List[Range] = [ (33927, 34046), ] +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 if isinstance(r, tuple)] + AA_STRONG: List[Range] = [ (11640, 11685), (12437, 12488), @@ -85,6 +90,6 @@ def filter() -> vs.VideoNode: if __name__ == "__main__": - SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS) + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) else: filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/07/07.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/07/07.vpy new file mode 100644 index 0000000..e6108db --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/07/07.vpy @@ -0,0 +1,74 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner, Zone +from yt_common.chapters import Chapter +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00006.m2ts"), (24, -50)) +) + +CHAPTERS: List[Chapter] = [ + Chapter("Intro", 0), + Chapter("OP", 408), + Chapter("Part A", 2566), + Chapter("Part B", 14745), + Chapter("ED", 31768), + Chapter("Next", 33926), +] + +NOD3: List[Range] = [ + (12870, 13394), + (33926, 34045), +] + +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 if isinstance(r, tuple)] + +AA_STRONG: List[Range] = [ + (15848, 15925), +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/08/08.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/08/08.vpy new file mode 100644 index 0000000..ff0a310 --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/08/08.vpy @@ -0,0 +1,77 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner, Zone +from yt_common.chapters import Chapter +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00007.m2ts"), (None, -51)) +) + +CHAPTERS: List[Chapter] = [ + Chapter("Intro", 0), + Chapter("OP", 3237), + Chapter("Part A", 5395), + Chapter("Part B", 16255), + Chapter("ED", 31767), + Chapter("Next", 33925), +] + +NOD3: List[Range] = [ + (20345, 20471), + (23716, 23971), + (26714, 26869), + (33925, 34044), +] + +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 if isinstance(r, tuple)] + +AA_STRONG: List[Range] = [ + (8606, 8677), + (26138, 26245), +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/09/09.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/09/09.vpy new file mode 100644 index 0000000..70b666a --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/09/09.vpy @@ -0,0 +1,67 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner +from yt_common.chapters import Chapter +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00008.m2ts"), (None, -50)) +) + +CHAPTERS: List[Chapter] = [ + Chapter("Intro", 0), + Chapter("OP", 384), + Chapter("Part A", 2542), + Chapter("Part B", 17766), + Chapter("ED", 31768), + Chapter("Next", 33926), +] + +NOD3: List[Range] = [ + (33926, 34045), +] + +AA_STRONG: List[Range] = [ +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/10/10.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/10/10.vpy new file mode 100644 index 0000000..37583d1 --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/10/10.vpy @@ -0,0 +1,87 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner +from yt_common.chapters import Chapter, Edition +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource([ + FileTrim(os.path.join(BDMV, "00009.m2ts"), (None, None)), + FileTrim(os.path.join(BDMV, "00010.m2ts"), (None, -49)), + FileTrim(os.path.join(BDMV, "00016.m2ts"), (13348, 15699)), + FileTrim(os.path.join(BDMV, "00016.m2ts"), (17721, 17982)), +], asrc=[ + # NC version has different (quieter) audio, so make sure we use the regular version + FileTrim(os.path.join(BDMV, "00009.m2ts"), (None, None)), + FileTrim(os.path.join(BDMV, "00010.m2ts"), (None, -49)), + FileTrim(os.path.join(BDMV, "00010.m2ts"), (13348, 15699)), + FileTrim(os.path.join(BDMV, "00010.m2ts"), (17721, 17982)), +]) + +EDITIONS: List[Edition] = [ + Edition(chapters=[ + Chapter("Intro", 0), + Chapter("OP", 2134), + Chapter("Part A", 4293), + Chapter("Part B", 16065), + Chapter("Next", 34047, 34167), + ], default=True, ordered=True), + Edition(chapters=[ + Chapter("Intro", 0), + Chapter("OP", 2134), + Chapter("Part A", 4293), + Chapter("Part B", 16065, 29413), + Chapter("Part B - NC", 34167, 36518), + Chapter("Part B", 31764, 33786), + Chapter("Part B - NC", 36518, -1), + Chapter("Next", 34047, 34167), + ], default=False, ordered=True), +] + +NOD3: List[Range] = [ + (34047, 34166), +] + +AA_STRONG: List[Range] = [ +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, editions=EDITIONS) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/11/11.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/11/11.vpy new file mode 100644 index 0000000..0369cb2 --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/11/11.vpy @@ -0,0 +1,101 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner, Zone +from yt_common.chapters import Chapter, Edition +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource([ + FileTrim(os.path.join(BDMV, "00011.m2ts"), (None, -49)), + FileTrim(os.path.join(BDMV, "00017.m2ts"), (None, 3158)), + FileTrim(os.path.join(BDMV, "00017.m2ts"), (33342, 33927)), +], asrc=[ + # NC version has different (quieter) audio, so make sure we use the regular version + FileTrim(os.path.join(BDMV, "00011.m2ts"), (None, -49)), + FileTrim(os.path.join(BDMV, "00011.m2ts"), (None, 3158)), + FileTrim(os.path.join(BDMV, "00011.m2ts"), (33342, 33927)), +]) + +EDITIONS: List[Edition] = [ + Edition(chapters=[ + Chapter("Intro", 0), + Chapter("Part A", 840), + Chapter("Part B", 13980), + Chapter("Next", 33927, 34047), + ], default=True, ordered=True), + Edition(chapters=[ + Chapter("Intro - NC", 34047), + Chapter("Part A - NC", 34887, 37205), + Chapter("Part A", 3158), + Chapter("Part B", 13980, 33342), + Chapter("Part B - NC", 37205, -1), + Chapter("Next", 33927, 34047), + ], default=False, ordered=True), +] + +NOD3: List[Range] = [ + (4862, 5023), + (8264, 8692), + (10200, 10576), + (17993, 18828), + (33927, 34046), +] + +NODEN: List[Range] = [ + (16484, 17992), + (18829, 19528), +] + +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 + NODEN if isinstance(r, tuple)] + +AA_STRONG: List[Range] = [ + (14544, 14588), + (14716, 14763), + (15493, 15633), + (19529, 19600), +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + replace_ranges(den, src, NODEN) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, editions=EDITIONS, zones=ZONES) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/12/12.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/12/12.vpy new file mode 100644 index 0000000..90798b3 --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/12/12.vpy @@ -0,0 +1,81 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner, Zone +from yt_common.chapters import Chapter +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0])) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00012.m2ts"), (None, -26)) +) + +CHAPTERS: List[Chapter] = [ + Chapter("Intro", 0), + Chapter("OP", 1272), + Chapter("Part A", 3429), + Chapter("Part B", 10549), + Chapter("ED", 31768), +] + +NOD3: List[Range] = [ + (3705, 3733), + (5329, 5360), + (7234, 7449), +] + +NODEN: List[Range] = [ + (3734, 3842), + (5361, 6372), + (26183, 27055), +] + +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 + NODEN if isinstance(r, tuple)] + +AA_STRONG: List[Range] = [ + (9805, 10155), +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + den = replace_ranges(den, src, NODEN) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/nced/nced.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/nced/nced.vpy new file mode 100644 index 0000000..974129d --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/nced/nced.vpy @@ -0,0 +1,60 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +DESC: str = os.path.basename(os.path.splitext(__file__)[0]) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(DESC) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00015.m2ts"), (24, -24)) +) + +NOD3: List[Range] = [ +] + +NODEN: List[Range] = [ +] + +AA_STRONG: List[Range] = [ +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + den = replace_ranges(den, src, NODEN) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/ncop/ncop.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/ncop/ncop.vpy new file mode 100644 index 0000000..61cc30c --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/ncop/ncop.vpy @@ -0,0 +1,60 @@ +import vapoursynth as vs + +from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain + +from yt_common.automation import SelfRunner +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +DESC: str = os.path.basename(os.path.splitext(__file__)[0]) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(DESC) +BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00014.m2ts"), (24, -24)) +) + +NOD3: List[Range] = [ +] + +NODEN: List[Range] = [ +] + +AA_STRONG: List[Range] = [ +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + den = replace_ranges(den, src, NODEN) + descaled = descale(den) + deb = deband(descaled, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + final = finalize(grain) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/S2 [BD]/recap/recap.vpy b/Tensei Shitara Slime Datta Ken/S2 [BD]/recap/recap.vpy new file mode 100644 index 0000000..06a9d33 --- /dev/null +++ b/Tensei Shitara Slime Datta Ken/S2 [BD]/recap/recap.vpy @@ -0,0 +1,99 @@ +import vapoursynth as vs + +from tensura_common import (TenSuraS2BDConfig, antialias, deband, denoise, descale, + edgefix, finalize, megurumono_scenefilter, regrain) + +from yt_common.automation import SelfRunner, Zone +from yt_common.chapters import Chapter +from yt_common.source import FileTrim, SimpleSource + +from lvsfunc.mask import BoundingBox +from lvsfunc.misc import replace_ranges +from lvsfunc.types import Range + +from typing import List, Tuple + +import os + +DESC: str = os.path.basename(os.path.splitext(__file__)[0]) +CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(DESC) +BDMV: str = "../bdmv/[BDMV][210326][Tensei Shitara Slime Datta Ken 2nd Season][Vol.1]/BDMV/STREAM" +SOURCE: SimpleSource = SimpleSource( + FileTrim(os.path.join(BDMV, "00013.m2ts"), (24, -24)) +) + +MEGURUMONO: Tuple[int, int] = (2873, 5034) + +CHAPTERS: List[Chapter] = [ + Chapter("Intro", 0), + Chapter("OP", MEGURUMONO[0]), + Chapter("Part A", MEGURUMONO[1]+1), + Chapter("Part B", 22561), + Chapter("ED", 31883), +] + +NOD3: List[Range] = [ +] + +NODEN: List[Range] = [ + (21749, 21849), +] + +ZONES: List[Zone] = [ +] + +ZONES += [Zone(r, 0.75) for r in NOD3 + NODEN if isinstance(r, tuple)] + +AA_STRONG: List[Range] = [ +] + +SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [ +] + +DEBAND_STRONG: List[Range] = [ + (0, 500), + (11519, 11615), + (14845, 14906), + (15137, 15234), + (15667, 15817), + (18848, 19536), + (19897, 20004), + (20749, 20814), + (21013, 21340), + (21485, 21748), + (22812, 22894), + (26719, 26769), + (31307, 31426), + (31596, 31882), +] + +DEBAND_NUCLEAR: List[Range] = [ +] + +core = vs.core + + +def filter() -> vs.VideoNode: + src = SOURCE.source() + ef = edgefix(src) + den = denoise(ef) + den = replace_ranges(den, src, NODEN) + descaled = descale(den) + deb = deband(descaled, strong=DEBAND_STRONG, nuclear=DEBAND_NUCLEAR) + deb = replace_ranges(deb, src, NOD3) + aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM) + grain = regrain(aa) + scenefilter = grain + if MEGURUMONO: + megurumono = megurumono_scenefilter(src, MEGURUMONO[0]) + scenefilter = replace_ranges(scenefilter, megurumono, MEGURUMONO) + final = finalize(scenefilter) + src.set_output(1) + final.set_output(0) + return final + + +if __name__ == "__main__": + SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES) +else: + filter() diff --git a/Tensei Shitara Slime Datta Ken/tensura_common/__init__.py b/Tensei Shitara Slime Datta Ken/tensura_common/__init__.py index fb320c0..ea6d99c 100644 --- a/Tensei Shitara Slime Datta Ken/tensura_common/__init__.py +++ b/Tensei Shitara Slime Datta Ken/tensura_common/__init__.py @@ -1,2 +1,3 @@ -from .config import TenSuraConfig # noqa: F401 -from .filter import antialias, deband, denoise, descale, edgefix, finalize, regrain # noqa: F401 +from .config import TenSuraS2Config, TenSuraS2BDConfig, TenSuraS1BDConfig # noqa: F401 +from .filter import (antialias, deband, denoise, descale, edgefix, finalize, # noqa: F401 + megurumono_scenefilter, regrain) diff --git a/Tensei Shitara Slime Datta Ken/tensura_common/config.py b/Tensei Shitara Slime Datta Ken/tensura_common/config.py index 90d6182..afad1f5 100644 --- a/Tensei Shitara Slime Datta Ken/tensura_common/config.py +++ b/Tensei Shitara Slime Datta Ken/tensura_common/config.py @@ -1,21 +1,34 @@ -from yt_common.config import Config, FlacMixin +from yt_common.config import Config, FlacMixin, OpusMixin from typing import Union import os -TITLE: str = "TenSura S2" -TITLE_LONG: str = "Tensei Shitara Slime Datta Ken S2" RESOLUTION: int = 1080 DATAPATH: str = os.path.dirname(__file__) -class TenSuraConfig(FlacMixin, Config): +class TenSuraS1BDConfig(OpusMixin, Config): def __init__(self, desc: Union[str, int]) -> None: super().__init__( desc, - TITLE, - TITLE_LONG, + "TenSura", + "Tensei Shitara Slime Datta Ken", RESOLUTION, DATAPATH ) + + +class TenSuraS2Config(Config): + def __init__(self, desc: Union[str, int]) -> None: + super().__init__( + desc, + "TenSura S2", + "Tensei Shitara Slime Datta Ken S2", + RESOLUTION, + DATAPATH + ) + + +class TenSuraS2BDConfig(FlacMixin, TenSuraS2Config): + pass diff --git a/Tensei Shitara Slime Datta Ken/tensura_common/filter.py b/Tensei Shitara Slime Datta Ken/tensura_common/filter.py index 42718a6..11692be 100644 --- a/Tensei Shitara Slime Datta Ken/tensura_common/filter.py +++ b/Tensei Shitara Slime Datta Ken/tensura_common/filter.py @@ -101,3 +101,22 @@ def regrain(clip: vs.VideoNode) -> vs.VideoNode: def finalize(clip: vs.VideoNode) -> vs.VideoNode: return depth(clip, 10) + + +def megurumono_scenefilter(clip: vs.VideoNode, start: Optional[int] = None) -> vs.VideoNode: + if start is None: + return clip + DEBAND_STRONG: List[Range] = [ + (start+12, start+256), + (start+778, start+1007), + (start+1025, start+1059), + (start+1217, start+1322), + (start+1368, start+1437), + ] + ef = edgefix(clip) + den = denoise(ef) + descaled = descale(den) + deb = deband(descaled, strong=DEBAND_STRONG) + aa = antialias(deb) + grain = regrain(aa) + return grain diff --git a/Tensei Shitara Slime Datta Ken/tensura_common/final-settings b/Tensei Shitara Slime Datta Ken/tensura_common/final-settings index 957b876..0991eaa 100644 --- a/Tensei Shitara Slime Datta Ken/tensura_common/final-settings +++ b/Tensei Shitara Slime Datta Ken/tensura_common/final-settings @@ -1 +1 @@ -x265 --input - --y4m --input-depth 10 --output-depth 10 --input-csp i420 --profile main10 --colormatrix bt709 --colorprim bt709 --transfer bt709 --preset slower --rc-lookahead 72 --keyint 360 --min-keyint 23 --subme 5 --qcomp 0.7 --crf 15 --aq-mode 3 --aq-strength 0.9 --bframes 16 --psy-rd 2.0 --psy-rdoq 1.8 --rdoq-level 1 --deblock -2:-2 --no-sao --no-open-gop --no-strong-intra-smoothing --frames {frames:d} --output {filename:s}.h265 +x265 --input - --y4m --input-depth 10 --output-depth 10 --input-csp i420 --profile main10 --colormatrix bt709 --colorprim bt709 --transfer bt709 --preset slower --rc-lookahead 72 --keyint 360 --min-keyint 23 --subme 5 --qcomp 0.7 --crf 15 --aq-mode 3 --aq-strength 0.9 --bframes 16 --psy-rd 2.0 --psy-rdoq 1.8 --rdoq-level 1 --deblock -2:-2 --no-sao --no-open-gop --no-strong-intra-smoothing --frames {frames:d} $QPFILE $ZONES --output {filename:s}.h265