Skip to content

[Bug] Export silently produces video-only file when source audio track cannot be read (long recordings) / 长录制导出时音轨读取失败被静默降级,导出无声音 #26

Description

@davidy1402

Summary

Exporting an ~8.4 minute recording (502 s) produced an MP4 with no audio track at all (verified with ffprobe: only one H.264 video stream). The preview in the editor played audio correctly before export. A short recording of a few seconds exported fine with audio.

The original recording in ~/Library/Application Support/CursorLens/recordings/ does contain a valid mono 44.1 kHz AAC track, so the audio was captured correctly — it was lost during export.

Root cause (from reading the source)

In src/lib/exporter/videoExporter.ts:

  1. resolveSourceAudioTrack() re-parses the source recording with mediabunny (UrlSource, then a fetch().blob() BlobSource fallback that loads the whole file into memory).
  2. If both attempts fail, it logs console.warn('[VideoExporter] Audio track extraction failed; continuing with video-only export.', ...) and the export silently degrades to video-only (hasSourceAudio = false), with only the editor.exportWarningAudioTrackUnavailable warning surfaced after the fact.

For a long/large recording this extraction step is much more likely to fail (large blob allocation, etc.), which matches the observed behavior: short clip → audio OK, 8-minute recording → silent export. The preview is unaffected because it plays the file through a plain <video> element.

Why this is painful

A long export takes a long time and a lot of energy, and the user only discovers at the very end (or later, after sharing the video) that the audio is gone. A silent fallback is the wrong trade-off here.

Suggested improvements

  1. Fail loudly: if audioEnabled is true and the source recording has an audio track that cannot be read, abort the export with a clear error (or ask the user to confirm a video-only export) before spending minutes rendering frames.
  2. Check audio extraction at the start of the export, not just emit a warning at the end.
  3. Log the underlying mediabunny error to help diagnose why extraction fails on long recordings; consider streaming instead of fetch().blob() for large files.
  4. Docs/FAQ note: audio can be recovered afterwards by remuxing the original file from recordings/ with ffmpeg (-map 0:v -map 1:a -c copy) — this worked perfectly for me.

Environment

  • CursorLens 1.2.9, macOS (Apple Silicon), native ScreenCaptureKit recorder
  • Recording: 502 s, H.264 + mono AAC 44.1 kHz (audio present in source)
  • Export result: H.264 only, no audio stream

中文摘要:8 分钟录制导出后完全没有音轨(ffprobe 验证),但原始录制文件里有正常的 AAC 音轨,预览也有声音。原因是 videoExporter.tsresolveSourceAudioTrack() 读取音轨失败后被静默降级为纯视频导出。建议:导出前先校验音轨可读,失败时明确报错中断,而不是花很长时间导出一个无声视频。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions