Fix for svt_av1

This commit is contained in:
Zen 2020-08-06 20:45:33 +03:00
parent 1ccd465edc
commit ea1ce7867f
3 changed files with 22 additions and 19 deletions

View file

@ -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}')

View file

@ -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)

View file

@ -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",