Skip to content

Studio mode + camera on macOS: every audio-input.ogg is 0 bytes; editor fails with "Failed to open audio: End of file" #2069

Description

@arendon1

Description

Recording in Studio mode with the camera enabled produces a .cap bundle that Cap marks Complete, but every per-segment audio-input.ogg is written as a 0-byte file (mode 0600, no OggS header, ffprobeEnd of file). The per-segment mux-audio task logs Task finished successfully. The bug only surfaces when opening the recording, which shows:

Unable to Open Recording — segment 0 / mic / Failed to open audio: End of file

Visual tracks (display.mp4, camera.mp4) are unaffected and decode cleanly. The mic audio is not recoverable from the broken bundle — raw PCM is never persisted.

Expected: a valid Opus-in-OGG track per segment, matching the duration reported by recording-meta.json.

Reproduction

  1. macOS 26.5.x, Cap 0.5.7. Open Cap and select Studio mode.
  2. Enable camera + microphone. Reproduces with both the built-in 96 kHz mic and a USB 48 kHz mic.
  3. Record several segments (reproduced with 18 s, 56 s, 58 s, 63 s, and 85 s durations).
  4. Stop recording. Cap reports status: Complete.
  5. Open the recording → editor shows the dialog above.

Additional Context

  • Cap version: 0.5.7 (bundle so.cap.desktop)
  • Operating system, version: macOS 26.5.2 (25F84), arm64
  • Device: Apple silicon MacBook Air (M5). Built-in Micrófono de MacBook Air (F32 96 kHz mono) and external USB PD200X Podcast Microphone (F32 48 kHz mono) both reproduce the bug.
  • Out-of-process muxer: enabled (default outOfProcessMuxer: true)

On-disk evidence from a failing bundle:

$ ls -l content/segments/segment-*/audio-input.ogg
… segment-0/audio-input.ogg  size=0  mode=-rw-------
… segment-1/audio-input.ogg  size=0  mode=-rw-------
… segment-5/audio-input.ogg  size=0  mode=-rw-------

$ ffprobe -v error content/segments/segment-0/audio-input.ogg
[ERROR] code=-541478725 string=End of file

Same paths in a working bundle show -rw-r--r-- Opus at 48 kHz with durations matching the segment length.

Log excerpt (no error, only success):

INFO recording:studio_recording:segment{0}:mic-out:
     Microphone source configured device=… source_rate=96000 … target_rate=48000 …
INFO recording:studio_recording:segment{0}:mic-out:
     Built pipeline for output …/content/segments/segment-0/audio-input.ogg
INFO recording:studio_recording:segment{0}:mic-out:
     Padded audio tail with silence padding_ms=57 samples=2775 audio_end_ms=56489 …
INFO recording:studio_recording:segment{0}:mic-out:{task="mux-audio"}:
     Task finished successfully
INFO recording: recording wait actor done: Ok(())

Hypothesis from code review of v0.5.7: studio-with-camera uses OggMuxer (crates/recording/src/studio_recording.rs ~L1654). The chain ends in AudioEncoderBase::send_frame() (crates/enc-ffmpeg/src/audio/base.rs), whose while let Some(out_frame) = self.resampler.get_frame(…) loop silently returns Ok(()) if the BufferedResampler never accumulates enough samples to fill an Opus frame (120 / 240 / 480 / 960 / 1920 / 2880). OggFile::finish() then writes a trailer, but FFmpeg's Ogg muxer has no packets to flush, so the file stays 0 bytes. OggFile lacks the has_frames guard that FragmentedAudioFile (the M4A path used when the camera is off) has.

Workaround: Disabling Settings → Advanced → outOfProcessMuxer and re-recording produces valid audio.

Impact: Total loss of the mic track for any Studio + camera session on Cap 0.5.7 / macOS 26.5.x. Visual tracks remain usable; users can re-record only the audio or composite it externally, but that is not obvious from the UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions