Esempio n. 1
0
    def man_q(self, command: Command, q: int) -> Command:
        """Return command with new cq value"""

        adjusted_command = command.copy()

        i = list_index_of_regex(adjusted_command, r"--cq-level=.+")
        adjusted_command[i] = f"--cq-level={q}"

        return adjusted_command
Esempio n. 2
0
    def man_q(self, command: Command, q: int) -> Command:
        """Return command with new cq value

        :param command: old command
        :param q: new cq value
        :return: command with new cq value"""

        adjusted_command = command.copy()

        i = list_index_of_regex(adjusted_command, r"(--qp|-q|--crf)")
        adjusted_command[i + 1] = f"{q}"

        return adjusted_command
Esempio n. 3
0
    def man_q(self, command: Command, q: int) -> Command:
        """Return command with new cq value

        :param command: old command
        :param q: new cq value
        :return: command with new cq value"""

        adjusted_command = command.copy()

        i = list_index_of_regex(adjusted_command, r"--quantizer")
        adjusted_command[i + 1] = f'{q}'

        return adjusted_command
Esempio n. 4
0
    def mod_command(self, command, chunk) -> Command:
        """Return new command with q_file

        :param command: old command
        :param q: q list
        :return: command with new cq value"""
        adjusted_command = command.copy()

        i = list_index_of_regex(adjusted_command, r"(--qp|-q|--crf)")

        qp_file = chunk.make_q_file(chunk.per_frame_target_quality_q_list)

        new = ["--use-q-file", "1", "--qpfile", f"{qp_file.as_posix()}"]
        new_cmd = adjusted_command[:i] + new + adjusted_command[i + 2 :]

        return new_cmd