def startup_check(project: Project): """ Performing essential checks at startup_check Set constant values """ if sys.version_info < (3, 6): print("Python 3.6+ required") sys.exit() if sys.platform == "linux": def restore_term(): os.system("stty sane") atexit.register(restore_term) if not project.chunk_method: project.select_best_chunking_method() project.is_vs = is_vapoursynth(project.input[0]) if project.is_vs: project.chunk_method = "vs_ffms2" project.check_exes() set_target_quality(project) if (project.reuse_first_pass and project.encoder != "aom" and project.split_method != "aom_keyframes"): print("Reusing the first pass is only supported with \ the aom encoder and aom_keyframes split method.") terminate() setup_encoder(project) # No check because vvc if project.encoder == "vvc": project.no_check = True if project.encoder == "svt_vp9" and project.passes == 2: print( "Implicitly changing 2 pass svt-vp9 to 1 pass\n2 pass svt-vp9 isn't supported" ) project.passes = 1 project.audio_params = shlex.split(project.audio_params) project.ffmpeg = shlex.split(project.ffmpeg) project.pix_format = ["-strict", "-1", "-pix_fmt", project.pix_format] project.ffmpeg_pipe = [ *project.ffmpeg, *project.pix_format, "-f", "yuv4mpegpipe", "-", ]
def frame_probe(source: Path): """ Determines the total number of frames in a given input. Differentiates between a Vapoursynth script and standard video and delegates to vspipe or ffmpeg respectively. """ if is_vapoursynth(source): return frame_probe_vspipe(source) return frame_probe_ffmpeg(source)
def startup_check(project: Project): """ Performing essential checks at startup_check Set constant values """ if sys.version_info < (3, 6): print("Python 3.6+ required") sys.exit() if sys.platform == "linux": def restore_term(): os.system("stty sane") atexit.register(restore_term) if project.encoder not in ["rav1e", "aom", "svt_av1", "vpx"] and project.output_ivf: print(".ivf only supports VP8, VP9, and AV1") sys.exit(1) if not project.chunk_method: project.select_best_chunking_method() project.is_vs = is_vapoursynth(project.input[0]) if project.is_vs: project.chunk_method = "vs_ffms2" project.check_exes() set_target_quality(project) setup_encoder(project) project.audio_params = shlex.split(project.audio_params) project.ffmpeg = shlex.split(project.ffmpeg) project.pix_format = ["-strict", "-1", "-pix_fmt", project.pix_format] project.ffmpeg_pipe = [ *project.ffmpeg, *project.pix_format, "-f", "yuv4mpegpipe", "-", ]