Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Feb 12, 2026

feat(fs-sync, mac): add macOS AAC-in-MP4 fallback via afconvert; extract crates/afconvert

Summary

Some MP4 files recorded on macOS (ISOMP4 container with H.264 video + AAC-LC audio) fail to decode via Symphonia (rodio backend) due to AAC validation in their MP4 demuxer/decoder. This PR adds a macOS-only fallback path in plugins/fs-sync/src/audio.rs:

  • When rodio::Decoder::try_from(file) fails on macOS:
    • Use a new reusable crate crates/afconvert to call the system afconvert tool to extract audio to a temporary 16-bit LE WAV.
    • Re-open that WAV with rodio and continue the existing resample → mono mixdown → Vorbis encode flow.
    • Clean up the temporary WAV file in all paths.

Additionally:

  • New crates/afconvert crate encapsulates the afconvert invocation and error handling for reuse elsewhere.
  • Wire hypr-afconvert as a workspace dependency and add it to plugins/fs-sync.

Scope of change is tightly limited to the import path; no other audio capture or STT flows are modified. On non-macOS platforms, behavior is unchanged. On macOS, the fallback only triggers if rodio decoding fails.

Changes of interest:

  • crates/afconvert: tiny crate exposing to_wav(&Path) -> Result<PathBuf, Error>.
  • fs-sync/audio.rs: refactor to a helper import_audio_from_decoder and add macOS fallback path using hypr_afconvert::to_wav.
  • fs-sync/error.rs: add AudioProcessingError::AfconvertFailed(String) for clear surfacing of conversion errors.

Review & Testing Checklist for Human (3 items)

  • macOS manual verification with a known-problematic MP4 (H.264 video, AAC-LC audio as described). Import the file into a session and confirm:
    • The fallback path is used (rodio initially fails, no unhandled errors shown).
    • audio.ogg is created and playable; transcription paths still work.
    • No stray temp files remain in /tmp (or std::env::temp_dir()).
  • Regression check on macOS and Linux with common formats (wav, mp3, ogg, flac, m4a): ensure imports succeed and no unexpected fallback is taken when rodio succeeds normally.
  • Code review for platform gating and dependency wiring:
    • hypr-afconvert usage only inside #[cfg(target_os = "macos")] block for the fallback call.
    • Workspace dependency alias is correct (hypr-afconvert in Cargo.toml, referenced as hypr_afconvert in code).
    • Temporary file cleanup executes on both success and error paths.

Recommended test plan:

  1. On macOS:
    • Import an MP4 from macOS screen recording (ISOMP4 with AAC-LC) that previously failed in-app. Confirm the file imports and audio.ogg is generated.
    • Import an audio-only M4A and MP3 to ensure we don’t regress the happy path.
  2. On Linux:
    • Import the sample files in crates/data/src/english_1/* to ensure nothing regresses.
  3. If available, quickly run the fs-sync tests: cargo test -p tauri-plugin-fs-sync (already passing locally).

Notes

  • The afconvert tool is part of macOS and the fallback should only be hit when rodio fails. If afconvert is unavailable or fails, a clear AfconvertFailed error is returned.
  • No changes to the main audio processing pipeline besides the decode fallback; encoding, sample rate (16k), mono mixdown, and ogg handling remain identical.
  • Link to Devin run (context and discussion): https://app.devin.ai/sessions/65f0601bcc694a579b7ce584a47229e7
    Requested by: @yujonglee

Open with Devin

…ct reusable crates/afconvert

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@netlify
Copy link

netlify bot commented Feb 12, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 2de11c2
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/698e743a68fa5700089fd665

@netlify
Copy link

netlify bot commented Feb 12, 2026

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 2de11c2
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/698e743ad8e0400008eb4be0
😎 Deploy Preview https://deploy-preview-3924--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 5 additional findings in Devin Review.

Open in Devin Review

devin-ai-integration bot and others added 3 commits February 12, 2026 15:49
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@yujonglee yujonglee merged commit aa79799 into main Feb 13, 2026
18 of 19 checks passed
@yujonglee yujonglee deleted the devin/1770909008-afconvert-fallback branch February 13, 2026 00:49
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