def run(self, clean_up: bool = True, make_comp: bool = True) -> 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('settings/x265_settings_BD') v_lossless_encoder = FFV1Encoder() self.clip = dither_down(self.clip) video_track = VideoStream(self.file.name_clip_output, 'HEVC BDRip by LightArrowsEXE@Kaleido', JAPANESE) audio_files = video_source(self.file.path.to_str(), out_file=self.file.a_src_cut, trim_list=resolve_trims( self.file.trims_or_dfs), trims_framerate=self.file.clip.fps, frames_total=self.file.clip.num_frames, flac=False, aac=True, silent=False) audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [ AudioStream(VPath(track), 'AAC 2.0', JAPANESE, XML_TAG) ] muxer = Mux(self.file, streams=(video_track, audio_tracks, None)) config = RunnerConfig(v_encoder=v_encoder, v_lossless_encoder=v_lossless_encoder, a_extracters=None, a_cutters=None, a_encoders=None, muxer=muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() if clean_up: runner.do_cleanup() for at in audio_files: try: os.remove(at) except FileNotFoundError: Status.warn(f"File {at} not found! Skipping...") if make_comp: try: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: print(e)
def run(self, clean_up: bool = True, zones: Optional[Dict[Tuple[int, int], Dict[str, Any]]] = None) -> None: """ :param clean_up: Perform clean-up procedure after encoding :param zones: Zones for x265 """ v_encoder = X265Encoder('settings/x265_settings', zones=zones) v_lossless_encoder = FFV1Encoder() self.clip = dither_down(self.clip) video_track = VideoStream(self.file.name_clip_output, 'HEVC BDRip by LightArrowsEXE@Kaleido', JAPANESE) audio_files = video_source(self.file.path.to_str(), out_file=self.file.a_src_cut, trim_list=resolve_trims( self.file.trims_or_dfs), trims_framerate=self.file.clip.fps, frames_total=self.file.clip.num_frames, flac=True, aac=False, silent=False) audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [AudioStream(VPath(track), 'FLAC 2.0', JAPANESE)] muxer = Mux(self.file, streams=(video_track, audio_tracks, None)) config = RunnerConfig(v_encoder=v_encoder, v_lossless_encoder=v_lossless_encoder, a_extracters=None, a_cutters=None, a_encoders=None, muxer=muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() if clean_up: runner.do_cleanup() for at in audio_files: try: os.remove(at) except FileNotFoundError: Status.warn(f"File {at} not found! Skipping...")
def run(self, clean_up: bool = True, make_comp: bool = True) -> 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.audio_file.a_src assert self.audio_file.a_enc_cut v_encoder = X265Encoder('settings/x265_settings') self.clip = dither_down(self.clip) audio_files = video_source(self.file.path.to_str(), trim_list=resolve_trims( self.file.trims_or_dfs), trims_framerate=self.file.clip.fps, flac=False, aac=True, silent=False) audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [ AudioStream(VPath(track), 'AAC 2.0', JAPANESE, XML_TAG) ] muxer = Mux(self.file, streams=(VideoStream( self.file.name_clip_output, 'HEVC BDRip by LightArrowsEXE@Kaleido', JAPANESE), audio_tracks, None)) config = RunnerConfig(v_encoder, None, None, None, None, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() try: if make_comp: generate_comparison_NCOP1(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(str(e)) if clean_up: runner.do_cleanup()
def run(self, clean_up: bool = True, make_comp: bool = True, BDMV: bool = False, zones: Optional[Dict[Tuple[int, int], Dict[str, Any]]] = 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 v_encoder = X265Encoder(pick_settings(self.file), zones=zones) v_lossless_encoder = FFV1Encoder() self.clip = dither_down(self.clip) if BDMV: # For use with BDMVs, *not* Switch/PS4 rips audio_files = video_source(self.file.path.to_str(), out_file=self.file.a_src_cut, trim_list=resolve_trims( self.file.trims_or_dfs), trims_framerate=self.file.clip.fps, flac=True, aac=False, silent=False) audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [ AudioStream(VPath(track), 'FLAC 2.0', JAPANESE) ] else: a_extracters = FfmpegAudioExtracter(self.file, track_in=0, track_out=0) a_cutters = EztrimCutter(self.file, track=1) credit = 'HEVC GameRip by LightArrowsEXE@Kaleido' if not BDMV \ else 'HEVC BDRip by LightArrowsEXE@Kaleido' muxer = Mux( self.file, streams=(VideoStream( self.file.name_clip_output, credit, JAPANESE), audio_tracks[0] if BDMV else AudioStream( self.file.a_src_cut.set_track(1), 'AAC 2.0', JAPANESE), None)) config = RunnerConfig(v_encoder, v_lossless_encoder, None if BDMV else a_extracters, None if BDMV else a_cutters, None, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() if clean_up: runner.do_cleanup() for at in audio_files: try: os.remove(at) except FileNotFoundError: Status.warn(f"File {at} not found! Skipping") if make_comp: try: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(str(e))
def run(self, clean_up: bool = True, make_comp: bool = True, zones: Optional[Dict[Tuple[int, int], Dict[str, Any]]] = 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 v_encoder = X265Encoder(pick_settings(self.file), zones=zones) self.clip = dither_down(self.clip) audio_files = video_source(self.file.path.to_str(), trim_list=resolve_trims( self.file.trims_or_dfs), trims_framerate=self.file.clip.fps, flac=False, aac=True, silent=False) audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [ AudioStream(VPath(track), 'AAC 2.0', JAPANESE, XML_TAG) ] 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) muxer = Mux(self.file, streams=(VideoStream( self.file.name_clip_output, 'HEVC BDRip by LightArrowsEXE@Kaleido', JAPANESE), audio_tracks, chapters if self.chapter_list else None)) config = RunnerConfig(v_encoder, None, None, None, None, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() try: if make_comp: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(str(e)) if clean_up: runner.do_cleanup() for at in audio_files: try: os.remove(at) except FileNotFoundError: Status.warn(f"File \"{at}\" not found! Skipping")
def run(self, clean_up: bool = True, make_comp: bool = True) -> 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 v_encoder = X265Encoder('settings/x265_settings') self.clip = dither_down(self.clip) audio_files = video_source(self.file.path.to_str(), trimlist=verify_trim( self.file.trims_or_dfs), framerate=self.file.clip.fps, noflac=True, noaac=False, silent=False) audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [ AudioStream(VPath(track), 'AAC 2.0', JAPANESE, XML_TAG) ] if self.chapter_list: assert self.file.chapter assert self.file.trims_or_dfs Path("/chapters").mkdir(parents=True, exist_ok=True) 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) muxer = Mux(self.file, streams=(VideoStream( self.file.name_clip_output, 'HEVC BDRip by LightArrowsEXE@Kaleido', JAPANESE), audio_tracks, chapters if self.chapter_list else None)) config = RunnerConfig(v_encoder, None, None, None, None, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() try: if make_comp: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(str(e)) if clean_up: runner.do_cleanup()
def run(self, clean_up: bool = True, make_comp: bool = True) -> 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 is_dvd = False if self.file.clip.width > 1280 else True if is_dvd: Status.info("DVD encode detected: Switching over to DVD settings") x265_settings = 'settings/x265_settings' if not is_dvd else 'settings/x265_settings_dvd' msg = 'HEVC BDRip by LightArrowsEXE@Kaleido' if not is_dvd else 'HEVC DVDrip by LightArrowsEXE@Kaleido' v_encoder = X265Encoder(x265_settings) self.clip = dither_down(self.clip) audio_files = video_source(self.file.path.to_str(), trim_list=resolve_trims( self.file.trims_or_dfs), trims_framerate=self.file.clip.fps, flac=False, aac=True, silent=False) if not is_dvd: audio_tracks: List[AudioStream] = [] for track in audio_files: audio_tracks += [ AudioStream(VPath(track), 'AAC 2.0', JAPANESE, XML_TAG) ] else: a_extracters = FfmpegAudioExtracter(self.file, track_in=0, track_out=0) a_cutters = EztrimCutter(self.file, track=1) audio_tracks = AudioStream(self.file.a_src_cut.set_track(1), 'AC-3 2.0', JAPANESE) 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) muxer = Mux(self.file, streams=(VideoStream(self.file.name_clip_output, msg, JAPANESE), audio_tracks, chapters if self.chapter_list else None)) if not is_dvd: config = RunnerConfig(v_encoder, None, None, None, None, muxer) else: config = RunnerConfig(v_encoder, None, a_extracters, a_cutters, None, muxer) runner = SelfRunner(self.clip, self.file, config) runner.run() try: if make_comp: generate_comparison(self.file, self.file.name_file_final.to_str(), self.clip) except ValueError as e: Status.fail(str(e)) if clean_up: runner.do_cleanup()