stream_signature() ran ffmpeg -f data - with stdout=PIPE, stderr=PIPE and drained
stdout first, reading stderr only after EOF. A source that floods stderr (a Matroska
with 1,612 'exceeds containing master element' errors = 219,020 bytes) fills the 64 KB
stderr buffer, ffmpeg blocks writing it, stdout never closes and the read loop blocks
for ever - 42 min at 2.1 s of CPU, and the supervisor's gate watchdog killed the same
item three times at 60 min each. p.wait(timeout=1800) cannot help: it is unreachable
until that loop ends.
-f streamhash -hash md5 - lets ffmpeg do the md5 itself (byte-identical: 5cb7483040...
both ways on that file, 2.3 s instead of a 48.9 MB pipe) and one
subprocess.run(capture_output=True, timeout=...) drains both fds on threads, so the
stderr flood cannot wedge and a wedged demuxer costs a bounded wait that returns None
(the gate then says 'could not hash payload', never 'payload differs').
Return shape (nb_packets, md5) and every caller unchanged. test_tracks 55/55,
including 'e2e mkv/mp4: copied streams are byte-identical' on the real fixtures.
packaged builds ship ffmpeg inside their own tree; tracks.py called `ffprobe` by
bare name, which only resolved because this host has ffmpeg on PATH. The bundle
acceptance strips PATH on purpose, so probe() raised FileNotFoundError [WinError 2]
two seconds into the item and the queue logged it as a quality refusal.
Mirror transcode.py:36-37 (TRANSCODE_*/RT_* with a bare fallback).
MP4 (default) keeps the 'opens anywhere' promise: all audio tracks become AAC at the
source's own channel layout (5.1 stays 5.1), text subtitles become mov_text, bitmap
subtitles are skipped with a logged note, font attachments are not carried.
container=mkv is the explicit fidelity mode: every audio/subtitle/attachment stream is
copied bit-for-bit, chapters and tags ride along.
New scripts/tracks.py holds the pure plan + the container-aware gate; library_run.py
uses it for mapping, per-track codecs, container extension, install-path names and the
hvc1 check (Matroska has no codec tag). Capability report gains container/audio_downmix/
subs and 'containers' (contract 3, version 1.2.0).
Verified: scripts/test_tracks.py 55/55 (both containers end to end, per-packet md5),
plus two real library_run.py runs (MP4 3x AAC incl. 6ch + 2x mov_text; MKV bit-exact).