From dc9b25149cbbd4c418cba40ec36178c1b3a0735c Mon Sep 17 00:00:00 2001 From: shrimbly Date: Fri, 20 Feb 2026 22:11:19 +1300 Subject: [PATCH] fix: add diagnostic logging for audio pipeline in VideoStitch node Audio from generateAudio was being silently dropped during video stitching. Add [VideoStitch] checkpoint logs at each stage where audio can be discarded: getConnectedInputs, prepareAudioAsync, and codec detection. Surface codec failure as a visible progress warning instead of only console.warn. Co-Authored-By: Claude Opus 4.6 --- src/hooks/useAudioMixing.ts | 5 ++--- src/hooks/useStitchVideos.ts | 3 ++- src/store/execution/videoProcessingExecutors.ts | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/hooks/useAudioMixing.ts b/src/hooks/useAudioMixing.ts index b762c8f7..27b69e7e 100644 --- a/src/hooks/useAudioMixing.ts +++ b/src/hooks/useAudioMixing.ts @@ -228,9 +228,8 @@ export async function prepareAudioAsync( duration: totalSamples / sampleRate, }; } catch (error) { - const errorMessage = error instanceof Error ? error.message : 'Unknown error'; - console.error('Audio mixing error:', error); - throw new Error(`Failed to process audio: ${errorMessage}`); + console.error('[VideoStitch] Audio preparation failed:', error instanceof Error ? error.message : error, error); + throw new Error(`Failed to process audio: ${error instanceof Error ? error.message : 'Unknown error'}`); } } diff --git a/src/hooks/useStitchVideos.ts b/src/hooks/useStitchVideos.ts index e441cf8a..13f0ad5d 100644 --- a/src/hooks/useStitchVideos.ts +++ b/src/hooks/useStitchVideos.ts @@ -243,7 +243,8 @@ export async function stitchVideosAsync( }); if (!audioCodec) { - console.warn('No supported audio codec found, continuing without audio'); + console.warn('[VideoStitch] No supported audio codec found, continuing without audio'); + updateProgress('processing', 'Warning: no supported audio codec — audio skipped', 10); } else { updateProgress('processing', `Adding audio track (${audioCodec})...`, 10); diff --git a/src/store/execution/videoProcessingExecutors.ts b/src/store/execution/videoProcessingExecutors.ts index edb20225..c6af158d 100644 --- a/src/store/execution/videoProcessingExecutors.ts +++ b/src/store/execution/videoProcessingExecutors.ts @@ -55,6 +55,7 @@ export async function executeVideoStitch(ctx: NodeExecutionContext): Promise 0 && inputs.audio[0]) { + console.log('[VideoStitch] Audio input detected, preparing audio...'); const { prepareAudioAsync } = await import("@/hooks/useAudioMixing"); const audioUrl = inputs.audio[0]; const audioResponse = await fetch(audioUrl); @@ -68,6 +69,14 @@ export async function executeVideoStitch(ctx: NodeExecutionContext): Promise