Skip to content

fix(producer): handle no-audio source files in resolveMediaDuration#560

Merged
miguel-heygen merged 1 commit intomainfrom
fix/audio-no-stream-crash
Apr 29, 2026
Merged

fix(producer): handle no-audio source files in resolveMediaDuration#560
miguel-heygen merged 1 commit intomainfrom
fix/audio-no-stream-crash

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Apr 29, 2026

Problem

When an <audio> element referenced a file with no audio stream (e.g. a silent video used as an audio src), resolveMediaDuration called extractAudioMetadata without a guard. ffprobe threw [FFmpeg] No audio stream found, which propagated uncaught through Promise.all in compileHtmlFile and crashed the entire render.

What this fixes

Wraps the extractAudioMetadata probe in a try-catch inside resolveMediaDuration. On failure the function returns { duration: 0 }, so the element is excluded from the composition gracefully — the same pattern already used for missing files and failed HTTP downloads.

How

packages/producer/src/services/htmlCompiler.tsresolveMediaDuration():

// Before — throws and crashes the render:
const metadata =
  tagName === "video"
    ? await extractMediaMetadata(filePath)
    : await extractAudioMetadata(filePath);

// After — skips gracefully with duration 0:
} else {
  try {
    metadata = await extractAudioMetadata(filePath);
  } catch {
    return { duration: 0, resolvedPath: filePath };
  }
}

When an <audio> element referenced a file with no audio stream (e.g. a
silent screen-recording used as an audio src, or a video-only clip),
extractAudioMetadata threw "[FFmpeg] No audio stream found". The error
propagated uncaught through Promise.all in compileHtmlFile and crashed
the entire render.

Apply the same graceful-skip pattern already used for missing files and
failed downloads: catch the probe error and return { duration: 0 } so
the element is excluded from the composition without aborting the render.

Confirmed via 7 production HyperframeRenderWorkflow failures all sharing
the same TemporalMagicEditActivity.RENDER_PREVIEW stack trace.
@miguel-heygen miguel-heygen merged commit 8b234be into main Apr 29, 2026
47 of 49 checks passed
@miguel-heygen miguel-heygen deleted the fix/audio-no-stream-crash branch April 29, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant