Skip to content

Audio analysis fails when trimming a long recording #6374

Closed

Description

@AksharP5

Describe the bug

hyperframes audio loses all measurements for a valid recording when a --skip-file-seconds trim leaves either a long skipped portion or a long retained portion. Instead of returning timings and the skipped-peak warning, the item reports could not read: Maximum call stack size exceeded.

This affects taking a late excerpt from a long interview or recording and measuring where that excerpt would land in the film.

Minimal reproduction

From a checkout of main at 84b63193463bac2e3e7f8500d03fb7da9fbf8846, with bun install --frozen-lockfile and bun run build completed, generate a 30-minute, 2-second synthetic recording. The last two seconds are quieter than the preceding audio:

ffmpeg -hide_banner -loglevel error \
  -f lavfi -i 'sine=frequency=440:sample_rate=8000:duration=1802' \
  -af "volume='if(lt(t,1800),1,0.25)':eval=frame" \
  -c:a pcm_s16le recording.wav

No private media, account, ASR model, or browser is needed.

Steps to reproduce

Run the source CLI from that checkout:

HYPERFRAMES_NO_TELEMETRY=1 HYPERFRAMES_NO_UPDATE_CHECK=1 \
  node --import tsx packages/cli/src/cli.ts audio recording.wav \
  --place-at 4 --skip-file-seconds 1800 --only moments --quality fast --json

Expected behavior

Return the measurements for file seconds 1800 through 1802, placed at film seconds 4 through 6. Warn that the louder part of the recording was skipped.

Actual behavior

The item contains:

{
  "window": null,
  "duration": null,
  "sampleRate": null,
  "channels": null,
  "provenance": {},
  "warnings": [],
  "error": "could not read: Maximum call stack size exceeded"
}

It contains no moments. The command exits 0, so a script must inspect the item's error to notice that analysis was lost.

Environment

  • Upstream main 84b63193463bac2e3e7f8500d03fb7da9fbf8846, package version 0.8.200; the source CLI identifies itself as 0.0.0-dev.
  • Linux arm64, Node.js v24.22.1, Bun 1.4.4.
  • FFmpeg and FFprobe 7.0.2-static; doctor --json confirms both are available.
  • doctor also reports an absent archive extractor, Docker, and optional TTS/music tools. These are not used by the audio reproduction.

Additional context

The CLI's skippedPeak calls loudest for both sides of the trim. loudest spreads the whole 10 ms envelope into Math.max. A 30-minute envelope contains 180,000 values, exceeding Node's function argument limit. The outer audio-item error handler then discards the otherwise successful measurements. A short trim leaving a long retained portion reproduces the same failure.

Regression cases using real FFmpeg reproduce both sides of the trim. Iterating over the envelope's maximum restores the measurements and preserves the skipped-peak warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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