Skip to content

Long recording (70min/5GB) crashes on stop — MP4 missing moov atom AND cursor.json never written, recording unusable #821

Description

@lyzbcy

Environment: macOS 15 (arm64, Apple Silicon), Recordly v1.3.3

What happened

Stopped a ~70-minute screen recording (~5.2GB). Recordly threw an error right after stopping. The resulting MP4 is unplayable: it contains only ftyp/wide/mdat — the moov atom was never written (finalization failed). Additionally, no recording-*.mp4.cursor.json sidecar was generated, so all cursor data for auto-zoom is permanently lost. This appears to be the same bug as #51, which was closed without a fix.

I was able to recover the video data with untrunc using a healthy recording from the same app as reference, but the cursor metadata is unrecoverable.

Two data-loss root causes

  1. MP4 index written only at the very end (moov written on finalize). Any crash/error on stop = total loss of an hours-long recording.
  2. cursor.json written only at the very end — same all-or-nothing failure mode, and this file cannot be reconstructed with third-party tools.

Suggested fixes

  1. Use fragmented MP4 (movflags +frag_keyframe+empty_moov) so the file stays playable at any point even if the process dies before finalization. This is the standard approach for crash-safe recording.
  2. Incrementally flush cursor events during recording — e.g. append to a .cursor.jsonl.tmp sidecar and merge/rename on finalize. A crash then loses at most the last second of cursor data instead of everything.
  3. On next app launch, detect orphaned recordings (MP4 without .cursor.json) and offer automatic recovery (moov reconstruction / remux).
  4. On stop failure, surface a clear error and keep the partial file instead of just erroring out.

Happy to provide a sample (head/tail of the broken file) if useful for reproduction. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions