diff --git a/Av1an/chunk.py b/Av1an/chunk.py index c5b30f5..308743b 100644 --- a/Av1an/chunk.py +++ b/Av1an/chunk.py @@ -49,20 +49,6 @@ class Chunk: encoder = Av1an.ENCODERS[args.encoder] self.pass_cmds = encoder.compose_1_pass(args, self) if args.passes == 1 else encoder.compose_2_pass(args, self) - def remove_first_pass_from_commands(self) -> None: - """ - Removes the first pass command from the list of commands. - Used with first pass reuse - - :return: None - """ - # just one pass to begin with, do nothing - if len(self.pass_cmds) == 1: - return - - # passes >= 2, remove the command for first pass (pass_cmds[0]) - self.pass_cmds = self.pass_cmds[1:] - def to_dict(self) -> Dict[str, Any]: """ Converts this chunk to a dictionary for easy json serialization diff --git a/Av1an/encode.py b/Av1an/encode.py index 2eb0ef2..7c360b4 100644 --- a/Av1an/encode.py +++ b/Av1an/encode.py @@ -163,18 +163,20 @@ def encode(chunk: Chunk, args: Args): if args.vmaf_target: target_vmaf_routine(args, chunk) - # remove first pass command if reusing - if args.reuse_first_pass: - chunk.remove_first_pass_from_commands() - # if vvc, we need to create a yuv file if args.encoder == 'vvc': log(f'Creating yuv for chunk {chunk.name}\n') vvc_yuv_file = Vvc.to_yuv(chunk) log(f'Created yuv for chunk {chunk.name}\n') + # skip first pass if reusing + if args.reuse_first_pass and args.passes >= 2: + start = 2 + else: + start = 1 + # Run all passes for this chunk - for current_pass in range(1, args.passes + 1): + for current_pass in range(start, args.passes + 1): tqdm_bar(args, chunk, args.encoder, args.counter, chunk_frames, args.passes, current_pass) # if vvc, we need to delete the yuv file