fix(homekit): decode Opus with libopus for HKSV recordings (#1617) (#2158)

ffmpeg's native opus decoder mis-parses SILK in-band FEC (LBRR) frames
and outputs loud bursts of noise. Ring cameras send 60 ms SILK packets
with in-band FEC, so every HKSV recording transcoded from them to AAC
contained full-scale static. Force the libopus decoder when the
recording source audio is Opus; the plugin already depends on libopus
for live stream audio transcoding.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Armando Garcia
2026-09-23 20:36:30 -07:00
committed by GitHub
parent 8a682f102b
commit 5ed7603ff6

View File

@@ -176,6 +176,10 @@ export async function* handleFragmentsRequests(streamId: number, device: Scrypte
}
}
// ffmpeg's native opus decoder mis-parses SILK in-band FEC (LBRR) frames,
// which Ring cameras send, and outputs loud bursts of noise. libopus decodes them correctly.
if (audioCodec?.toLowerCase() === 'opus')
inputArguments.push('-c:a', 'libopus');
inputArguments.push(...ffmpegInput.inputArguments);
if (noAudio) {