From 797fcaae0a2aff5069a188b9f0f8f56da465e90c Mon Sep 17 00:00:00 2001 From: pat-e Date: Mon, 11 Aug 2025 12:23:46 +0200 Subject: [PATCH] revert d69dae0796d49c4fb5beef739b7981ef92055443 revert changes the process-call to include the svtav1encapp - stats into the log-file --- anime_audio_helper.py | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/anime_audio_helper.py b/anime_audio_helper.py index 6b913e1..d8190bc 100755 --- a/anime_audio_helper.py +++ b/anime_audio_helper.py @@ -219,39 +219,11 @@ def convert_video(source_file_base, source_file_full, is_vfr, target_cfr_fps_for ) print(f" - Running: {' '.join(ffmpeg_pipe_cmd)} | {' '.join(svtav1_cmd)}") - # Use subprocess.Popen for piping and tee SvtAv1EncApp output - import threading - - # Save the original stdout (console) before redirection - original_console = sys.__stdout__ - + # Use subprocess.Popen for piping with subprocess.Popen(ffmpeg_pipe_cmd, stdout=subprocess.PIPE) as ffmpeg_proc: - with subprocess.Popen( - svtav1_cmd, - stdin=ffmpeg_proc.stdout, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - bufsize=1, - text=True - ) as svt_proc: + with subprocess.Popen(svtav1_cmd, stdin=ffmpeg_proc.stdout) as svt_proc: ffmpeg_proc.stdout.close() # Allow ffmpeg_proc to receive a SIGPIPE if svt_proc exits - - def tee_output(proc_stdout, log_file, console): - for line in proc_stdout: - # Write to log file (current sys.stdout) - print(line, end='') # Goes to log file - # Write to console - if console: - try: - console.write(line) - console.flush() - except Exception: - pass - - tee_thread = threading.Thread(target=tee_output, args=(svt_proc.stdout, sys.stdout, original_console)) - tee_thread.start() - svt_proc.wait() - tee_thread.join() + svt_proc.communicate() if svt_proc.returncode != 0: raise RuntimeError(f"SvtAv1EncApp failed with exit code {svt_proc.returncode}")