fix(export): stop silently dropping audio when source track extraction fails#27
Open
davidy1402 wants to merge 1 commit into
Open
Conversation
…n fails Exporting long recordings could produce a video-only MP4: audio is re-extracted from the source file via mediabunny, and when both the UrlSource and BlobSource reads failed (which happens with large file:// sources), the exporter logged a console warning and silently continued without audio. The user only found out after a long export. - Add a read-current-video-bytes IPC channel so the renderer can read the source bytes directly from disk through the main process, and use it as a third BufferSource fallback for audio extraction. - Fail the export with a clear error before frame rendering starts if every extraction attempt errors, instead of silently degrading. A source that parses fine but has no audio track still exports video-only with the existing warning. - Add regression tests for the fallback chain. Fixes blueberrycongee#26 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #26.
Exporting a long recording (~8 min) produced an MP4 with no audio track at all, while short clips exported fine and the editor preview played audio correctly. The source recording contains a valid mono 44.1 kHz AAC track.
Root cause: during export, audio is re-extracted from the source file via mediabunny. When both the
UrlSourceand theBlobSource(fetch().blob()) reads fail — which happens with largefile://sources —resolveSourceAudioTrack()logged a console warning and silently continued with a video-only export. The user only discovers the missing audio after a long, CPU-intensive export.I verified the failure is in the fetch layer, not the file: parsing the exact same 263 MB recording with mediabunny's
BufferSourcefrom raw bytes finds the AAC track instantly.Changes
read-current-video-bytesIPC channel (main + preload + type defs): lets the renderer read the current video's bytes directly from disk through the main process. Only the already-registeredcurrentVideoPathcan be read — the renderer cannot pass arbitrary paths.resolveSourceAudioTrack()now triesUrlSource→BlobSource→BufferSource(via the new IPC channel), so audio extraction succeeds even whenfetch(file://)misbehaves on large files.editor.exportWarningAudioTrackUnavailablewarning.videoExporterAudio.test.ts).Testing
npx tsc --noEmit— cleannpx vitest --run— 169/169 tests passnpm run build:mac) and confirmed the fix ships in the bundle🤖 Generated with Claude Code