engine children: pass CREATE_NO_WINDOW on every ffmpeg/ffprobe spawn

The queues run the engines under pythonw.exe (no console). A console-subsystem child spawned by a
console-less parent without CREATE_NO_WINDOW makes Windows allocate a NEW console and SHOW it - one
visible window per ffprobe/ffmpeg call (measured 2026-10-11: Windows Terminal windows titled with the
ffmpeg binary while two encodes ran).

Fixed: transcode.run(), library_run.run()/run_watched() and the three gate helpers that call ffmpeg
directly (SSIM filtergraph, per-offset pairs, VMAF).

Proof (cache/scratch/nowin_test4.py, run in a DETACHED pythonw: GetConsoleWindow()==0, like the
engine): raw Popen without the flag -> 1 new visible console window; with the flag -> none) -> 0;
transcode.run() -> 0 windows, library_run.run() -> 0, library_run.run_watched() -> 0.
This commit is contained in:
2026-10-11 13:56:54 +08:00
parent 2a2fcb5867
commit cb6c5f644e
2 changed files with 21 additions and 5 deletions
+8 -1
View File
@@ -47,9 +47,16 @@ def log(*a):
print(time.strftime("%H:%M:%S ") + " ".join(str(x) for x in a), flush=True)
# A console-less parent (the queues run the engines under pythonw.exe) makes every console-subsystem
# child - ffmpeg, ffprobe - allocate a NEW console and SHOW it: measured 2026-10-11, one visible
# Windows Terminal window per spawned child while two encodes ran. CREATE_NO_WINDOW suppresses that
# (0 on POSIX, where the flag does not exist).
NOWIN = getattr(subprocess, "CREATE_NO_WINDOW", 0)
def run(cmd, timeout=86400):
return subprocess.run(cmd, capture_output=True, text=True,
encoding="utf-8", errors="replace", timeout=timeout)
encoding="utf-8", errors="replace", timeout=timeout,
creationflags=NOWIN)
def _fps(v):