From d6b0b3a9a6980b4c0ba5040d415a4eae73faab17 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Thu, 4 Jun 2026 05:06:40 +0000 Subject: [PATCH] fix(capture): restore proven-clean wallclock audio (match de509c6 baseline) Removing wallclock made A/V length drift far worse (audio 11.8% long). The known-clean config used wallclock + master aresample=async=1; the leading silence is a standby backlog artifact addressed by the bridge live-edge flush + record-start audio FIFO drain, not by changing the timestamp source. --- services/capture/src/capture-manager.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/services/capture/src/capture-manager.js b/services/capture/src/capture-manager.js index c14fec1..5e334ed 100644 --- a/services/capture/src/capture-manager.js +++ b/services/capture/src/capture-manager.js @@ -720,15 +720,11 @@ class CaptureManager { '-video_size', fcSize, '-framerate', fcFps, '-i', 'pipe:0', - // Audio FIFO → ffmpeg input 1. The bridge flushes its slot backlog to - // the live edge on reader-attach, so the FIFO delivers live audio in - // lockstep with the video. We DERIVE audio PTS from the s16le sample - // count starting at 0 — the SAME origin as the video's frame-0 PTS — - // rather than from wall-clock arrival. Wall-clock stamped the first - // audio chunk at a time offset from video frame 0, and the master - // aresample then PADDED ~2.5s of leading silence to align them. With - // sample-count PTS both streams share one origin → no pad, no leading - // silence, length locked. + // Audio FIFO → ffmpeg input 1. Wallclock timestamps + master + // aresample=async=1 is the proven-clean A/V config; both inputs must + // start from the live edge (see the fc_pipe + audio flush at record + // start) so aresample has minimal correction to do. + '-use_wallclock_as_timestamps', '1', '-thread_queue_size', '512', '-f', 's16le', '-ar', '48000',