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.