Ejemplo n.º 1
0
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",
        "-",
    ]
Ejemplo n.º 2
0
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)

    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,'-color_range', '0', '-f', 'yuv4mpegpipe', '-']
Ejemplo n.º 3
0
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",
        "-",
    ]