fix(audio): drop null muxer from probe to restore duration parsing

- Remove -f null - from probeMediaDurationSeconds() ffmpeg args
  so the command always exits non-zero (no output file specified)
- Without -f null -, ffmpeg exits code 1 and stderr lands in the
  catch block where Duration is parsed, fixing the bug where
  duration returned 0 on valid recordings
- probeMediaDurationSeconds returning 0 caused the
  videoDuration > 0 gate to skip all audio sync correction,
  leaving system audio misaligned in the final recording
This commit is contained in:
Mohamed
2026-04-10 19:33:26 +02:00
parent d5a17d396b
commit 0054bebef6
+1 -1
View File
@@ -1589,7 +1589,7 @@ async function muxNativeVideoExportAudio(
async function probeMediaDurationSeconds(filePath: string): Promise<number> {
const ffmpegPath = getFfmpegBinaryPath()
try {
await execFileAsync(ffmpegPath, ['-i', filePath, '-f', 'null', '-'], { timeout: 30000, maxBuffer: 2 * 1024 * 1024 })
await execFileAsync(ffmpegPath, ['-i', filePath], { timeout: 30000, maxBuffer: 2 * 1024 * 1024 })
} catch (error) {
// ffmpeg reports info on stderr even on "success" — parse it from the error
const stderr = (error as NodeJS.ErrnoException & { stderr?: string })?.stderr ?? ''