fix(tracks): ffprobe / ffmpeg 子进程统一 CREATE_NO_WINDOW
Windows 上每次探测轨道、取流摘要都会闪一个黑窗(命令行窗口), 批量扫描几百个文件时尤其明显。ffprobe 的 subprocess.run 与 _stream_digest 的 ffmpeg Popen/run 全部加 creationflags=NOWIN, 与 library_run.py / transcode.py 的既有做法保持一致。 scripts.test_tracks 55/55。
This commit is contained in:
1 parent
e66551200f
commit
fc3d1ff022
1 file changed
+6
-3
+6
-3
@@ -43,6 +43,8 @@ import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
NOWIN = getattr(subprocess, "CREATE_NO_WINDOW", 0)
|
||||
|
||||
# The supervisor hands every engine child its OWN resolved ffmpeg/ffprobe
|
||||
# (`rt.config.engine_child_env` → TRANSCODE_FFMPEG/TRANSCODE_FFPROBE, mirroring
|
||||
# `transcode.py:36-37`). Honour them here as well: this module used to call the bare
|
||||
@@ -87,7 +89,7 @@ def probe(path, timeout=180):
|
||||
r = subprocess.run([FFPROBE, "-v", "error", "-print_format", "json",
|
||||
"-show_streams", "-show_format", "-show_chapters", path],
|
||||
capture_output=True, text=True, encoding="utf-8", errors="replace",
|
||||
timeout=timeout)
|
||||
timeout=timeout, creationflags=NOWIN)
|
||||
if r.returncode != 0:
|
||||
return None
|
||||
try:
|
||||
@@ -450,7 +452,7 @@ def stream_signature(path, sel, timeout=1800):
|
||||
r = subprocess.run([FFPROBE, "-v", "error", "-select_streams", sel, "-count_packets",
|
||||
"-show_entries", "stream=nb_read_packets", "-of", "csv=p=0", path],
|
||||
capture_output=True, text=True, encoding="utf-8", errors="replace",
|
||||
timeout=timeout)
|
||||
timeout=timeout, creationflags=NOWIN)
|
||||
if r.returncode != 0:
|
||||
return None
|
||||
try:
|
||||
@@ -458,7 +460,8 @@ def stream_signature(path, sel, timeout=1800):
|
||||
except Exception: # noqa: BLE001
|
||||
return None
|
||||
p = subprocess.Popen([FFMPEG, "-v", "error", "-i", path, "-map", "0:" + sel, "-c", "copy",
|
||||
"-f", "data", "-"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
"-f", "data", "-"], stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
creationflags=NOWIN)
|
||||
h = hashlib.md5()
|
||||
try:
|
||||
while True:
|
||||
|
||||
Reference in new issue
Block a user