another logging issue
This commit is contained in:
@@ -227,7 +227,6 @@ final_clip.set_output()
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
original_console = sys.__stdout__
|
original_console = sys.__stdout__
|
||||||
last_encoding_line = ""
|
|
||||||
|
|
||||||
with subprocess.Popen(vspipe_cmd, stdout=subprocess.PIPE) as vspipe_proc:
|
with subprocess.Popen(vspipe_cmd, stdout=subprocess.PIPE) as vspipe_proc:
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
@@ -241,7 +240,6 @@ final_clip.set_output()
|
|||||||
vspipe_proc.stdout.close()
|
vspipe_proc.stdout.close()
|
||||||
|
|
||||||
def tee_output(proc_stdout, console):
|
def tee_output(proc_stdout, console):
|
||||||
nonlocal last_encoding_line
|
|
||||||
for line in proc_stdout:
|
for line in proc_stdout:
|
||||||
if console:
|
if console:
|
||||||
try:
|
try:
|
||||||
@@ -249,17 +247,12 @@ final_clip.set_output()
|
|||||||
console.flush()
|
console.flush()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
if "Encoding:" in line:
|
|
||||||
last_encoding_line = line
|
|
||||||
|
|
||||||
tee_thread = threading.Thread(target=tee_output, args=(svt_proc.stdout, original_console))
|
tee_thread = threading.Thread(target=tee_output, args=(svt_proc.stdout, original_console))
|
||||||
tee_thread.start()
|
tee_thread.start()
|
||||||
svt_proc.wait()
|
svt_proc.wait()
|
||||||
tee_thread.join()
|
tee_thread.join()
|
||||||
|
|
||||||
if last_encoding_line:
|
|
||||||
print(last_encoding_line, end='')
|
|
||||||
|
|
||||||
if svt_proc.returncode != 0:
|
if svt_proc.returncode != 0:
|
||||||
raise RuntimeError(f"SvtAv1EncApp failed with exit code {svt_proc.returncode}")
|
raise RuntimeError(f"SvtAv1EncApp failed with exit code {svt_proc.returncode}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user