fix(io): 共享盘读不再无超时 —— 准备阶段流式哈希、回读改三段抽样
8 小时的车道挂死发生在 copy_remote_to_local() 之后的整文件网络重读校验上 (暂存档 9 秒就拷满 842,854,400 B,进程 8 小时 CPU 只有 2.52 s,线程停在 Wait/Executive)。同一个文件在几秒内被 SMB 读第二遍,对 RaiDrive/Dokan 是纯风险。 - copy_remote_to_local(): 边读边喂 sha256,拷完与本地暂存档比对, 删掉准备阶段的 _sha_remote(src) 整文件重读。证据强度不降(仍证明本地副本 == 共享盘服务的字节),远程读流量减半。 - 上传/安装回读: _sha_remote() → _sha_remote_sample(),严格 size + 首/中/尾 各 8 MB(24 MB 证据)。三类真实损坏(截断、moov/cues 未刷、零填充)都会 改变抽样窗口。 - copy 档补 -tag:v hvc1: 原来 tag 挂在 color_metadata_args 里,被 `if tier != "copy"` 整段跳过,HEVC 源 remux 成 mp4 会写成 hev1 —— iPad 拒播,而且下次扫描的「已达标跳过」判据命不中。 - tracks: disposition 回写(default/forced),没有标记也显式写 0。 - transcode.probe(): 从 side_data_list 读出 Dolby Vision profile / mastering display / max-CLL,新增 dv/mdm/cll 三个键。 - DV 源一律 SKIP 拦截(Profile 5 的 IPT-PQ-C2 不被 libx265 识别,裸编会 偏绿/偏紫,而安装成功会删源 = 不可逆);HDR10 静态元数据能读到就透传。 - 位图字幕(PGS/VOBSUB)进不了 MP4 时整项拦下,不再静默丢弃。
This commit is contained in:
1 parent
fc3d1ff022
commit
8b3d979eb3
3 files changed
+189
-17
No files matched your search
@@ -67,6 +67,64 @@ def _fps(v):
|
||||
return 0.0
|
||||
|
||||
|
||||
# ---- HDR / Dolby Vision, read from the probe's side data ------------------------------------
|
||||
# 2026-10-30(顾问 Q-06):这两组元数据以前**完全没有读**。后果分两头:
|
||||
# * Dolby Vision Profile 5 用的是专有 IPT-PQ-C2 色彩空间,libx265 不看 RPU,裸编出来会严重偏绿/偏紫,
|
||||
# 而安装成功后会删掉源档 —— 不可逆;
|
||||
# * HDR10 丢了 Mastering display / MaxCLL,电视只能猜着 tone map,观感偏暗或高光溢出。
|
||||
# 探针已经带着 -show_streams 的 side_data_list 回来,读它不需要额外开进程。
|
||||
|
||||
|
||||
def _rat(v, scale):
|
||||
"""'34000/50000' -> 34000 (scaled to 50000ths), or None."""
|
||||
try:
|
||||
n, d = str(v).split("/")
|
||||
return int(round(float(n) / float(d) * scale))
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def _dv_profile(v):
|
||||
"""'05' / '08' style Dolby Vision profile, or '' when the stream is not DV."""
|
||||
tag = (v.get("codec_tag_string") or "").lower()
|
||||
for sd in (v.get("side_data_list") or []):
|
||||
if "dovi" in (sd.get("side_data_type") or "").lower() or "dolby vision" in (sd.get("side_data_type") or "").lower():
|
||||
p = sd.get("dv_profile")
|
||||
return ("%02d" % int(p)) if p is not None else "?"
|
||||
if tag in ("dvh1", "dvhe"):
|
||||
return "?"
|
||||
return ""
|
||||
|
||||
|
||||
def _master_display(v):
|
||||
"""x265 `master-display=` string from the probe's mastering-display side data, or ''."""
|
||||
for sd in (v.get("side_data_list") or []):
|
||||
if "mastering display" not in (sd.get("side_data_type") or "").lower():
|
||||
continue
|
||||
gx, gy = _rat(sd.get("green_x"), 50000), _rat(sd.get("green_y"), 50000)
|
||||
bx, by = _rat(sd.get("blue_x"), 50000), _rat(sd.get("blue_y"), 50000)
|
||||
rx, ry = _rat(sd.get("red_x"), 50000), _rat(sd.get("red_y"), 50000)
|
||||
wx, wy = _rat(sd.get("white_point_x"), 50000), _rat(sd.get("white_point_y"), 50000)
|
||||
lmax, lmin = _rat(sd.get("max_luminance"), 10000), _rat(sd.get("min_luminance"), 10000)
|
||||
if None in (gx, gy, bx, by, rx, ry, wx, wy, lmax, lmin):
|
||||
return ""
|
||||
return ("G(%d,%d)B(%d,%d)R(%d,%d)WP(%d,%d)L(%d,%d)"
|
||||
% (gx, gy, bx, by, rx, ry, wx, wy, lmax, lmin))
|
||||
return ""
|
||||
|
||||
|
||||
def _content_light(v):
|
||||
"""`max-cll=a,b` from the content-light-level side data, or ''."""
|
||||
for sd in (v.get("side_data_list") or []):
|
||||
if "content light" not in (sd.get("side_data_type") or "").lower():
|
||||
continue
|
||||
a, b = sd.get("max_content"), sd.get("max_average")
|
||||
if a is None or b is None:
|
||||
return ""
|
||||
return "%d,%d" % (int(a), int(b))
|
||||
return ""
|
||||
|
||||
|
||||
def probe(path):
|
||||
r = run([FFPROBE, "-v", "error", "-print_format", "json",
|
||||
"-show_streams", "-show_format", path], timeout=120)
|
||||
@@ -95,6 +153,10 @@ def probe(path):
|
||||
"fmt": (j.get("format", {}).get("format_name") or "").lower(),
|
||||
"rfps": _fps(v.get("r_frame_rate")), "afps": _fps(v.get("avg_frame_rate")),
|
||||
"hbf": int(v.get("has_b_frames") or 0),
|
||||
# HDR / DV(2026-10-30):'' 表示没有。调用方据此决定"拒编"还是"透传静态元数据"。
|
||||
"dv": _dv_profile(v),
|
||||
"mdm": _master_display(v),
|
||||
"cll": _content_light(v),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user