diff --git a/Av1an/bar.py b/Av1an/bar.py index 46842ee..06ff4f0 100755 --- a/Av1an/bar.py +++ b/Av1an/bar.py @@ -45,12 +45,29 @@ def make_pipes(command): return pipe +def process_pipe(pipe): + encoder_history = deque(maxlen=20) + while True: + line = pipe.stdout.readline().strip() + if len(line) == 0 and pipe.poll() is not None: + break + if len(line) == 0: + continue + if line: + encoder_history.append(line) + + if pipe.returncode != 0 and pipe.returncode != -2: + print(f"\nEncoder encountered an error: {pipe.returncode}") + print('\n'.join(encoder_history)) + + def make_vvc_pipe(command): pipe = subprocess.Popen(command.split(), stdout=PIPE, stderr=STDOUT, universal_newlines=True) return pipe + def match_aom_vpx(line): if 'fatal' in line.lower(): print('\n\nERROR IN ENCODING PROCESS\n\n', line) @@ -137,8 +154,9 @@ def tqdm_bar(i, encoder, counter, frame_probe_source, passes): if encoder == 'svt_av1': # SVT-AV1 developer: SVT-AV1 is special in the way it outputs to console - pipe.wait() + process_pipe(pipe) counter.update(frame_probe_source // passes) + except Exception as e: _, _, exc_tb = sys.exc_info() - print(f'Error at encode {e}\nAt line {exc_tb.tb_lineno}') \ No newline at end of file + print(f'Error at encode {e}\nAt line {exc_tb.tb_lineno}') diff --git a/Av1an/target_vmaf.py b/Av1an/target_vmaf.py index 1f2b911..7c168f3 100644 --- a/Av1an/target_vmaf.py +++ b/Av1an/target_vmaf.py @@ -11,7 +11,7 @@ import sys from math import isnan import os from collections import deque -from .bar import make_pipes +from .bar import make_pipes, process_pipe from .utils import terminate from .ffmpeg import frame_probe from .vmaf import call_vmaf, read_vmaf_json @@ -105,21 +105,6 @@ def plot_probes(args, vmaf_cq, probe, frames): plt.savefig(f'{temp}.png', dpi=200, format='png') plt.close() -def process_pipe(pipe): - encoder_history = deque(maxlen=20) - while True: - line = pipe.stdout.readline().strip() - if len(line) == 0 and pipe.poll() is not None: - break - if len(line) == 0: - continue - if line: - encoder_history.append(line) - - if pipe.returncode != 0 and pipe.returncode != -2: - print(f"\nEncoder encountered an error: {pipe.returncode}") - print('\n'.join(encoder_history)) - def vmaf_probe(probe, q, args): cmd = probe_cmd(probe, q, args.ffmpeg_pipe, args.encoder, args.vmaf_rate) diff --git a/setup.py b/setup.py index ff02b64..983a7db 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ with open("README.md", "r") as f: setuptools.setup( name="Av1an", - version="1.12.5", + version="1.12.8", author="Master_Of_Zen", author_email="master_of_zen@protonmail.com", description="All-in-one encode toolkit",