Commit Graph
5 Commits
Author SHA1 Message Date
hoelee 8b3d979eb3 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 时整项拦下,不再静默丢弃。
2026-10-30 01:20:22 +08:00
hoelee 9c0e8b1eb1 feat(color): 10-bit 色深透传与 Rec.709/HDR 色彩空间元数据保持 (Q-20 B项) 2026-10-18 17:06:28 +08:00
hoelee cb6c5f644e 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.
2026-10-11 13:56:54 +08:00
hoelee 24892668a9 gate: decode both sides sequentially; lock: heartbeat + age-based staleness
Two bugs the library run exposed on real files:

* An input seek is not a faithful decode. On an H.264 source with open GOPs the frames after the
  landing point decode differently from a sequential decode - the SAME file compared with itself,
  once seeked and once decoded in order, scored min 0.25 / mean 0.82, and the gate condemned good
  encodes because of it. Both sides are now decoded sequentially with the window cut by the trim
  filter, which is also the only decode guaranteed to match what the encoder itself saw.
* Staleness of the run lock. Killing a background session kills the wrapper but not the python
  underneath, so a live run's lock survives and the next start is correctly refused (it looked like
  a pid-reuse bug; it was not). The lock now carries a heartbeat, staleness is decided by age as
  well as pid, and a takeover that cannot delete a file the OS still holds overwrites it in place.
2026-10-07 10:13:15 +08:00
Hermes Agent 0cdb54f910 universal-video-transcode: any file in, one iPad+Android-playable MP4 out
Give it a path; it reads the source, picks the recipe, encodes, and verifies the
result before accepting it.

The problem it exists to remove: a file can drop ~23% of its frames in a browser
while r_frame_rate == avg_frame_rate reads EXACTLY equal, so every fps-based check
calls it healthy and it never enters a repair queue. The cause is deterministic and
header-readable -- the MP4 composition-offset table is unusable, either a single
constant ctts entry (PTS == DTS + const) or no ctts box at all (PTS == DTS) -- so the
frame timestamps are in decode order and the decoder's reordered output frames carry
the wrong times.

- three recipes chosen from the source FILE, never the filename: lossless -c copy when
  the timeline allows it, AAC-only fix when just the audio is wrong, full HEVC (or
  x264 for reach) when the timeline cannot be copied
- quality policy: never upscale; HEVC -cq 27 measured at SSIM 0.9937 ~= source size;
  audio copied when already AAC, else AAC 256k
- the two flags that must never be dropped: -fps_mode cfr and -pix_fmt yuv420p
- verified before acceptance: duration, resolution, codec, hvc1 tag, 8-bit, uniform
  cadence, no flat composition offsets, full decode pass, and a read-back after the write
- built for cron: lock file (two concurrent NVENC jobs starve one encoder and DROP
  FRAMES), idempotent, leaves the input untouched on failure, aborts below 5 GB free
- scripts/selftest.py builds both defect shapes and asserts the detector, including a
  Matroska case that must NOT be flagged

Measured on the file that prompted this: 23.0% of frames dropped before, 0.0% after.
2026-10-04 13:01:14 +08:00