[Recording] Move raw capture off the WAV container to headerless s16le #321
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: HIGH. Found in the August 2026 session lifecycle review (#319). This is a required companion to the wall-clock anchoring fix — that fix is not shippable without it.
The defect
Once gaps are filled with silence, each raw track becomes wall-clock length rather than speech length. Raw 48 kHz stereo s16 is 192 KB/s, so a track reaches 4.15 GB at the default
max_recording_hours = 6(bot/questboard_bot/config.py:38-39). That exceeds WAV's 4 GB RIFFu32size limit, and Python'swavemodule patches the RIFF/data sizes atclose()— so the write fails at the very end, after the whole session has been captured.Today this is latent, because tracks are compressed to speech only and never get near the limit.
Evidence
bot/questboard_bot/cogs/recording.py:130-143—wave.open(..., "wb")per speaker,writeframesrawper packetbot/questboard_bot/cogs/recording.py:222-231— sizes patched once atclose()bot/questboard_bot/config.py:38-39—max_recording_hoursdefault 6bot/questboard_bot/utils/audio.py:85-91— the FFmpeg conversion to 16 kHz monoProposed fix
Write raw capture as a headerless
.s16lefile and convert with an explicit input format:This removes the container size ceiling entirely, and it also allows
seek()-based sparse holes for gap silence — on ext4/overlay2 that makes long silences cost no disk at all, which is a meaningful saving once every track is wall-clock length.The shipped 16 kHz mono WAV is 32 KB/s, i.e. ~690 MB for a 6-hour session, comfortably inside RIFF limits. No change needed there.
Acceptance criteria
.s16le, not WAV-f s16le -ar 48000 -ac 2explicitly on the inputseek()rather than writing zeroesShipped — closing as part of a v3.11.5 bookkeeping sweep. The work landed; the issues were never closed.
Evidence in the implementing code,
bot/questboard_bot/cogs/recording.py:108:The migration path is handled too:
main.py:341,357sweeps both*_raw.s16leand*_raw.wav, the latter explicitly for "pre-#321 builds [that] left behind and may still be on an upgraded volume".