Skip to content

fix(export): keep mic sidecar in native audio mix#557

Merged
meiiie merged 1 commit into
mainfrom
fix/voice-audio-continuity
May 22, 2026
Merged

fix(export): keep mic sidecar in native audio mix#557
meiiie merged 1 commit into
mainfrom
fix/voice-audio-continuity

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 22, 2026

Summary

  • Keep companion mic/system sidecar audio in the native/static export audio plan when the source MP4 also has an embedded audio track.
  • Thread the resolved fallback path list into offline audio rendering so the edited-track mix uses both embedded source audio and external sidecars.
  • Add regression coverage for the fix(export): route Windows auto through native GPU planner #504-style case where the native exporter previously saw only the sidecar fallback.

Why

A latest beta user reported that a one-minute recording exported with voice suddenly gone. This matches a #504 audio-continuity slice: when native/static export selects an offline audio render, the exporter can drop the mic sidecar if it only treats the embedded source track as the audio source.

This PR is intentionally narrow. It does not claim to fix capture-path failures where the mic sidecar itself is blank or missing.

Verification

  • npm test -- src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts src/lib/exporter/sourceAudioFallback.test.ts src/lib/exporter/sourceTrackRoutingPolicy.test.ts electron/ipc/recording/diagnostics.test.ts
  • npx tsc --noEmit
  • npx biome check --formatter-enabled=false src/lib/exporter/modernVideoExporter.ts src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts src/lib/exporter/sourceAudioFallback.ts src/lib/exporter/sourceTrackRoutingPolicy.ts electron/ipc/recording/diagnostics.ts
  • git diff --check

Summary by CodeRabbit

  • Tests

    • Added test coverage for companion audio (microphone) mixing with native video exports when source MP4 already contains audio.
  • Improvements

    • Enhanced audio fallback path resolution for native video exports to properly handle mixed companion audio scenarios.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 76bad86b-08ed-4ed8-8090-c10733e1212a

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfc522 and bc2b6d7.

📒 Files selected for processing (2)
  • src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
  • src/lib/exporter/modernVideoExporter.ts

📝 Walkthrough

Walkthrough

ModernVideoExporter centralizes source audio fallback paths resolution for native exports by introducing a getNativeAudioFallbackPaths() helper that computes fallback paths by filtering configured sources and resolving additional external paths when videos lack embedded audio. This computed value threads through buildNativeAudioPlan() into the NativeAudioPlan type and flows downstream through three audio rendering call sites instead of relying directly on config.

Changes

Native Audio Fallback Paths Threading

Layer / File(s) Summary
Type contract and import
src/lib/exporter/modernVideoExporter.ts
NativeAudioPlan type is extended with optional sourceAudioFallbackPaths, and resolveSourceAudioFallbackPaths import is added to support path computation.
Audio fallback paths helper
src/lib/exporter/modernVideoExporter.ts
New getNativeAudioFallbackPaths(videoInfo) helper filters configured fallback paths, optionally resolves external fallback paths when video lacks embedded audio and local source is available, and returns the augmented or original path list.
Audio plan building and fallback computation
src/lib/exporter/modernVideoExporter.ts
buildNativeAudioPlan() calls getNativeAudioFallbackPaths() to compute sourceAudioFallbackPaths and threads the result into the returned offline-render-fallback plan shape for both primary and fallback branches.
Audio rendering integration
src/lib/exporter/modernVideoExporter.ts
renderEditedAudioForNativeMux() implementation and three call sites (getNativeStaticLayoutAudioOptions, finishNativeVideoExport, finalizeExportWithFfmpegAudio) now pass sourceAudioFallbackPaths from the plan to renderEditedAudioTrack instead of using config directly.
Test coverage
src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
New test verifies companion sidecar audio mixing when source MP4 contains audio, asserting both normalized MP4 and mic paths appear in sourceAudioFallbackPaths. Updated existing test adds sourceAudioFallbackPaths assertion to strengthen offline-render plan validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • webadderallorg/Recordly#309: Updates ModernVideoExporter's native audio planning to compute and thread sourceAudioFallbackPaths via resolveSourceAudioFallbackPaths into FFmpeg/native audio rendering, directly matching this PR's downstream decoding behavior for embedded vs sidecar audio.
  • webadderallorg/Recordly#297: Both PRs touch edited-track native audio planning; the main PR adds/threads sourceAudioFallbackPaths into buildNativeAudioPlan for offline-render-fallback while #297 introduces the filtergraph-fast-path vs offline-render-fallback split based on sourceAudioFallbackPaths availability.
  • webadderallorg/Recordly#280: Both PRs propagate mic companion sidecar audio into fallback audio paths for export (via sourceAudioFallbackPaths in ModernVideoExporter offline-render-fallback muxing).

Suggested labels

Checked

Poem

🐰 hops excitedly
Audio paths now thread so fine,
From helper functions through the line,
Companion sidecars mix with cheer,
Fallback renders standing clear! 🎵

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: ensuring mic sidecar audio is preserved in the native audio export mix, which directly aligns with the primary objective.
Description check ✅ Passed The description includes Summary, Why (motivation), and Verification sections covering all essential information, though it omits the formal template structure with checkboxes and Type of Change field.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/voice-audio-continuity

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@meiiie meiiie merged commit d7dde21 into main May 22, 2026
3 checks passed
@meiiie meiiie deleted the fix/voice-audio-continuity branch May 22, 2026 12:15
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