def do_wizardry() -> None: """It's magic""" filtered = filtering() if isinstance(filtered, vs.VideoNode): filtered = cast(vs.VideoNode, filtered) else: raise ValueError if not Path(WEB_AOD.name_clip_output).exists(): X265Encoder( 'x265', Path('settings/x265_settings'), filtered, WEB_AOD, progress_update=lambda v, e: print( f"\rVapourSynth: {v}/{e} ~ {100 * v // e}% || Encoder: ", end="")) if not Path(WEB_AOD.a_src.format(1)).exists(): BasicTool('mkvextract', [WEB_AOD.src, 'tracks', f'1:{WEB_AOD.a_src.format(1)}']) assert WEB_AOD.a_src is not None BasicTool('mkvmerge', [ '-o', WEB_AOD.name_file_final, '--track-name', '0:HEVC WEBRip by Vardë@Raws-Maji', '--language', '0:jpn', WEB_AOD.name_clip_output, '--track-name', '0:AAC 2.0', '--language', '0:jpn', WEB_AOD.a_src.format(1) ])
def run(self) -> None: assert self.file.a_src assert self.file.a_enc_cut v_encoder = X265Encoder('x265', 'settings/x265_settings_BD_NCOP1v09') a_extracters = [ BasicTool( 'eac3to', [JPBD_NCOP2.path.to_str(), '2:', self.file.a_src.format(2).to_str()] ) ] a_cutters = [AudioCutter(self.file, track=2)] a_encoders = [FlacEncoder(self.file, track=2)] muxer = Mux( self.file, streams=( VideoStream(self.file.name_clip_output, 'HEVC BDRip by LightArrowsEXE@Kaleido', JAPANESE), AudioStream(self.file.a_enc_cut.format(1), 'FLAC 2.0', JAPANESE), None ) ) config = RunnerConfig(v_encoder, None, a_extracters, a_cutters, a_encoders, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() runner.do_cleanup()
def _merge(self: EncodeGoBrrr): assert self.file.a_enc_cut assert self.file.chapter BasicTool('mkvmerge', [ '-o', self.file.name_file_final, '--track-name', '0:HEVC BDRip by Vardë@Manga-Family', '--language', '0:jpn', self.file.name_clip_output, '--track-name', '0:FLAC 2.0', '--language', '0:jpn', self.file.a_enc_cut, '--chapter-language', 'fre', '--chapters', self.file.chapter ])
def _audio_getter(self: EncodeGoBrrr): assert self.file.a_src if not Path(self.file.a_src).exists(): BasicTool('eac3to', [self.file.src, '2:', self.file.a_src, '-log=NUL']) assert self.file.a_src_cut if not Path(self.file.a_src_cut).exists(): eztrim(self.file.clip, (self.file.frame_start, self.file.frame_end), self.file.a_src, self.file.a_src_cut) assert self.file.a_enc_cut if not Path(self.file.a_enc_cut).exists(): AudioEncoder('ffmpeg', Path('love_live_common/flac_settings'), self.file)
def _audio_getter(self: EncodeGoBrrr) -> None: assert self.file.a_src.format(1) if not Path(self.file.a_src.format(1)).exists(): BasicTool( 'mkvextract', [self.file.src, 'tracks', f'1:{self.file.a_src.format(1)}']) assert self.file.a_src_cut.format(1) if not Path(self.file.a_src_cut.format(1)).exists(): eztrim(self.file.clip, (self.file.frame_start, self.file.frame_end), self.file.a_src.format(1), self.file.a_src_cut.format(1))
def run(self, clean_up: bool = True, make_comp: bool = False, settings: str = 'x265_settings_BD') -> None: """ :param clean_up: Perform clean-up procedure after encoding :param make_comp: Create a slowpics-compatible comparison between src, flt, and enc """ v_encoder = X265Encoder(f'settings/{settings}') v_lossless_encoder = FFV1Encoder() self.clip = dither_down(self.clip) video_track = VideoStream(self.file.name_clip_output, 'HEVC TVrip by LightArrowsEXE@Kaleido', JAPANESE) a_extracters = [ BasicTool('eac3to', [ self.file.path.to_str(), '2:', self.file.a_src.set_track(1).to_str() ]) ] a_cutters = [EztrimCutter(self.file, track=1)] muxer = Mux(self.file, streams=(video_track, AudioStream(self.file.a_src_cut.set_track(1), 'AAC 2.0', JAPANESE), None)) config = RunnerConfig(v_encoder=v_encoder, v_lossless_encoder=v_lossless_encoder, a_extracters=a_extracters, a_cutters=a_cutters, a_encoders=None, muxer=muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() if clean_up: runner.do_cleanup() if make_comp: try: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: print(e)
def _merge(self: EncodeGoBrrr) -> None: assert self.file.a_src_cut.format(1) BasicTool('mkvmerge', [ '-o', self.file.name_file_final, '--track-name', '0:HEVC WEBRip by Vardë@Owlolf', '--language', '0:jpn', self.file.name_clip_output, '--track-name', '0:EAC3 2.0', '--language', '0:jpn', self.file.a_src_cut.format(1), ])
def merge(self) -> None: assert self.file.a_enc_cut assert self.file.chapter BasicTool( 'mkvmerge', [ '-o', self.file.name_file_final, '--track-name', '0:HEVC BDRip by Vardë@Raws-Maji', '--language', '0:jpn', self.file.name_clip_output, '--tags', '0:tags_aac.xml', '--track-name', '0:AAC 2.0', '--language', '0:jpn', self.file.a_enc_cut.format(1), # '--chapter-language', 'jpn', '--chapters', self.file.chapter ]).run()
def run(self, clean_up: bool = True, make_comp: bool = True, wraw: bool = False, ep_num: Optional[int] = None) -> None: """ :param clean_up: Perform clean-up procedure after encoding :param make_comp: Create a slowpics-compatible comparison between src, flt, and enc """ assert self.file.a_src assert self.file.a_src_cut v_encoder = X265Encoder('settings/x265_settings') if not wraw \ else X264Encoder('settings/x264_settings_wraw') self.clip = dither_down(self.clip) a_extracters = [ BasicTool( 'eac3to', [self.file.path.to_str(), '2:', self.file.a_src.set_track(1).to_str()] ) ] a_cutters = [EztrimCutter(self.file, track=1)] if self.chapter_list: assert self.file.chapter assert self.file.trims_or_dfs if not isinstance(self.chapter_offset, int): self.chapter_offset = self.file.trims_or_dfs[0] * -1 # type: ignore chapxml = MatroskaXMLChapters(self.file.chapter) chapxml.create(self.chapter_list, self.file.clip.fps) chapxml.shift_times(self.chapter_offset, self.file.clip.fps) # type: ignore chapxml.set_names(self.chapter_names) chapters = ChapterStream(chapxml.chapter_file, JAPANESE) metadata_message = 'HEVC WEBrip by LightArrowsEXE@GoodJob!Media' if not wraw \ else 'h264 Workraw by LightArrowsEXE@GoodJob!Media' muxer = Mux( self.file, streams=( VideoStream(self.file.name_clip_output, metadata_message, JAPANESE), AudioStream(self.file.a_src_cut.set_track(1), 'AAC 2.0', JAPANESE), chapters if self.chapter_list else None ) ) config = RunnerConfig(v_encoder, None, a_extracters, a_cutters, None, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() appendCRC(self.file.name_file_final) if make_comp: try: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(f"{e}") if wraw: mini_file = self.file # One of our staff has limited internet, so we need to mini-fy one wraw. # Also this can 100% be written way nicer, but I am too lazy and This Works:tm: wraw2encoder = X264Encoder('settings/x264_settings_wraw_mini') mini_file.name_file_final = VPath(f"wraw/Jahy_{ep_num} (mini wraw).mkv") mini_file.name_clip_output = VPath(mini_file.name_clip_output.to_str()[:-4] + '_mini.265') wraw2muxer = Mux( mini_file, streams=( VideoStream(mini_file.name_clip_output, metadata_message, JAPANESE), AudioStream(self.file.a_src_cut.set_track(1), 'AAC 2.0', JAPANESE), chapters if self.chapter_list else None ) ) wraw2config = RunnerConfig(wraw2encoder, None, a_extracters, a_cutters, None, wraw2muxer) wraw2runner = SelfRunner(self.clip, self.file, wraw2config) wraw2runner.run() appendCRC(mini_file.name_file_final) if make_comp: try: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(f"{e}") if clean_up: wraw2runner.do_cleanup() if clean_up: try: runner.do_cleanup() except: pass
) SUB = fr'5-toubun_no_Hanayome_subs\ger\[FeelsBadSubs] 5-toubun no Hanayome ∬ - {NUM} [1080p].4.ger.ass' FONTDIR = '5-toubun_no_Hanayome_subs/_fonts' ENC_LOSS = LosslessEncoder('nvencc', Path('gotoubun_common/nvenc_settings'), progress_update=None) ENCODER = X265Encoder( 'x265', Path('gotoubun_common/x265_settings'), progress_update=lambda v, e: print( f"\rVapourSynth: {v}/{e} ~ {100 * v // e}% || Encoder: ", end="")) A_EXTRACTER = BasicTool( 'eac3to', [JPBD.src, '2:', JPBD.a_src.format(1), '-log=NUL']) A_CUTTER = AudioCutter(JPBD, track=1) A_ENCODER = AudioEncoder('qaac', Path('gotoubun_common/qaac_settings'), JPBD, track=1) class Filtering(): def main(self) -> vs.VideoNode: """Vapoursynth filtering""" src = JPBD.clip_cut src = depth(src, 16) src_cru = WEB_CRU.clip_cut src_aod = WEB_AOD.clip_cut