From 5ed7603ff6a2d5c0d15fc98aa84c6738d93bdd1c Mon Sep 17 00:00:00 2001 From: Armando Garcia <92326387+argarcia-ottersoft@users.noreply.github.com> Date: Wed, 23 Sep 2026 20:36:30 -0700 Subject: [PATCH] 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 --- plugins/homekit/src/types/camera/camera-recording.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/homekit/src/types/camera/camera-recording.ts b/plugins/homekit/src/types/camera/camera-recording.ts index 3b9f8f754..daf455b9d 100644 --- a/plugins/homekit/src/types/camera/camera-recording.ts +++ b/plugins/homekit/src/types/camera/camera-recording.ts @@ -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) {