# How I Built a Safari-Safe iPhone Voice Memo (.m4a) Transcriber with Presigned R2 Uploads, Hybrid Diarization & Zero-Upload Subtitle Tools

> Source: <https://dev.to/faddeiwang/how-i-built-a-safari-safe-iphone-voice-memo-m4a-transcriber-with-presigned-r2-uploads-hybrid-387m>
> Published: 2026-12-06 14:28:26+00:00

**Recommendation:** Avoid AudioContext.decodeAudioData for long .m4a files on mobile Safari; read duration from the mvhd atom and upload directly to object storage with presigned URLs.
More in the playbook "Running AI in production": <https://wpnews.pro/playbooks/production-ops>

If you have ever tried to build a web app that transcribes **iPhone Voice Memos (`.m4a`)**, you quickly run into a wall of edge cases that tutorial Whisper demos completely gloss over:

`.m4a` into PCM with `AudioContext.decodeAudioData` (a 2-hour 48 kHz float32 buffer eats ~1.4 GB of RAM).`$20/month` subscriptions
Here are the engineering decisions and open-source utilities behind **[TranscribeVoiceMemo.com](https://transcribevoicememo.com/)**, an independent web workspace built for long iPhone `.m4a` voice memos, interviews, and podcasts (up to 250 MB / 3 hours per file, 24-hour raw audio auto-delete, and pay-as-you-go packs).

All reference Python utilities, `.srt`/`.vtt` formatters, and grounded AI prompt templates discussed below are MIT-licensed on GitHub at **[FujieW/voice-memo-transcript-toolkit](https://github.com/FujieW/voice-memo-transcript-toolkit)** and documented in the **[Voice Memo & Subtitle Transcription Handbook](https://faddei-tools.gitbook.io/voice-memo-transcription-handbook)**.

Apple's Voice Memos app saves audio inside an **ISO BMFF (`.m4a`)** container using one of two settings in iOS Settings → *Voice Memos → Audio Quality*:

| iOS Audio Quality | Internal Codec | Typical Bitrate | 60-Min File | 3-Hour File | 
|---|---|---|---|---|
| **Compressed** (default) | AAC-LC (mono, 48 kHz) | ~64 kbps | ~29 MB | ~86 MB | 
| **Lossless** | Apple Lossless (ALAC) | ~500–800 kbps | ~225–360 MB | ~675 MB+ | 

In our first prototype, reading duration client-side via `AudioContext.decodeAudioData()` worked fine on desktop Chrome for 3-minute test clips—and immediately killed mobile Safari on a 75-minute client interview.

Instead of decoding audio in browser RAM or proxying uploads through Next.js API routes:

`PUT` URL`.mp3` first (documented step-by-step on our `ffmpeg` or `ffprobe` to inspect `ftyp` and `moov/mvhd` atoms takes ~30 lines of standard-library Python (from `tools/m4a_inspector.py` in our toolkit):

``` python
import struct
from typing import BinaryIO

def read_atoms(f: BinaryIO, start: int, end: int) -> list[tuple[str, int, int]]:
    atoms = []
    pos = start
    while pos + 8 <= end:
        f.seek(pos)
        header = f.read(8)
        if len(header) < 8:
            break
        size, atom_type_bytes = struct.unpack(">I4s", header)
        header_len = 8
        if size == 1:  # 64-bit extended atom size
            size = struct.unpack(">Q", f.read(8))[0]
            header_len = 16
        elif size == 0:
            size = end - pos
        if size < header_len or pos + size > end:
            break
        atoms.append((atom_type_bytes.decode("latin-1", errors="replace"),
                      pos + header_len, pos + size))
        pos += size
    return atoms
```

Once `moov -> mvhd` is located, dividing `duration / timescale` gives exact playback seconds with zero native binary dependencies.

For multi-speaker calls—like journalists, UX researchers, and recruiters running 1-to-3-hour sessions on our **[Interview Transcription](https://transcribevoicememo.com/interview-transcription)** and **[MP3 to Text](https://transcribevoicememo.com/mp3-to-text)** flows—losing `Speaker A / Speaker B` labels during a transient API timeout ruins the output.

Our routing splits workloads by intent rather than forcing one model for everything:

All engines normalize into one canonical utterance array:

```
{
  "utterances": [
    {
      "speaker": "Speaker A",
      "start": 0.42,
      "end": 7.91,
      "text": "Thanks everyone for hopping on. Let's lock in the Voice Memos upload workflow."
    }
  ]
}
```

Generic "summarize this transcript" prompts love inventing action items and owners that were never spoken. For **[Voice Memo to Notes AI](https://transcribevoicememo.com/voice-memo-to-notes)**, we decoupled transcription from structured post-processing using four strict, grounded prompt modes (open-sourced in `prompts/meeting-notes-prompts.json`):

| Mode | Output Structure | Grounding Constraint | 
|---|---|---|
| `meeting_notes` | Executive TL;DR, Key Takeaways ( `[MM:SS]` ), Decisions, Action Items | Strictly facts spoken in transcript | 
| `clean_transcript` | Filler-free paragraphs with preserved speaker labels & timestamps | No summarizing or paraphrasing away details | 
| `follow_up_email` | Subject line, recap, and owner-tagged next steps | Exact dates, metrics, and language match | 
| `study_notes` | Topic headings, key definitions, and 5–8 Q&A review cards | Derived strictly from spoken lecture | 

`.srt` / `.vtt` Generation & Zero-Upload Browser Utilities
When exporting subtitles for Premiere Pro, CapCut, DaVinci Resolve, or YouTube via **[Audio to SRT Converter](https://transcribevoicememo.com/audio-to-srt)**, raw ASR segments often produce 180-character single-line blocks that overflow video frames.

Our deterministic formatter (`tools/transcript_to_srt.py`) enforces three broadcast rules:

`end > start`) so quick interjections never flicker.` 00:01:12,450`) and WebVTT (` WEBVTT` header and dot milliseconds (`00:01:12.450`):

``` php
def format_timestamp(seconds: float, separator: str = ",") -> str:
    total_ms = max(0, int(round(seconds * 1000)))
    hours, rem = divmod(total_ms, 3_600_000)
    minutes, rem = divmod(rem, 60_000)
    secs, ms = divmod(rem, 1_000)
    return f"{hours:02d}:{minutes:02d}:{secs:02d}{separator}{ms:03d}"
```

While building this pipeline, we noticed a large chunk of creators and meeting teams already *have* an `.srt` or Zoom `.vtt` file and just need fast format cleanup—no AI backend required. So we shipped 5 pure-JavaScript, zero-upload utilities under **[Free Browser Subtitle & Transcript Tools](https://transcribevoicememo.com/tools)**:

`[MM:SS]` transcripts locally.`+/-` audio offsets and `23.976 / 24 / 25 / 29.97` FPS frame-rate drift instantaneously in browser.
No single tool fits every workflow. Here is how the four common approaches compare:

| Approach | Strengths | Trade-Offs | 
|---|---|---|
| **Apple iOS Built-in Voice Memos** | Free, native on iPhone/Mac | No Speaker A/B labels, no structured meeting notes, no `.srt` /`.docx` export, Apple-only | 
| **Local Whisper / MacWhisper** | 100% offline, great privacy on Apple Silicon | Requires desktop install & GPU/M-series RAM; slow on older laptops; no browser workflow on iPhone | 
| **Subscription Cloud Tools (Otter / Notta / TurboScribe)** | Strong live meeting bots & team workspaces | Monthly recurring fee ( `$10–$30/mo` ) even if you only transcribe 1–2 long recordings a month | 
| **Direct-Upload Pay-As-You-Go ([TranscribeVoiceMemo](https://transcribevoicememo.com/))** | Safari-safe up to 250 MB / 3h, Speaker A/B at 0% surcharge, 24h auto-delete, packs from `$4.90` valid 365 days | Async file upload (not a live Zoom meeting bot); requires internet for AI transcription | 

To make privacy verifiable rather than marketing copy, our **[Security & 24h Auto-Delete](https://transcribevoicememo.com/security)** architecture enforces:

If you have hit other weird `.m4a` container quirks (especially Apple Lossless ALAC or multi-track QuickTime `.mov` exports) or want another client-side caption utility added to `/tools`, drop a comment below—happy to share benchmarks or add it to the open-source toolkit.
