mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-25 02:29:40 +00:00
better error printing
This commit is contained in:
parent
fc93f71cbe
commit
cee6eeb1e9
2 changed files with 20 additions and 3 deletions
|
@ -3,7 +3,7 @@ from subprocess import PIPE, STDOUT
|
|||
import re
|
||||
from multiprocessing.managers import BaseManager
|
||||
from tqdm import tqdm
|
||||
|
||||
from utils.utils import terminate
|
||||
|
||||
# Stuff for updating encoded progress in real-time
|
||||
class MyManager(BaseManager):
|
||||
|
@ -46,12 +46,22 @@ def tqdm_bar(i, encoder, counter, frame_probe_source, passes):
|
|||
line = pipe.stdout.readline().strip()
|
||||
if len(line) == 0 and pipe.poll() is not None:
|
||||
break
|
||||
|
||||
if len(line) == 0:
|
||||
continue
|
||||
|
||||
if encoder in ('aom', 'vpx', 'rav1e'):
|
||||
match = None
|
||||
if encoder in ('aom', 'vpx'):
|
||||
if 'fatal' in line.lower():
|
||||
print('\n\nERROR IN ENCODING PROCESS\n\n', line)
|
||||
terminate()
|
||||
if 'Pass 2/2' in line or 'Pass 1/1' in line:
|
||||
match = re.search(r"frame.*?\/([^ ]+?) ", line)
|
||||
elif encoder == 'rav1e':
|
||||
if 'error' in line.lower():
|
||||
print('\n\nERROR IN ENCODING PROCESS\n\n', line)
|
||||
terminate()
|
||||
match = re.search(r"encoded.*? ([^ ]+?) ", line)
|
||||
|
||||
if match:
|
||||
|
|
|
@ -8,6 +8,7 @@ import numpy as np
|
|||
from math import isnan
|
||||
from scipy import interpolate
|
||||
import matplotlib
|
||||
from utils.utils import terminate
|
||||
|
||||
|
||||
def read_vmaf_xml(file, percentile):
|
||||
|
@ -36,12 +37,18 @@ def call_vmaf( source: Path, encoded: Path, model=None, return_file=False):
|
|||
# For vmaf calculation both source and encoded segment scaled to 1080
|
||||
# for proper vmaf calculation
|
||||
fl = source.with_name(encoded.stem).with_suffix('.xml').as_posix()
|
||||
cmd = f'ffmpeg -hide_banner -r 60 -i {source.as_posix()} -r 60 -i {encoded.as_posix()} ' \
|
||||
cmd = f'ffmpeg -loglevel error -hide_banner -r 60 -i {source.as_posix()} -r 60 -i {encoded.as_posix()} ' \
|
||||
f'-filter_complex "[0:v]scale=1920:1080:flags=spline:force_original_aspect_ratio=decrease[scaled1];' \
|
||||
f'[1:v]scale=1920:1080:flags=spline:force_original_aspect_ratio=decrease[scaled2];' \
|
||||
f'[scaled2][scaled1]libvmaf=log_path={fl}{mod}" -f null - '
|
||||
|
||||
call = subprocess.run(cmd, shell=True, stdout=PIPE, stderr=STDOUT).stdout
|
||||
c = subprocess.run(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
|
||||
call = c.stdout
|
||||
# print(c.stdout.decode())
|
||||
if 'error' in call.decode().lower():
|
||||
print('\n\nERROR IN VMAF CALCULATION\n\n',call.decode())
|
||||
terminate()
|
||||
|
||||
|
||||
if return_file:
|
||||
return fl
|
||||
|
|
Loading…
Reference in a new issue