diff --git a/apps/whispering/src/lib/services/desktop/recorder/ffmpeg.ts b/apps/whispering/src/lib/services/desktop/recorder/ffmpeg.ts index 30941b08b1..7cfcec77c5 100644 --- a/apps/whispering/src/lib/services/desktop/recorder/ffmpeg.ts +++ b/apps/whispering/src/lib/services/desktop/recorder/ffmpeg.ts @@ -254,7 +254,9 @@ const enumerateDevices = async (): Promise> => { } // FFmpeg lists devices to stderr, not stdout - const output = result.stderr; + const output = DESKTOP_PLATFORM !== 'linux' + ? result.stderr + : result.stdout; const devices = parseDevices(output); @@ -572,10 +574,15 @@ function parseDevices(output: string): Device[] { }, linux: { // Linux ALSA format: hw:0,0 Device Name - regex: /^(hw:\d+,\d+)\s+(.+)/, + // Linux arecord format: card X: , device Y: + regex: /^card (\d+).+device (\d+): (.+)(?: \[.+\])*/, extractDevice: (match) => ({ - id: asDeviceIdentifier(match[1] ?? ''), - label: match[2]?.trim() ?? '', + id: asDeviceIdentifier( + match[1] && match[2] + ? `hw:${match[1]},${match[2]}` + : '' + ), + label: match[3]?.trim() ?? '', }), }, } satisfies Record<