Browse Source

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 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 5 months ago
parent
commit
dc9b25149c
  1. 5
      src/hooks/useAudioMixing.ts
  2. 3
      src/hooks/useStitchVideos.ts
  3. 9
      src/store/execution/videoProcessingExecutors.ts

5
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'}`);
}
}

3
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);

9
src/store/execution/videoProcessingExecutors.ts

@ -55,6 +55,7 @@ export async function executeVideoStitch(ctx: NodeExecutionContext): Promise<voi
// Prepare audio if connected
let audioData = null;
if (inputs.audio.length > 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<voi
? rawBlob
: new Blob([rawBlob], { type: audioMime });
audioData = await prepareAudioAsync(audioBlob, 0);
if (!audioData) {
console.warn('[VideoStitch] prepareAudioAsync returned null — audio will be skipped');
} else {
console.log('[VideoStitch] Audio prepared: %ds, %d channels, %dHz',
audioData.duration.toFixed(1), audioData.buffer.numberOfChannels, audioData.buffer.sampleRate);
}
} else {
console.log('[VideoStitch] No audio connected (inputs.audio.length=%d)', inputs.audio.length);
}
const { stitchVideosAsync } = await import("@/hooks/useStitchVideos");

Loading…
Cancel
Save