Add live updating progress bar for svt-av1

This commit is contained in:
n9Mtq4 2020-09-21 21:19:25 -04:00
parent 821e2aa945
commit b72fb6d6f0
2 changed files with 14 additions and 9 deletions

View file

@ -98,11 +98,12 @@ def tqdm_bar(a: Args, c: Chunk, encoder, counter, frame_probe_source, passes, cu
enc = ENCODERS[encoder]
pipe = enc.make_pipes(a, c, passes, current_pass, c.output)
if encoder in ('aom', 'vpx', 'rav1e', 'x265', 'x264', 'vvc'):
if encoder in ('aom', 'vpx', 'rav1e', 'x265', 'x264', 'vvc', 'svt_av1'):
process_encoding_pipe(pipe, encoder, counter)
if encoder in ('svt_av1', 'svt_vp9'):
if encoder in ('svt_vp9'):
# SVT-AV1 developer: SVT-AV1 is special in the way it outputs to console
# SVT-AV1 got a new output mode, but SVT-VP9 is still special
process_pipe(pipe)
counter.update(frame_probe_source // passes)

View file

@ -1,10 +1,11 @@
import os
import re
from Av1an.arg_parse import Args
from Chunks.chunk import Chunk
from Av1an.commandtypes import MPCommands, CommandPair, Command
from Encoders.encoder import Encoder
from Av1an.utils import list_index_of_regex
from Av1an.utils import list_index_of_regex, terminate
class SvtAv1(Encoder):
@ -23,7 +24,7 @@ class SvtAv1(Encoder):
return [
CommandPair(
Encoder.compose_ffmpeg_pipe(a),
['SvtAv1EncApp', '-i', 'stdin', *a.video_params, '-b', output, '-']
['SvtAv1EncApp', '-i', 'stdin', '--progress', '2', *a.video_params, '-b', output, '-']
)
]
@ -31,13 +32,13 @@ class SvtAv1(Encoder):
return [
CommandPair(
Encoder.compose_ffmpeg_pipe(a),
['SvtAv1EncApp', '-i', 'stdin', '--irefresh-type 2', *a.video_params, '-output-stat-file', f'{c.fpf}.stat', '-b', os.devnull,
'-']
['SvtAv1EncApp', '-i', 'stdin', '--progress', '2', '--irefresh-type', '2', *a.video_params,
'-output-stat-file', f'{c.fpf}.stat', '-b', os.devnull, '-']
),
CommandPair(
Encoder.compose_ffmpeg_pipe(a),
['SvtAv1EncApp', '-i', 'stdin', '--irefresh-type 2', *a.video_params, '-input-stat-file', f'{c.fpf}.stat', '-b', output,
'-']
['SvtAv1EncApp', '-i', 'stdin', '--progress', '2', '--irefresh-type', '2', *a.video_params,
'-input-stat-file', f'{c.fpf}.stat', '-b', output, '-']
)
]
@ -60,4 +61,7 @@ class SvtAv1(Encoder):
:param line: one line of text output from the encoder
:return: match object from re.search matching the number of encoded frames"""
pass # todo: SVT encoders are special in the way they output to console
if 'error' in line.lower():
print('\n\nERROR IN ENCODING PROCESS\n\n', line)
terminate()
return re.search(r"Encoding frame\s+(\d+)", line)