fix(mux): -disposition 只对 MP4 写;hev1 源原地降级为 copy 重封装

顾问 Q-16 / Q-17(轮次 3 裁定):

- tracks.py::ffmpeg_args 的 -disposition 回写整块包进 container=="mp4"。
  不传时 matroska muxer 会从输入流继承整条 disposition 掩码(original/comment/
  hearing_impaired…),而 plan() 只提取 default/forced —— 显式传就是用单一标志
  覆盖整条掩码,抹掉 MKV 保真标记
- library_run.py::encode 在 tier_for_bpp 之后加一个分支:mp4 + hevc + tag!=hvc1 +
  yuv420p + 时间轴健康 → 直接 tier="copy"。走 -c:v copy -tag:v hvc1 无损重封装
  (copy 档本就跳过 SSIM),不再为一颗标签重编整片
This commit is contained in:
hoelee committed 2026-10-30 02:00:34 +08:00
1 parent 8b3d979eb3
commit 94350f18b3
2 files changed
+22 -5

No files matched your search

+11 -5
View File
@@ -308,11 +308,17 @@ def ffmpeg_args(plan_):
# 显式回写(没有标记的就写 `0`,否则 muxer 会自己挑一条标成 default)。
# NB verify() 只做宽松断言,不因 disposition 差异判 FAIL —— 不同 FFmpeg 版本的 MP4
# muxer 对默认轨/forced 的处理并不一致,拿它当硬门禁会造出永远修不好的失败。
for n, a in enumerate(p["audio"]):
args += ["-disposition:a:%d" % n, "default" if a.get("default") else "0"]
for n, s in enumerate(p["subtitles"]):
disp = [w for w, on in (("default", s.get("default")), ("forced", s.get("forced"))) if on]
args += ["-disposition:s:%d" % n, "+".join(disp) if disp else "0"]
# 顾问 Q-16(2026-10-30):**只对 MP4 写** disposition。
# 不传 `-disposition` 时 Matroska muxer 会从输入流完整继承整条 disposition 位掩码
# (original / comment / hearing_impaired …),而这里只提取了 default / forced 两个布尔值 ——
# 一旦对 MKV 显式传 `-disposition:a:n default|0`,就会**用单一标志覆盖整条掩码**,
# 把源片自带的保障性标记抹掉,违背 MKV 保真模式"位等同继承"的承诺。
if p["container"] == "mp4":
for n, a in enumerate(p["audio"]):
args += ["-disposition:a:%d" % n, "default" if a.get("default") else "0"]
for n, s in enumerate(p["subtitles"]):
disp = [w for w, on in (("default", s.get("default")), ("forced", s.get("forced"))) if on]
args += ["-disposition:s:%d" % n, "+".join(disp) if disp else "0"]
return args